:root {
    --primary-color: #1e3a8a; /* Deep blue for law */
    --primary-light: #3b82f6;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --accent-red: #ef4444;
    --font-ui: 'Doppio One', 'Tiro Bangla', sans-serif;
    --font-reading: 'Doppio One', 'Tiro Bangla', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-ui);
    color: var(--text-primary);
    background-color: var(--bg-main);
    overflow: hidden; /* App container handles scrolling */
    -webkit-font-smoothing: antialiased;
}

.app-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.view {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
    transition: opacity 0.3s ease-in-out;
    z-index: 1;
}

.view.hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* === LANDING VIEW === */
#landing-view {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1e3a8a, #3b82f6);
    color: white;
    text-align: center;
    padding: 20px;
    z-index: 50; /* Top most initially */
}

.landing-content {
    max-width: 600px;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.logo-circle {
    width: 120px; height: 120px;
    background: white; color: var(--primary-color);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 4rem; margin: 0 auto 25px auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

#landing-view h1 { font-size: 3rem; margin-bottom: 15px; font-family: var(--font-ui); }

.badge-coming-soon {
    display: inline-block; background: #fbbf24; color: #92400e;
    padding: 8px 20px; border-radius: 30px; font-weight: bold; font-size: 1rem;
    margin-bottom: 25px;
    font-family: sans-serif;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.subtitle { font-size: 1.3rem; margin-bottom: 45px; opacity: 0.95; line-height: 1.5; }

.btn-primary {
    background: white; color: var(--primary-color);
    border: none; padding: 18px 35px; border-radius: 35px;
    font-size: 1.3rem; font-weight: bold; font-family: var(--font-ui);
    cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 auto; width: 100%;
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.25); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.15); color: white;
    border: 2px solid rgba(255, 255, 255, 0.5); padding: 15px 30px; border-radius: 35px;
    font-size: 1.2rem; font-weight: bold; font-family: var(--font-ui);
    cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 auto; width: 100%;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-2px); border-color: white; }

/* === HEADER === */
.app-header {
    background: white; padding: 15px 25px;
    display: flex; flex-wrap: wrap; gap: 15px; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    z-index: 10;
    flex-shrink: 0;
}

.header-left-actions { flex-shrink: 0; }
.header-actions { flex-shrink: 0; display: flex; align-items: center; }

.app-header h2 { font-size: 1.5rem; color: var(--primary-color); margin: 0; }
.app-header h2 i { margin-right: 8px; }

.icon-btn {
    background: transparent; border: none; font-size: 1.5rem;
    color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
    padding: 10px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: #f1f5f9; color: var(--primary-color); }
.icon-btn.active { color: var(--accent-red); }
.icon-btn i.fas { color: var(--accent-red); } /* Filled heart */

/* === HEADER CONTROLS (Search & Filters) === */
.header-controls {
    flex: 1;
    display: flex;
    gap: 15px;
    min-width: 300px;
}

.search-box { position: relative; flex: 2; }
.search-box i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.search-box input, .filter-box select {
    width: 100%; padding: 12px 14px 12px 45px;
    border: 1px solid var(--border-color); border-radius: 10px;
    font-family: var(--font-ui); font-size: 1.05rem; outline: none; background: #f8fafc;
    transition: all 0.2s;
}
.filter-box { flex: 1.5; }
.filter-box select { padding-left: 15px; cursor: pointer; }
.search-box input:focus, .filter-box select:focus { border-color: var(--primary-light); background: white; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

@media (max-width: 900px) {
    .header-controls {
        order: 3; /* Push to bottom row */
        flex: 1 1 100%;
        min-width: 100%;
    }
}
@media (max-width: 650px) {
    .header-controls { flex-direction: column; }
}

/* === LIST VIEW === */
.acts-container {
    flex: 1; overflow-y: auto; padding: 25px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    align-content: start;
}

.act-card {
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 16px; padding: 25px; cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex; flex-direction: column; position: relative;
}
.act-card:hover { transform: translateY(-4px); box-shadow: 0 12px 20px rgba(0,0,0,0.08); border-color: #cbd5e1; }

.act-card-title { font-size: 1.25rem; font-weight: bold; margin-bottom: 15px; line-height: 1.4; color: var(--primary-color); padding-right: 35px; }
.act-card-meta { display: flex; gap: 15px; font-size: 0.95rem; color: var(--text-secondary); margin-top: auto; }
.act-card-meta span { display: flex; align-items: center; gap: 5px; }

.btn-fav-card {
    position: absolute; top: 15px; right: 15px;
    background: transparent; border: none; font-size: 1.4rem;
    color: #cbd5e1; cursor: pointer; padding: 10px; transition: 0.2s;
}
.btn-fav-card:hover { transform: scale(1.15); }
.btn-fav-card i.fas { color: var(--accent-red); } /* Active state */

/* === READER VIEW === */
.reader-app-header { justify-content: space-between; }
.reader-nav-title { font-size: 1.2rem; color: var(--text-secondary); font-weight: normal; margin: 0; }
.btn-back { font-size: 1.1rem; border-radius: 8px; padding: 8px 15px; gap: 8px; }

.reader-layout {
    display: flex;
    flex: 1;
    overflow: hidden; /* Header takes fixed space, layout takes the rest */
    position: relative;
    height: calc(100vh - 65px); /* approximate height remaining */
}

.reader-sidebar {
    width: 320px;
    background: #f8fafc;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.reader-sidebar-header {
    padding: 15px 20px;
    background: #f1f5f9;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 5;
}

.reader-sidebar-header h4 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.1rem;
}

.section-list {
    list-style: none;
}

.section-list li {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s, color 0.2s;
    line-height: 1.4;
}

.section-list li:hover {
    background: #e2e8f0;
}

.section-list li.active {
    background: var(--primary-color);
    color: white;
    border-left: 4px solid var(--primary-light);
}

.reader-main {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-card);
    padding: 40px 40px 80px 40px;
    scroll-behavior: smooth;
    position: relative;
}

#reader-body-container { 
    max-width: 850px; 
    margin: 0 auto; 
    position: relative;
    z-index: 1;
}

/* Watermark */
#reader-body-container::before {
    content: 'Delta Law School';
    position: fixed;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 8vw;
    color: rgba(30, 58, 138, 0.035);
    font-family: var(--font-ui);
    font-weight: bold;
    white-space: nowrap;
    pointer-events: none;
    z-index: -1;
    user-select: none;
}

.mobile-only { display: none !important; }

@media (max-width: 850px) {
    .mobile-only { display: flex !important; }
    
    #reader-body-container::before {
        left: 50%;
        font-size: 12vw;
    }
    
    .reader-sidebar {
        position: absolute;
        left: -100%;
        top: 0;
        height: 100%;
        z-index: 20;
        transition: left 0.3s ease-in-out;
        box-shadow: 2px 0 15px rgba(0,0,0,0.15);
        width: 85%;
        max-width: 350px;
    }
    
    .reader-sidebar.open {
        left: 0;
    }
    
    .reader-main {
        padding: 20px 20px 80px 20px;
    }
}

.reader-header { margin-bottom: 40px; padding-bottom: 25px; border-bottom: 2px solid #f1f5f9; }
.reader-header h1 { font-size: 2.2rem; color: var(--primary-color); margin-bottom: 20px; line-height: 1.4; }

.meta-tags { display: flex; flex-wrap: wrap; gap: 12px; }
.badge { background: #f1f5f9; padding: 8px 15px; border-radius: 20px; font-size: 0.9rem; color: var(--text-secondary); font-weight: bold; }

.reader-body { font-size: 1.2rem; line-height: 1.9; color: #1e293b; }
.section { margin-bottom: 40px; }
.section-title { font-weight: bold; font-size: 1.3rem; margin-bottom: 15px; color: var(--primary-color); }
.section-content { text-align: justify; }

.footnotes-section {
    margin-top: 60px; padding: 30px; background: #f8fafc; border-radius: 12px;
    border: 1px solid var(--border-color); font-size: 1rem; color: var(--text-secondary);
}
.footnotes-section h3 { margin-bottom: 20px; color: #475569; font-size: 1.3rem; }
.footnotes-section ul { padding-left: 25px; }
.footnotes-section li { margin-bottom: 12px; line-height: 1.6; }

.loading-center { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 50vh; color: var(--primary-color); gap: 20px; font-size: 1.2rem; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
