@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --apple-ease: cubic-bezier(0.16, 1, 0.3, 1);
    --bg-glass: rgba(255, 255, 255, 0.88);
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, sans-serif;
    background: #f2f2f7;
    min-height: 100dvh;
    margin: 0;
    color: #1c1c1e;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Bloquer le scroll global sur PC pour effet Dashboard */
@media (min-width: 768px) {
    body {
        overflow: hidden;
        background: #eef2f6; /* Fond légèrement différent sur PC */
    }
}

/* --- LOCK SCREEN (CODE) --- */
#lock-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #f2f2f7;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 1.5s var(--apple-ease), opacity 1s ease;
}

.passcode-dot {
    width: 14px;
    height: 14px;
    border: 1.5px solid #1c1c1e;
    border-radius: 50%;
    transition: background 0.4s ease;
}

.passcode-dot.filled {
    background: #1c1c1e;
}

.keypad-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: background 0.3s, transform 0.15s;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

.keypad-btn:active {
    background: #d1d1d6;
    transform: scale(0.92);
}

/* --- STRUCTURE APP --- */
#app-wrapper {
    display: none;
    min-height: 100dvh;
    opacity: 0;
    transform: scale(1.08);
    transition: all 1.2s var(--apple-ease);
    flex-direction: column;
    width: 100%;
}

#app-wrapper.visible {
    display: flex;
    opacity: 1;
    transform: scale(1);
}

.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    min-height: min-content;
}

/* --- DESKTOP ADAPTATION FOR MAIN CONTAINER (DASHBOARD MODE) --- */
@media (min-width: 768px) {
    .main-container {
        max-width: 1600px; /* Plus large pour respirer */
        flex-direction: row; /* Horizontal */
        height: 100vh; /* Force la hauteur écran */
        padding: 32px; /* Marges confortables */
        padding-bottom: 32px;
        gap: 32px; /* Espace entre sidebar et grille */
        align-items: stretch; /* Force l'égalité de hauteur */
    }
}

.apple-card {
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
    transition: transform 0.4s var(--apple-ease), box-shadow 0.4s ease, border-color 0.3s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.apple-card:active {
    transform: scale(0.97);
}

.apple-card:focus-visible {
    outline: none;
    ring: 4px;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.4);
    transform: scale(0.98);
}

/* Desktop Hover Effects */
@media (min-width: 768px) {
    .apple-card:hover {
        border-color: rgba(255, 255, 255, 0.9);
        box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.08);
        transform: translateY(-4px); /* Légère levée */
    }
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, minmax(110px, 1fr));
    gap: 10px;
    flex: 1;
}

@media (max-height: 600px) {
    .bento-grid {
        grid-template-rows: repeat(3, 110px);
    }
    .main-container {
        padding-bottom: 100px;
    }
}

/* --- HEADER --- */
.header-profile-img {
    width: 95px;
    height: 100%;
    object-fit: cover;
    border-right: 1px solid rgba(0, 0, 0, 0.05);
}

.header-sector-block {
    width: 85px;
    height: 100%;
    background: #fdf2d0;
    border-left: 1px dashed rgba(217, 119, 6, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 6px;
    text-align: center;
    flex-shrink: 0;
}

/* --- DESKTOP HEADER RE-STYLING --- */
@media (min-width: 768px) {
    .header-profile-img {
        width: 160px;
        height: 160px;
        border-right: none;
        border-radius: 9999px; /* Cercle parfait */
        margin-bottom: 24px;
        border: 4px solid rgba(255,255,255,0.8);
        box-shadow: 0 12px 24px rgba(0,0,0,0.06);
    }
    .header-sector-block {
        width: 100%;
        height: auto;
        border-left: none;
        border: 1px dashed rgba(217, 119, 6, 0.3);
        background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
        flex-direction: row;
        justify-content: space-between;
        padding: 16px 24px;
        border-radius: 20px;
        margin-top: auto; /* Pousse en bas du conteneur */
    }
    .tap-indicator {
        display: none;
    }
}

/* --- ANIMATION --- */
@keyframes finger-tap {
    0%, 100% { transform: scale(1) translateY(0); opacity: 0.4; }
    50% { transform: scale(1.2) translateY(-2px); opacity: 1; }
}

.tap-indicator {
    animation: finger-tap 2s infinite ease-in-out;
    position: absolute;
    top: 12px;
    right: 95px;
    pointer-events: none;
    z-index: 30;
}

#typewriter-text::after {
    content: "|";
    animation: blink 1s infinite;
    margin-left: 2px;
    color: #10b981;
}

@keyframes blink { 50% { opacity: 0; } }

/* --- NAVIGATION --- */
.bottom-nav {
    padding: 12px 12px 34px 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    bottom: 0;
    z-index: 100;
    margin-top: auto;
}

/* --- DESKTOP DOCK --- */
@media (min-width: 768px) {
    .bottom-nav {
        position: fixed;
        bottom: 32px;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        min-width: 320px;
        border-radius: 24px;
        padding: 10px;
        border: 1px solid rgba(255,255,255,0.4);
        box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
        background: rgba(255, 255, 255, 0.65); /* Plus translucide */
    }
}

.nav-pills {
    background: #d1d1d6;
    padding: 4px;
    border-radius: 100px;
    display: flex;
    max-width: 400px;
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.nav-pill {
    flex: 1;
    padding: 12px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 800;
    transition: all 0.4s var(--apple-ease);
}

.nav-pill.active {
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    color: #059669;
}

.nav-pill:not(.active) {
    color: #48484a;
}

@keyframes hint-pulse {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2px); color: #059669; }
}

.explore-hint {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    animation: hint-pulse 3s infinite ease-in-out;
}

/* --- MODAL MOBILE --- */
#details-modal {
    position: fixed;
    inset: 0;
    background: white;
    z-index: 11000;
    transform: translateY(100%);
    transition: transform 0.8s cubic-bezier(0.2, 1, 0.2, 1);
    display: none;
    flex-direction: column;
}

#details-modal.active {
    transform: translateY(0);
    display: flex;
}

/* --- DESKTOP MODAL (WINDOW STYLE) --- */
@media (min-width: 768px) {
    #details-modal {
        background: rgba(0, 0, 0, 0.3); /* Dimmed backdrop */
        backdrop-filter: blur(12px); /* Flou puissant style OS */
        align-items: center;
        justify-content: center;
        transform: scale(1); /* Pas de slide up, juste fade */
        opacity: 0;
        transition: opacity 0.4s ease; /* Fade in simple */
        padding: 0;
    }
    #details-modal.active {
        opacity: 1;
    }
    /* Animation spécifique pour la fenêtre interne */
    #details-modal.active > div {
        animation: modalPop 0.5s var(--apple-ease) forwards;
    }
}

@keyframes modalPop {
    0% { transform: scale(0.9) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.progress-container {
    position: sticky;
    top: 0;
    width: 100%;
    height: 5px;
    background: #f2f2f7;
    z-index: 50;
}

.progress-bar {
    height: 100%;
    background: #10b981;
    width: 0%;
    transition: width 0.15s linear;
}

.modal-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 24px 120px 24px;
}

.modal-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 20px;
}

.goal-box {
    background: #1c1c1e;
    color: white;
    border-radius: 24px;
    padding: 24px;
    margin-top: 15px;
}

.ios-form-section {
    background: #f2f2f7;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 24px;
}

.ios-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #e5e5ea;
}

.ios-row:last-child {
    border-bottom: none;
}

.ios-label {
    width: 90px;
    font-size: 14px;
    font-weight: 500;
    color: #1c1c1e;
}

.ios-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    color: #1c1c1e;
    padding: 4px 0;
}

.ios-textarea {
    width: 100%;
    background: white;
    border: none;
    outline: none;
    font-size: 16px;
    color: #1c1c1e;
    padding: 16px;
    min-height: 120px;
    display: block;
}

.glass-emerald {
    background: rgba(5, 150, 105, 0.9);
    color: white;
    border: none;
}

.glass-blue {
    background: rgba(14, 165, 233, 0.9);
    color: white;
    border: none;
}

.glass-dark {
    background: rgba(28, 28, 30, 0.98);
    color: white;
    border: none;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

.animate-shake {
    animation: shake 0.6s var(--apple-ease);
}

[data-view] {
    display: none;
}

[data-view].active {
    display: grid;
}

#map-container {
    width: 100%;
    height: 380px;
    border-radius: 28px;
    margin-top: 15px;
    border: 1px solid #e2e8f0;
}

/* Amélioration contraste 2026 */
.text-slate-400 { color: #64748b !important; } /* Équivalent slate-500 pour lisibilité WCAG */

/* Protection contre les troubles du mouvement */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    #typewriter-text::after { display: none; }
}

/* Style du lien d'évitement */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }