/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Arial', sans-serif;
    background: linear-gradient(135deg, #2D6A4F 0%, #1B4332 100%);
    min-height: 100vh;
    color: #333;
    -webkit-tap-highlight-color: transparent;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   PAGE ACCUEIL
   ============================================ */
.page-accueil .header {
    text-align: center;
    padding: 30px 0;
    color: white;
}

.page-accueil .header h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
    font-family: 'Amiri', serif;
}

.page-accueil .subtitle {
    font-size: 18px;
    opacity: 0.9;
}

.lecons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.lecon-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    display: block;
    border-top: 5px solid #ccc;
}

.lecon-card:active {
    transform: scale(0.98);
}

.lecon-card.pending {
    border-top-color: #C9963F;
}

.lecon-card.in-progress {
    border-top-color: #2D6A4F;
}

.lecon-card.complete {
    border-top-color: #2D6A4F;
    background: linear-gradient(135deg, #f0f9f4 0%, #ffffff 100%);
}

.lecon-numero {
    font-size: 14px;
    color: #C9963F;
    font-weight: 600;
    margin-bottom: 8px;
}

.lecon-titre {
    font-family: 'Amiri', serif;
    font-size: 26px;
    font-weight: 700;
    color: #2D6A4F;
    margin-bottom: 16px;
}

.progress-bar {
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2D6A4F, #52B788);
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-text {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.check {
    color: #2D6A4F;
    font-weight: 700;
    font-size: 20px;
}

.empty-state {
    text-align: center;
    color: white;
    padding: 60px 20px;
    font-size: 20px;
}

/* ============================================
   PAGE LEÇON
   ============================================ */
.page-lecon {
    background: linear-gradient(135deg, #f5f1e8 0%, #ffffff 100%);
}

.header-lecon {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 2px solid #e8e8e8;
    margin-bottom: 16px;
    gap: 8px;
}

.btn-back, .btn-mode {
    background: #2D6A4F;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.btn-mode {
    background: #C9963F;
}

.header-lecon h2 {
    font-family: 'Amiri', serif;
    font-size: 18px;
    color: #2D6A4F;
    text-align: center;
    flex: 1;
    margin: 0 8px;
}

.progress-bar-top {
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill-top {
    height: 100%;
    background: linear-gradient(90deg, #C9963F, #2D6A4F);
    width: 0%;
    transition: width 0.4s;
    border-radius: 4px;
}

.position-info {
    text-align: center;
    font-size: 18px;
    color: #666;
    font-weight: 600;
    margin-bottom: 20px;
}

/* MOT */
.recorder-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.word-display {
    background: white;
    border-radius: 24px;
    padding: 50px 40px;
    margin-bottom: 30px;
    box-shadow: 0 8px 30px rgba(45, 106, 79, 0.15);
    width: 100%;
    max-width: 500px;
    border: 3px solid #2D6A4F;
}

.word-arabic {
    font-family: 'Amiri', serif;
    font-size: 80px;
    font-weight: 700;
    color: #1B4332;
    line-height: 1.3;
    direction: rtl;
}

.word-status {
    margin-top: 16px;
    font-size: 16px;
    color: #C9963F;
    font-weight: 600;
    min-height: 24px;
}

/* BOUTONS PRINCIPAUX */
.recorder-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.btn-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    transition: transform 0.15s;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.btn-circle:active {
    transform: scale(0.95);
}

.btn-circle .icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 4px;
}

.btn-circle .label {
    font-size: 18px;
}

.btn-record {
    background: linear-gradient(135deg, #2D6A4F, #1B4332);
    color: white;
}

.btn-stop {
    background: linear-gradient(135deg, #d62828, #9d0208);
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(214, 40, 40, 0.4); }
    50% { box-shadow: 0 8px 40px rgba(214, 40, 40, 0.8); }
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d62828;
    font-weight: 700;
    font-size: 20px;
}

.recording-indicator .dot {
    width: 14px;
    height: 14px;
    background: #d62828;
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* BOUTONS D'ACTION */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 16px;
}

.btn-action {
    padding: 14px 16px;
    border-radius: 12px;
    border: none;
    font-family: 'Cairo', sans-serif;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.15s;
    text-decoration: none;
}

.btn-action:active {
    transform: scale(0.97);
}

.btn-action .icon {
    font-size: 20px;
}

.btn-play {
    background: white;
    color: #2D6A4F;
    border: 3px solid #2D6A4F;
}

.btn-redo {
    background: white;
    color: #C9963F;
    border: 3px solid #C9963F;
}

.btn-cancel {
    background: white;
    color: #d62828;
    border: 3px solid #d62828;
}

.btn-next {
    background: linear-gradient(135deg, #2D6A4F, #52B788);
    color: white;
}

/* NAVIGATION (Précédent / Suivant sans enregistrer) */
.navigation-buttons {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 400px;
    margin-top: 8px;
}

.btn-nav {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: 2px solid #999;
    background: white;
    color: #666;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
}

.btn-nav:hover:not(:disabled) {
    border-color: #2D6A4F;
    color: #2D6A4F;
}

.btn-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-nav .icon {
    font-size: 16px;
}

/* UPLOAD */
.uploading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e8e8e8;
    border-top-color: #2D6A4F;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.uploading p {
    font-size: 20px;
    color: #2D6A4F;
    font-weight: 600;
}

/* COMPLETED */
.completed {
    text-align: center;
    padding: 40px 20px;
}

.check-big {
    font-size: 100px;
    margin-bottom: 20px;
}

.completed h2 {
    font-family: 'Amiri', serif;
    font-size: 32px;
    color: #2D6A4F;
    margin-bottom: 12px;
}

.completed p {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

.completed-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.completed-actions .btn-action {
    display: inline-flex;
    padding: 16px 32px;
    min-width: 250px;
}

/* ============================================
   MODE RÉVISION
   ============================================ */
.revision-main {
    padding: 16px 0;
}

.revision-title {
    text-align: center;
    font-family: 'Amiri', serif;
    font-size: 28px;
    color: #2D6A4F;
    margin-bottom: 8px;
}

.revision-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 24px;
    font-size: 16px;
}

.revision-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.revision-row {
    background: white;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: grid;
    grid-template-columns: 40px 1fr auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
    align-items: center;
    border-right: 4px solid #ccc;
}

.revision-row.has-audio {
    border-right-color: #2D6A4F;
}

.revision-row.no-audio {
    border-right-color: #C9963F;
    background: #fffbf0;
}

.revision-num {
    font-weight: 700;
    color: #C9963F;
    font-size: 18px;
    text-align: center;
}

.revision-arabic {
    font-family: 'Amiri', serif;
    font-size: 28px;
    color: #1B4332;
    direction: rtl;
}

.revision-audio {
    grid-column: 1 / -1;
    padding-top: 4px;
}

.revision-audio audio {
    width: 100%;
    height: 36px;
}

.no-audio-text {
    color: #999;
    font-style: italic;
    font-size: 14px;
}

.revision-actions {
    display: flex;
    gap: 6px;
}

.btn-rev {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-rev-record {
    background: #2D6A4F;
    color: white;
}

.btn-rev-delete {
    background: #fee;
    color: #c00;
    padding: 8px 12px;
}

.btn-rev:active {
    transform: scale(0.95);
}

/* UTILITAIRES */
.hidden {
    display: none !important;
}

/* RESPONSIVE - MOBILE */
@media (max-width: 600px) {
    .container {
        padding: 12px;
    }
    
    .word-display {
        padding: 36px 20px;
        margin-bottom: 24px;
    }
    
    .word-arabic {
        font-size: 60px;
    }
    
    .btn-circle {
        width: 130px;
        height: 130px;
    }
    
    .btn-circle .icon {
        font-size: 40px;
    }
    
    .btn-circle .label {
        font-size: 16px;
    }
    
    .header-lecon h2 {
        font-size: 16px;
    }
    
    .btn-action {
        font-size: 15px;
        padding: 12px 12px;
    }
    
    .btn-action .icon {
        font-size: 18px;
    }
    
    .page-accueil .header h1 {
        font-size: 28px;
    }
    
    .revision-arabic {
        font-size: 22px;
    }
    
    .revision-row {
        grid-template-columns: 32px 1fr;
    }
    
    .revision-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}
