/* Police optimisée pour montre */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

/* Reset et variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --text-light: #ffffff;
    --text-muted: #94a3b8;
    --border-color: #334155;
}

/* Corps pour montre */
html,
body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    color: var(--text-light);
    direction: rtl;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Container principal - adapté pour montre circulaire */
.watch-container {
    width: 100%;
    min-height: 100vh;
    /* Remove fixed max-width restriction for base to allow filling small screens */
    /* Media queries will constrain it on larger screens to simulate watch */
    margin: 0 auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically by default */
    gap: 8px;
}

/* Header compact */
.watch-header {
    text-align: center;
    padding: 4px 0;
}

.watch-header h1 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-light);
}

/* Section d'enregistrement */
.record-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 0;
    flex: 1;
    /* Allow it to take available space */
}

.nav-footer {
    width: 100%;
    padding: 10px 0;
    text-align: center;
    margin-top: auto;
}

.nav-btn-main {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 24px;
    border-radius: 30px;
    color: white;
    text-decoration: none;
    font-size: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.nav-btn-main:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.95);
}

/* Bouton d'enregistrement circulaire */
.record-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid var(--danger-color);
    background: linear-gradient(145deg, #2d1f3d, #1a1a2e);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.record-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.record-btn:active {
    transform: scale(0.95);
}

.record-btn.recording {
    background: var(--danger-color);
    animation: pulse-record 1s infinite;
    border-color: #fff;
}

.record-icon {
    font-size: 24px;
}

@keyframes pulse-record {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* Texte de statut */
.status-text {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    min-height: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}

.status-text.recording {
    color: var(--danger-color);
    animation: blink 1s infinite;
}

.status-text.success {
    color: var(--success-color);
}

.status-text.error {
    color: var(--danger-color);
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Section des tâches */
.tasks-section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Liste des tâches */
.tasks-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 2px;
    max-height: calc(100vh - 140px);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tasks-list::-webkit-scrollbar {
    display: none;
}

/* État vide */
.empty-state {
    text-align: center;
    padding: 15px 5px;
    color: var(--text-muted);
}

.empty-state span {
    font-size: 24px;
    display: block;
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 10px;
}

/* Item de tâche compact */
.task-item {
    background: var(--bg-card);
    border-radius: 8px;

    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    min-height: 36px;
}

.task-item:active {
    background: #1e3a5f;
}

.task-item.completed {
    opacity: 0.5;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Checkbox compact */
.task-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    cursor: pointer;
    accent-color: var(--success-color);
    border-radius: 4px;
}

/* Texte de tâche */
.task-text {
    flex: 1;
    font-size: 11px;
    line-height: 1.3;
    color: var(--text-light);
    word-break: break-word;
}

/* Bouton supprimer compact */
.delete-btn {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: var(--danger-color);
    color: white;
}

/* ========================================
   RESPONSIVE - Écrans plus grands
   ======================================== */

/* Petit téléphone */
@media (min-width: 240px) {
    .watch-container {
        max-width: 240px;
        padding: 10px;
    }

    .watch-header h1 {
        font-size: 16px;
    }

    .record-btn {
        width: 64px;
        height: 64px;
    }

    .record-icon {
        font-size: 28px;
    }

    .task-text {
        font-size: 12px;
    }
}

/* Téléphone standard */
@media (min-width: 320px) {
    .watch-container {
        max-width: 320px;
        padding: 12px;
        gap: 10px;
    }

    .watch-header h1 {
        font-size: 18px;
    }

    .record-btn {
        width: 72px;
        height: 72px;
    }

    .record-icon {
        font-size: 32px;
    }

    .status-text {
        font-size: 11px;
    }

    .task-item {
        padding: 10px;
        gap: 8px;
    }

    .task-text {
        font-size: 13px;
    }

    .task-checkbox {
        width: 20px;
        height: 20px;
    }
}

/* Téléphone large */
@media (min-width: 375px) {
    .watch-container {
        max-width: 375px;
        padding: 15px;
        gap: 12px;
    }

    .watch-header h1 {
        font-size: 20px;
    }

    .record-btn {
        width: 80px;
        height: 80px;
        border-width: 4px;
    }

    .record-icon {
        font-size: 36px;
    }

    .status-text {
        font-size: 12px;
    }

    .task-item {
        padding: 12px;
        border-radius: 10px;
    }

    .task-text {
        font-size: 14px;
    }

    .delete-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

/* Tablette et desktop */
@media (min-width: 480px) {
    .watch-container {
        max-width: 400px;
        padding: 20px;
        gap: 15px;
    }

    .watch-header {
        padding: 10px 0;
    }

    .watch-header h1 {
        font-size: 24px;
    }

    .record-section {
        padding: 15px 0;
        gap: 10px;
    }

    .record-btn {
        width: 90px;
        height: 90px;
    }

    .record-icon {
        font-size: 40px;
    }

    .status-text {
        font-size: 14px;
        padding: 5px 10px;
    }

    .tasks-list {
        gap: 8px;
        max-height: calc(100vh - 220px);
    }

    .task-item {
        padding: 14px;
        gap: 10px;
        border-radius: 12px;
    }

    .task-text {
        font-size: 16px;
    }

    .task-checkbox {
        width: 24px;
        height: 24px;
    }

    .delete-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .empty-state span {
        font-size: 32px;
    }

    .empty-state p {
        font-size: 14px;
    }
}

/* Grand écran */
@media (min-width: 768px) {
    .watch-container {
        max-width: 500px;
        padding: 25px;
    }

    .watch-header h1 {
        font-size: 28px;
    }

    .record-btn {
        width: 100px;
        height: 100px;
    }

    .record-icon {
        font-size: 44px;
    }

    .task-text {
        font-size: 18px;
    }
}

/* Animation d'apparition des tâches */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}


.task-item {
    animation: slideIn 0.2s ease;
}


/* === SYSTEME DE PAGES === */
.watch-container {
    position: relative;
    padding-bottom: 60px;
    /* Espace pour la barre de nav */
    overflow: hidden;
    /* Assurer que le conteneur prend toute la hauteur pour que les pages puissent être en 100% */
    display: block;
}

.page {
    display: none;
    height: 100%;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === NAVIGATION DU BAS (WATCH) === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50px;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.2s;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-item.active {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.nav-item:active {
    transform: scale(0.9);
}

/* === MODIFICATIONS PAGE FICHIERS === */
.files-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    overflow: hidden;
    border-top: none;
    margin-top: 0;
}

.files-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 180px);
    /* Ajustement pour l'espace */
}

.upload-container {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    padding: 0 10px;
}

.big-upload-btn {
    background: linear-gradient(145deg, #1e3a5f, #16213e);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    width: 100%;
    padding: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.big-upload-btn span {
    font-size: 24px;
}

.big-upload-btn p {
    font-size: 12px;
    margin: 0;
    opacity: 0.8;
}

.big-upload-btn:active {
    background: #1e3a5f;
    transform: scale(0.98);
}

/* Styles items fichiers */
.file-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.file-item:active {
    background: #1e3a5f;
}

.file-item.processed {
    opacity: 0.6;
}

.file-info {
    flex: 1;
    overflow: hidden;
    margin-left: 8px;
}

.file-name {
    display: block;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-light);
}

.file-date {
    display: block;
    font-size: 10px;
    opacity: 0.6;
    margin-top: 2px;
}

.transcribe-btn {
    background: var(--success-color);
    border: none;
    border-radius: 12px;
    padding: 6px 12px;
    color: white;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

.transcribe-btn:active {
    transform: scale(0.95);
}

.transcribe-btn:disabled {
    background: #444;
    cursor: not-allowed;
    opacity: 0.7;
}

.status-check {
    color: var(--success-color);
    font-size: 16px;
}

/* === NAVIGATION & HEADERS === */
.nav-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 5px;
}

.nav-btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 14px;
    border-radius: 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-btn-back:hover,
.nav-btn-back:active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
    transform: translateX(2px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0 10px 0;
    padding: 0 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

.section-header h2 {
    font-size: 14px;
    margin: 0;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.upload-btn {
    background: var(--primary-color);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    /* Circle */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s;
}

.upload-btn:active {
    transform: scale(0.9);
}

.upload-btn span {
    font-size: 16px;
}