/* ==========================================================================
   1. VARIABLES & CONFIGURATION PREMIUM (Thème Ola-Agri Élite)
   ========================================================================== */
:root {
    --primary-color: #0f766e;
    --primary-hover: #115e59;
    --primary-light: #ccfbf1;
    --primary-gradient: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
    --accent-color: #0284c7;
    --accent-hover: #0369a1;
    --accent-light: #e0f2fe;
    --bg-color: #f0f4f8;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --error-color: #e11d48;
    --error-bg: #ffe4e6;
    --success-color: #16a34a;
    --success-bg: #dcfce7;
    --warning-color: #d97706;
    --warning-bg: #fef3c7;
    
    --border-radius-sm: 10px;
    --border-radius-md: 18px;
    --border-radius-lg: 28px;
    --border-radius-xl: 40px;
    
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 32px -8px rgba(15, 23, 42, 0.08), 0 4px 12px -4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 40px rgba(15, 118, 110, 0.12);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   2. RÉINITIALISATION & LISIBILITÉ
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg-color);
    background-image: radial-gradient(ellipse at 10% 20%, rgba(15, 118, 110, 0.03) 0%, transparent 50%),
                      radial-gradient(ellipse at 90% 80%, rgba(2, 132, 199, 0.03) 0%, transparent 50%);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

/* ==========================================================================
   3. SCROLLBAR PERSONNALISÉE
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* ==========================================================================
   4. DESIGN INTERFACES D'AUTHENTIFICATION (Login / Register)
   ========================================================================== */
.auth-container {
    background: var(--card-bg);
    padding: 48px 40px;
    border-radius: var(--border-radius-md);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(226, 232, 240, 0.5);
    text-align: center;
    margin: auto;
    animation: fadeInUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

.auth-container .logo-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-gradient);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 32px;
    color: white;
    box-shadow: 0 8px 24px rgba(15, 118, 110, 0.25);
}

.auth-container h2 {
    margin-bottom: 8px;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.auth-container .auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
    font-weight: 400;
}

/* ==========================================================================
   5. FORMULAIRES & COMPOSANTS DE SAISIE
   ========================================================================== */
form {
    text-align: left;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.3px;
}

label .required {
    color: var(--error-color);
    margin-left: 2px;
}

input, select, textarea {
    width: 100%;
    padding: 14px 18px;
    margin-bottom: 22px;
    border: 2px solid #e2e8f0;
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    color: var(--text-main);
    background-color: #f8fafc;
    transition: var(--transition-smooth);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.08);
}

input::placeholder, textarea::placeholder {
    color: var(--text-light);
}

input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.7;
}

/* ==========================================================================
   6. BOUTONS MODERNES
   ========================================================================== */
button, .btn-action, .btn-submit-validation, .btn-logout, .btn-back {
    padding: 14px 28px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(15, 118, 110, 0.2);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

button::after, .btn-action::after, .btn-submit-validation::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::after, .btn-action:hover::after, .btn-submit-validation:hover::after {
    width: 300px;
    height: 300px;
}

button:hover, .btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(15, 118, 110, 0.3);
}

button:active, .btn-action:active {
    transform: translateY(0);
}

button.secondary, .btn-secondary {
    background: var(--bg-color);
    color: var(--text-main);
    box-shadow: none;
    border: 2px solid #e2e8f0;
}

button.secondary:hover, .btn-secondary:hover {
    background: #e2e8f0;
    box-shadow: none;
}

.btn-submit-validation {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    box-shadow: 0 4px 16px rgba(2, 132, 199, 0.25);
}

.btn-submit-validation:hover {
    box-shadow: 0 8px 28px rgba(2, 132, 199, 0.35);
}

.btn-logout {
    background: transparent;
    color: var(--error-color);
    box-shadow: none;
    padding: 8px 18px;
    font-size: 13px;
    border: 2px solid var(--error-bg);
}

.btn-logout:hover {
    background: var(--error-color);
    color: white;
    box-shadow: 0 4px 16px rgba(225, 29, 72, 0.25);
    border-color: var(--error-color);
}

.btn-logout::after {
    display: none;
}

.btn-back {
    background: transparent;
    color: var(--text-muted);
    box-shadow: none;
    padding: 8px 18px;
    font-size: 13px;
    border: 2px solid #e2e8f0;
}

.btn-back:hover {
    background: #f1f5f9;
    box-shadow: none;
    transform: none;
}

.btn-back::after {
    display: none;
}

.btn-action {
    width: auto;
    padding: 12px 28px;
    font-size: 14px;
}

p {
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-muted);
}

p a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition-smooth);
}

p a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ==========================================================================
   7. NOTIFICATIONS & ALERTES
   ========================================================================== */
.alert-error, .alert-success {
    padding: 14px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    margin-bottom: 24px;
    text-align: left;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.4s ease-out;
    border: 1px solid transparent;
}

.alert-error {
    background-color: var(--error-bg);
    color: var(--error-color);
    border-color: #fecdd3;
}

.alert-error::before {
    content: '⚠️';
    font-size: 18px;
}

.alert-success {
    background-color: var(--success-bg);
    color: var(--success-color);
    border-color: #bbf7d0;
}

.alert-success::before {
    content: '✅';
    font-size: 18px;
}

/* ==========================================================================
   8. EN-TÊTE MODERNE AVEC GLASSMORPHISM
   ========================================================================== */
.app-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    color: var(--text-main);
    padding: 14px 24px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.02);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 860px;
    margin: 0 auto;
}

.header-content .header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-content .header-left .brand-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.header-content h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-content .header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    font-size: 13px;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 6px 16px;
    border-radius: var(--border-radius-xl);
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-badge::before {
    content: '👤';
    font-size: 14px;
}

/* ==========================================================================
   9. TABLEAU DE BORD PRINCIPAL
   ========================================================================== */
.dashboard-container {
    margin-top: 88px;
    width: 100%;
    max-width: 860px;
    padding: 10px 0 40px;
    animation: fadeInUp 0.5s ease-out;
}

.dashboard-container .page-header {
    margin-bottom: 32px;
}

.dashboard-container h2 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

.dashboard-container h2 .highlight {
    color: var(--primary-color);
}

.subtitle {
    color: var(--text-muted);
    font-size: 15px;
    margin-top: 4px;
}

.subtitle strong {
    color: var(--primary-color);
    font-weight: 700;
}

/* ==========================================================================
   10. CARTES DE DONNÉES MODERNES
   ========================================================================== */
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.data-card, .validation-box, .upload-box {
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    padding: 28px 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(226, 232, 240, 0.5);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.data-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition-smooth);
}

.data-card:hover::before {
    opacity: 1;
}

.data-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(15, 118, 110, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.producer-name {
    font-weight: 700;
    font-size: 18px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-tag {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 14px;
    border-radius: var(--border-radius-xl);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-meta {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 18px;
    line-height: 1.8;
}

.card-meta small {
    display: inline-block;
    margin-right: 16px;
}

.card-meta small::before {
    content: '📅 ';
}

/* ==========================================================================
   11. COMPOSANTS MULTIMÉDIA
   ========================================================================== */
.audio-section, .audio-player-box {
    margin-bottom: 18px;
}

.audio-section .section-title, .audio-player-box .label-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: block;
}

audio {
    width: 100%;
    height: 48px;
    margin-top: 4px;
    border-radius: var(--border-radius-sm);
    background: #f1f5f9;
}

audio::-webkit-media-controls-panel {
    background: #f1f5f9;
}

audio::-webkit-media-controls-play-button {
    background: var(--primary-color);
    border-radius: 50%;
    color: white;
}

.no-audio {
    font-size: 14px;
    color: var(--error-color);
    font-style: italic;
    background: var(--error-bg);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
}

.transcription-preview {
    background: #f8fafc;
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.text-preview {
    font-size: 15px;
    color: #334155;
    line-height: 1.7;
    max-height: 120px;
    overflow-y: auto;
}

/* ==========================================================================
   12. ESPACE UTILISATEUR - ENREGISTREUR VOCAL
   ========================================================================== */
.upload-box h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.upload-box h3::before {
    content: '🎙️ ';
}

.voice-recorder-section {
    margin-top: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--border-radius-sm);
    text-align: center;
    border: 2px dashed #cbd5e1;
    transition: var(--transition-smooth);
}

.voice-recorder-section:hover {
    border-color: var(--primary-color);
    background: #f8fafc;
}

.voice-recorder-section .label-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
}

#timer {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    margin-bottom: 14px;
    letter-spacing: 2px;
    font-feature-settings: "tnum";
}

.voice-recorder-section .recorder-controls {
    display: flex;
    gap: 12px;
    justify-content: center;
}

#startRecord, #stopRecord {
    width: auto;
    padding: 12px 28px;
    margin: 0;
    font-size: 14px;
    border-radius: var(--border-radius-xl);
}

#startRecord {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
}

#startRecord:hover {
    box-shadow: 0 8px 28px rgba(239, 68, 68, 0.35);
}

#startRecord:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#stopRecord {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    box-shadow: 0 4px 16px rgba(71, 85, 105, 0.25);
}

#stopRecord:hover {
    box-shadow: 0 8px 28px rgba(71, 85, 105, 0.35);
}

#stopRecord:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#audioPreviewContainer {
    margin-top: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--border-radius-sm);
    border: 1px solid #e2e8f0;
}

#audioPreviewContainer .label-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

#audioPlayback {
    margin-top: 8px;
}

#fileInputContainer {
    margin-top: 4px;
    padding: 12px;
    background: #f8fafc;
    border-radius: var(--border-radius-sm);
    border: 1px solid #e2e8f0;
}

#fileInputContainer label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

#fileInputContainer input[type="file"] {
    margin-bottom: 0;
    padding: 8px 0;
    background: transparent;
    border: none;
    font-size: 14px;
}

#fileInputContainer input[type="file"]::file-selector-button {
    padding: 8px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

#fileInputContainer input[type="file"]::file-selector-button:hover {
    background: var(--primary-hover);
    transform: scale(1.02);
}

/* ==========================================================================
   13. BADGES DE STATUT
   ========================================================================== */
.status-badge {
    padding: 4px 16px;
    border-radius: var(--border-radius-xl);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.status-waiting {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.status-done {
    background: var(--success-bg);
    color: var(--success-color);
}

/* ==========================================================================
   14. ÉTAT VIDE
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 64px 40px;
    background: var(--card-bg);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(226, 232, 240, 0.5);
}

.empty-state .empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 15px;
    margin-top: 0;
}

/* ==========================================================================
   15. VALIDATION BOX
   ========================================================================== */
.validation-box {
    padding: 32px;
}

.validation-box h2 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 20px;
}

.validation-box h2::before {
    content: '✏️ ';
}

.meta-info {
    background: #f1f5f9;
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    margin-bottom: 24px;
    color: #334155;
    line-height: 1.8;
    border: 1px solid #e2e8f0;
}

.meta-info strong {
    color: var(--text-main);
}

/* ==========================================================================
   16. ANIMATIONS
   ========================================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ==========================================================================
   17. RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .auth-container {
        padding: 32px 24px;
        margin: 20px auto;
    }

    .auth-container h2 {
        font-size: 24px;
    }

    .app-header {
        padding: 12px 16px;
    }

    .header-content h1 {
        font-size: 18px;
    }

    .header-content .header-left .brand-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .user-badge {
        font-size: 11px;
        padding: 4px 12px;
    }

    .btn-logout {
        font-size: 11px;
        padding: 4px 12px;
    }

    .btn-back {
        font-size: 11px;
        padding: 4px 12px;
    }

    .dashboard-container {
        margin-top: 76px;
        padding: 0 0 20px;
    }

    .dashboard-container h2 {
        font-size: 22px;
    }

    .data-card, .validation-box, .upload-box {
        padding: 20px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .voice-recorder-section {
        padding: 16px;
    }

    #timer {
        font-size: 24px;
    }

    #startRecord, #stopRecord {
        padding: 10px 20px;
        font-size: 13px;
    }

    .empty-state {
        padding: 40px 24px;
    }

    .empty-state .empty-icon {
        font-size: 40px;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-content .header-right {
        width: 100%;
        justify-content: flex-end;
    }

    .auth-container {
        padding: 24px 16px;
    }

    .auth-container h2 {
        font-size: 20px;
    }

    .data-card, .validation-box, .upload-box {
        padding: 16px;
        border-radius: var(--border-radius-sm);
    }

    button, .btn-action, .btn-submit-validation {
        padding: 12px 20px;
        font-size: 14px;
    }

    .voice-recorder-section .recorder-controls {
        flex-direction: column;
        align-items: center;
    }

    #startRecord, #stopRecord {
        width: 100%;
        max-width: 200px;
    }

    audio {
        height: 40px;
    }
}

/* ==========================================================================
   18. UTILITAIRES SUPPLÉMENTAIRES
   ========================================================================== */
.text-center {
    text-align: center;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}

.gap-8 {
    gap: 8px;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Pour le statut "En attente" avec une petite animation */
.status-waiting {
    animation: pulse 2s infinite;
}