/* ==========================================================================
   READON - CORE DESIGN SYSTEM & VARIABLES
   ========================================================================== */
   :root {
    /* Color Palette */
    --bg-deep: #0d0b08;
    --bg-mid: #13110d;
    --bg-surface: #1e1a13;
    --bg-elevated: #252018;
    
    --gold-primary: #c9a84c;
    --gold-light: #e8c96b;
    --gold-dim: #7a6530;
    
    --cream-primary: #f0e6c8;
    --cream-secondary: #a89870;
    --cream-dim: #6b5f45;
    
    --border: #2e2820;
    --border-gold: #4a3c20;
    
    --success: #27ae60;
    --alert: #c0392b;
    --info: #2980b9;
    --purple: #6c3483;
    
    --reading-sepia: #f4e4c1;
    --reading-light: #fafafa;

    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Crimson Pro', serif;
    --font-ui: 'DM Mono', monospace;

    /* Transitions & Motion */
    --transition-screen: 300ms ease;
    --transition-btn: 150ms ease;
    --transition-modal: 250ms ease;

    /* Spacing & Layout */
    --nav-height: 70px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-deep);
    color: var(--cream-primary);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.6;
    overflow: hidden; /* Prevent pull-to-refresh and body scroll */
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport for mobile browsers */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--cream-primary);
    line-height: 1.2;
}

button {
    background: none;
    border: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    min-height: 44px; /* Apple minimum touch target */
    min-width: 44px;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn var(--transition-screen) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   COMPONENTS
   ========================================================================== */
.btn-primary {
    background-color: var(--gold-primary);
    color: var(--bg-deep);
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 16px;
    padding: 14px 24px;
    border-radius: 8px;
    width: 100%;
    transition: background-color var(--transition-btn);
}

.btn-primary:active {
    background-color: var(--gold-dim);
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* ==========================================================================
   SPLASH SCREEN & ONBOARDING
   ========================================================================== */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 500ms ease;
}

.splash-content {
    text-align: center;
}

.brand-title {
    font-size: 48px;
    color: var(--gold-primary);
    margin-bottom: 8px;
    font-weight: 900;
}

.brand-tagline {
    font-family: var(--font-heading);
    font-style: italic;
    color: var(--cream-secondary);
    font-size: 20px;
}

#onboarding {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-deep);
    z-index: 9000;
    display: flex;
    flex-direction: column;
}

.onboarding-slide {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    animation: fadeIn var(--transition-screen);
}

.slide-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.onboarding-slide h2 {
    font-size: 32px;
    color: var(--gold-primary);
    margin-bottom: 16px;
}

.onboarding-slide p {
    color: var(--cream-secondary);
    font-size: 20px;
}

.onboarding-controls {
    padding: 32px;
    padding-bottom: calc(32px + var(--safe-bottom));
}

.slide-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border);
    transition: background-color var(--transition-btn);
}

.dot.active {
    background-color: var(--gold-primary);
}

/* ==========================================================================
   APP LAYOUT (VIEWS)
   ========================================================================== */
#app-container {
    height: calc(100% - var(--nav-height) - var(--safe-bottom));
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.view-section {
    padding-top: var(--safe-top);
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

.view-section.active {
    animation: fadeIn var(--transition-screen);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--bg-mid);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar h2 {
    font-size: 24px;
}

.content-area {
    padding: 20px;
    flex: 1;
}

/* Placeholder Styling for Module 1 */
.placeholder-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin-top: 20px;
}

.placeholder-card h3 {
    color: var(--gold-light);
    margin-bottom: 12px;
    font-size: 22px;
}

.placeholder-card p {
    color: var(--cream-secondary);
    font-size: 16px;
}

/* ==========================================================================
   BOTTOM NAVIGATION
   ========================================================================== */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: calc(var(--nav-height) + var(--safe-bottom));
    background-color: var(--bg-mid);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding-bottom: var(--safe-bottom);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--cream-dim);
    transition: color var(--transition-btn);
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
    filter: grayscale(100%) opacity(0.5);
    transition: filter var(--transition-btn);
}

.nav-label {
    font-family: var(--font-ui);
    font-size: 11px;
}

.nav-item.active {
    color: var(--gold-primary);
}

.nav-item.active .nav-icon {
    filter: grayscale(0%) opacity(1);
}

/* ==========================================================================
   OFFLINE BANNER
   ========================================================================== */
#offline-banner {
    position: fixed;
    top: var(--safe-top);
    left: 0;
    width: 100%;
    background-color: var(--alert);
    color: white;
    text-align: center;
    padding: 8px;
    font-family: var(--font-ui);
    font-size: 12px;
    z-index: 10000;
}