/**
 * Civio Feedback Widget — Styles
 * Design cohérent avec le design system Civio (Inter, indigo, radius)
 */

/* =========================================================================
   VARIABLES
   ========================================================================= */

#civio-feedback-wrapper {
    --fb-primary: #6366f1;
    --fb-primary-hover: #4f46e5;
    --fb-bg: #ffffff;
    --fb-text: #1e1e2e;
    --fb-text-secondary: #6b7280;
    --fb-border: #e5e7eb;
    --fb-radius: 12px;
    --fb-radius-sm: 8px;
    --fb-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    --fb-success: #10b981;
    --fb-error: #ef4444;
    --fb-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    font-family: var(--fb-font);
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 999999;
}

/* Dark mode auto */
@media (prefers-color-scheme: dark) {
    #civio-feedback-wrapper {
        --fb-bg: #1c1c2e;
        --fb-text: #f0f0f5;
        --fb-text-secondary: #9ca3af;
        --fb-border: #2d2d44;
        --fb-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    }
}

/* =========================================================================
   TRIGGER BUTTON
   ========================================================================= */

.civio-fb-trigger {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--fb-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.civio-fb-trigger:hover {
    background: var(--fb-primary-hover);
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.civio-fb-trigger.active {
    transform: scale(0.95);
}

/* =========================================================================
   MODAL
   ========================================================================= */

.civio-fb-modal {
    position: absolute;
    bottom: 64px;
    left: 0;
    width: 360px;
    max-width: calc(100vw - 48px);
    background: var(--fb-bg);
    border-radius: var(--fb-radius);
    box-shadow: var(--fb-shadow);
    border: 1px solid var(--fb-border);
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.civio-fb-modal[aria-hidden="false"] {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.civio-fb-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--fb-border);
}

.civio-fb-modal-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--fb-text);
}

.civio-fb-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--fb-text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.15s ease;
}

.civio-fb-close:hover {
    color: var(--fb-text);
}

/* Body */
.civio-fb-modal-body {
    padding: 16px 20px 20px;
}

/* =========================================================================
   TYPE SELECTOR
   ========================================================================= */

.civio-fb-types {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.civio-fb-type {
    flex: 1;
    cursor: pointer;
}

.civio-fb-type input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.civio-fb-type-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: var(--fb-radius-sm);
    border: 1.5px solid var(--fb-border);
    font-size: 13px;
    font-weight: 500;
    color: var(--fb-text-secondary);
    transition: all 0.15s ease;
    text-align: center;
}

.civio-fb-type input:checked + .civio-fb-type-label {
    border-color: var(--fb-primary);
    color: var(--fb-primary);
    background: rgba(99, 102, 241, 0.06);
}

.civio-fb-type-label:hover {
    border-color: var(--fb-primary);
}

/* =========================================================================
   TEXTAREA
   ========================================================================= */

.civio-fb-textarea {
    width: 100%;
    border: 1.5px solid var(--fb-border);
    border-radius: var(--fb-radius-sm);
    padding: 12px;
    font-family: var(--fb-font);
    font-size: 14px;
    color: var(--fb-text);
    background: var(--fb-bg);
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.15s ease;
    box-sizing: border-box;
}

.civio-fb-textarea::placeholder {
    color: var(--fb-text-secondary);
}

.civio-fb-textarea:focus {
    outline: none;
    border-color: var(--fb-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* =========================================================================
   FOOTER
   ========================================================================= */

.civio-fb-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.civio-fb-charcount {
    font-size: 12px;
    color: var(--fb-text-secondary);
}

.civio-fb-submit {
    padding: 8px 20px;
    border: none;
    border-radius: var(--fb-radius-sm);
    background: var(--fb-primary);
    color: #fff;
    font-family: var(--fb-font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}

.civio-fb-submit:hover:not(:disabled) {
    background: var(--fb-primary-hover);
}

.civio-fb-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================================================
   STATUS MESSAGE
   ========================================================================= */

.civio-fb-status {
    margin-top: 10px;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
}

.civio-fb-status.success {
    color: var(--fb-success);
}

.civio-fb-status.error {
    color: var(--fb-error);
}

/* =========================================================================
   LOGIN MESSAGE
   ========================================================================= */

.civio-fb-login-msg {
    text-align: center;
    color: var(--fb-text-secondary);
    font-size: 14px;
    padding: 16px 0;
    margin: 0;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */

@media (max-width: 480px) {
    #civio-feedback-wrapper {
        bottom: 16px;
        left: 16px;
    }

    .civio-fb-modal {
        width: calc(100vw - 32px);
        left: -8px;
    }

    .civio-fb-trigger {
        width: 46px;
        height: 46px;
    }
}
