/**
 * True Heart - Layout & Structure
 * App shell, navigation, headers, and fixed positioning
 * Optimized for Default Dark Mode & Turquoise Bioluminescence
 * Brand: Marissa TrueHeart (Mely)
 */

/* ============================================
   STATUS BAR COVER (Android 15+ / iOS edge-to-edge)
   A fixed teal strip that permanently sits over the status bar zone.
   Cannot be scrolled away. z-index above everything.
   ============================================ */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--th-safe-top);
    background: #3ECFCF;
    z-index: 99999;
    pointer-events: none;
}

/* ============================================
   AUTH PAGES LAYOUT
   ============================================ */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: transparent;
    position: relative;
    z-index: 1;
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

/* ============================================
   APP WRAPPER
   ============================================ */

.app-wrapper {
    min-height: 100vh;
    background: transparent;
    position: relative;
    z-index: 1;
}

/* ─── Email verification soft notice ──────────────────────────────────────── */
.verify-notice {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(var(--accent-rgb, 99, 102, 241), 0.12);
    border-bottom: 1px solid rgba(var(--accent-rgb, 99, 102, 241), 0.25);
    font-size: 0.82rem;
    color: var(--text-secondary, #9ca3af);
    position: relative;
    z-index: 10;
}
.verify-notice-text {
    flex: 1;
    line-height: 1.4;
}
.verify-notice-dismiss {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.9rem;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
    opacity: 0.7;
}
.verify-notice-dismiss:hover { opacity: 1; }

.app-content {
    padding: 20px;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 80px; /* Space for bottom nav */
}

/* ============================================
   APP HEADER (Fixed)
   ============================================ */

.app-header {
    background: var(--th-bg-primary);
    border-bottom: 1px solid var(--th-border);
    padding: 16px 20px;
    position: sticky;
    top: var(--th-safe-top); /* Stick below status bar, not behind it */
    z-index: var(--th-z-nav);
    backdrop-filter: blur(var(--th-blur)); /* Added frosting for dark mode */
}

.app-header h1 {
    font-size: 20px;
    font-weight: 500;
    color: var(--th-text-primary);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 800px;
    margin: 0 auto;
}

/* ============================================
   BOTTOM NAVIGATION (Fixed)
   ============================================ */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--th-bg-primary);
    border-top: 1px solid var(--th-border);
    padding: 12px 20px;
    padding-bottom: calc(12px + var(--th-safe-bottom)); /* Clear gesture bar */
    display: flex;
    justify-content: space-around;
    box-shadow: 0 -2px 15px rgba(0, 0, 0, 0.3); /* Darker shadow for depth */
    z-index: var(--th-z-nav);
    backdrop-filter: blur(var(--th-blur));
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--th-text-light);
    text-decoration: none;
    font-size: 11px;
    transition: color var(--th-transition-fast);
}

.nav-item.active {
    color: var(--th-primary);
}

.nav-icon {
    width: 24px;
    height: 24px;
}

/* ============================================
   GLOBAL BRAND ELEMENTS
   These elements use the Glimmer & Bloom logic
   ============================================ */

.welcome-section {
    /* Upgraded for bioluminescence */
    background: var(--th-bg-primary); 
    color: var(--th-text-primary);
    padding: 32px 24px;
    border-radius: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); 
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(62, 207, 207, 0.2) !important;
    text-align: center;
}

/* ============================================
   BUTTON SYSTEM CLEAN-UP
   ============================================ */

/* Reset the base class so it doesn't fight the primary styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    outline: none;
}

/* ============================================
   PRIMARY BRAND BUTTONS (Marissa TrueHeart Build)
   ============================================ */
.btn-primary {
    /* Slightly deeper base so the white glimmer sweep actually pops */
    background: #1a8a8a !important; 
    color: #0d1117 !important;
    padding: 16px 32px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
    position: relative;
    overflow: hidden; /* Clips the glimmer.css shimmer to the button */
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(62, 207, 207, 0.3) !important;
}

/* Ensure the glimmer.css pulse and sweep are active */
.btn-primary {
    animation: thPulse 13s ease-in-out infinite;
}

.btn-primary::after {
    /* This connects to the sweep in glimmer.css */
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 35%,
        rgba(255, 255, 255, 0.15) 48%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.15) 52%,
        transparent 65%
    );
    background-size: 200% 100%;
    animation: thSweep 12s linear infinite;
    pointer-events: none;
    z-index: 2;
    opacity: 0.6;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: var(--th-primary) !important; /* Glows brighter on hover */
    box-shadow: 0 8px 25px rgba(62, 207, 207, 0.4);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Keep text/content above the shimmer */
.btn-primary span, 
.btn-primary i {
    position: relative;
    z-index: 3;
}

.welcome-section h2 {
    font-family: var(--th-font-serif);
    font-size: 28px;
    font-weight: 300;
    margin-bottom: 8px;
    color: var(--th-text-primary);
}
.welcome-section h2 em {
    font-style: italic;
    color: var(--th-primary);
}

.welcome-section p {
    font-size: 14px;
    opacity: 0.9;
    color: var(--th-text-secondary);
}

.stats {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.stat-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.05); 
    backdrop-filter: blur(var(--th-blur));
    padding: 16px;
    border-radius: var(--th-radius-md);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-card.stat-streak {
    background: rgba(62, 207, 207, 0.1);
    border-color: rgba(62, 207, 207, 0.2);
}

.stat-number {
    font-size: 28px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    color: var(--th-primary);
}

.stat-label {
    font-size: 12px;
    opacity: 0.8;
}

/* ============================================
   CONTENT SECTIONS
   ============================================ */

.profile-content,
.journal-content,
.progress-content,
.write-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 100px;
}

.profile-section,
.progress-section,
.admin-section {
    background: var(--th-bg-primary);
    border-radius: var(--th-radius-xl);
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid var(--th-border);
}

/* ============================================
   MODALS & OVERLAYS
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85); /* Deepened for dark mode */
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--th-z-modal);
    padding: 20px;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background: var(--th-bg-primary);
    border-radius: var(--th-radius-xl);
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    border: 1px solid var(--th-border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--th-border);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* ============================================
   SUCCESS OVERLAY
   ============================================ */

.success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--th-z-modal);
    animation: fadeIn 0.3s ease;
}

.success-overlay.visible {
    display: flex;
}

.success-content {
    background: var(--th-bg-primary);
    padding: 48px 32px;
    border-radius: 24px;
    text-align: center;
    max-width: 400px;
    margin: 20px;
    border: 1px solid var(--th-border);
    animation: slideUp 0.3s ease;
}

/* ============================================
   PROGRESS HERO / WELCOME CARD
   ============================================ */

.welcome-card {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #5DDFDF 0%, #3ECFCF 100%);
    border-radius: var(--th-radius-xl);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.welcome-card h2,
.welcome-card h3,
.welcome-card p,
.welcome-card .streak-label {
    color: #ffffff !important;
}
.welcome-card h2 {
    font-family: var(--th-font-serif);
    font-weight: 300;
    font-size: 28px;
}
.welcome-card h2 em {
    font-style: italic;
    color: var(--th-bg-secondary) !important;
}

/* Light mode: flip text to black */
body.light-mode .welcome-card h2,
body.light-mode .welcome-card h3,
body.light-mode .welcome-card p,
body.light-mode .welcome-card .streak-label,
body.light-mode .streak-label {
    color: #000000 !important;
}

.streak-display {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 24px;
}

.streak-item {
    text-align: center;
}

.streak-number {
    font-size: 48px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    color: rgb(45, 156, 145) !important;
}

.streak-label {
    font-size: 12px;
    opacity: 0.9;
    color: #ffffff !important;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 480px) {
    .auth-wrapper {
        padding: 12px;
    }
    
    .welcome-section h2 {
        font-size: 20px;
    }
    
    .stat-number {
        font-size: 24px;
    }
}
/* Styling Emojis in Cards */
.action-icon {
    font-size: 42px !important; /* Making them much larger */
    margin-bottom: 12px;
    display: block;
    filter: drop-shadow(0 0 8px rgba(62, 207, 207, 0.2));
}
.app-header {
    background: var(--th-bg-primary);
    border-bottom: 1px solid var(--th-border);
    padding: 12px 20px;
    position: sticky;
    top: var(--th-safe-top);
    z-index: 1000;
}
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}
.header-logo {
    font-family: var(--th-font-serif);
    font-weight: 400;
    font-size: 22px;
    color: var(--th-text-primary);
    letter-spacing: 0.12em;
}
.header-logo em {
    font-style: italic;
    color: var(--th-primary);
}
.theme-toggle-btn {
    background: none;
    border: 1px solid var(--th-border);
    border-radius: 50%;
    cursor: pointer;
    padding: 5px;
}
.sun-icon { display: none; }
body.light-mode .sun-icon { display: inline; }
body.light-mode .moon-icon { display: none; }

/* Status bar cover is handled by body::before in layout.css — no extra header padding needed */