@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Lora:ital,wght@0,400;0,700;1,400&display=swap');

/* ============================================
   ILLUMINATE LIBRARY - COMPLETE STYLES
   Modern Digital Reading Experience
   ============================================ */

:root {
    /* Color Palette */
    --primary: #0f172a;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --bg-light: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 40px -10px rgba(0,0,0,0.15);
    
    /* Spacing & Effects */
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Variables */
body.dark-theme {
    --primary: #f8fafc;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --bg-light: #0f172a;
    --white: #1e293b;
    --border: #334155;
}

/* === GLOBAL STYLES === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-light);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.3s ease, color 0.3s ease;
}

.hidden {
    display: none !important;
}

/* === NAVIGATION === */
.main-nav {
    background: var(--primary);
    color: white;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

.search-wrap {
    flex: 1;
    max-width: 500px;
    margin: 0 2rem;
}

#library-search {
    padding: 12px 20px;
    border-radius: 99px;
    border: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    background: rgba(255,255,255,0.08);
    color: white;
    font-size: 0.95rem;
    transition: var(--transition);
}

#library-search::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#library-search:focus {
    outline: none;
    background: white;
    color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.dev-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* === LAYOUT === */
.layout-body {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
}

/* === SIDEBAR === */
.sidebar {
    width: 280px;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 2.5rem 1.5rem;
    height: calc(100vh - 64px);
    position: sticky;
    top: 64px;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.story-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-light);
    padding: 4px 10px;
    border-radius: 99px;
}

.cat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    margin-bottom: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.cat-btn:hover {
    background: var(--bg-light);
    color: var(--accent);
    transform: translateX(4px);
}

.cat-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
}

/* === READING STATS === */
.reading-stats {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.reading-stats h4 {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
}

/* === CONTENT VIEW === */
.content-view {
    flex-grow: 1;
    padding: 3rem 5%;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.view-header h2 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.view-controls {
    display: flex;
    gap: 8px;
    background: var(--white);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.view-toggle {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
}

.view-toggle:hover {
    background: var(--bg-light);
    color: var(--accent);
}

.view-toggle[data-active="true"] {
    background: var(--accent);
    color: white;
}

/* === STORY GRID === */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.5rem;
}

.grid.list-view {
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

/* === STORY CARDS === */
.story-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.story-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-soft);
    box-shadow: var(--shadow-md);
}

.tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    margin-bottom: 1rem;
    display: inline-block;
    padding: 4px 12px;
    background: var(--accent-soft);
    border-radius: 99px;
}

.story-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--primary);
    font-weight: 700;
}

.story-card p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    flex-grow: 1;
    line-height: 1.7;
}

.story-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.story-author {
    font-weight: 600;
}

.reading-time {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 1rem;
}

/* === READING ROOM === */
#reading-room {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--white);
    z-index: 1000;
    overflow-y: auto;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.reader-controls {
    padding: 1.25rem 5%;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(12px);
    z-index: 10;
}

.reader-options {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.exit-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.exit-btn:hover {
    background: var(--accent);
    transform: scale(1.05);
}

/* === FONT CONTROLS === */
.font-controls {
    display: flex;
    background: var(--bg-light);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
    gap: 2px;
}

.font-controls button {
    background: var(--white);
    color: var(--primary);
    border: none;
    padding: 8px 16px;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border-radius: 6px;
}

.font-controls button:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.font-controls button:active {
    background: var(--accent);
    color: white;
    transform: scale(0.95);
}

/* === THEME TOGGLE === */
.theme-toggle {
    background: var(--bg-light);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.theme-icon {
    font-size: 1.2rem;
    display: block;
}

/* === READING PROGRESS === */
.reading-progress {
    background: var(--bg-light);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    color: var(--accent);
    font-size: 0.9rem;
}

/* === READER CONTENT === */
.reader-content {
    max-width: 800px;
    margin: 6rem auto;
    padding: 0 2rem;
}

#reader-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--primary);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.story-info {
    display: flex;
    gap: 20px;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.95rem;
    color: var(--text-muted);
}

.author {
    font-weight: 600;
}

.reader-body {
    font-family: 'Lora', serif;
    font-size: 1.35rem;
    line-height: 1.8;
    color: #334155;
}

.reader-body p {
    margin-bottom: 1.5em;
}

.reader-body h2 {
    font-size: 2rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.reader-body h3 {
    font-size: 1.6rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: var(--primary);
}

/* === READING ACTIONS === */
.reading-actions {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border);
    display: flex;
    gap: 1rem;
}

.action-btn {
    flex: 1;
    padding: 14px 24px;
    border: 2px solid var(--border);
    background: var(--white);
    color: var(--text-main);
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
    transform: translateY(-2px);
}

/* === SCROLL PROGRESS BAR === */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--bg-light);
    z-index: 1001;
}

.scroll-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.1s ease;
    width: 0%;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1024px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .layout-body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1.5rem;
    }

    .reading-stats {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }

    .content-view {
        padding: 2rem 1rem;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .reader-controls {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }

    .reader-content {
        margin: 3rem auto;
        padding: 0 1.5rem;
    }

    #reader-title {
        font-size: 2.5rem;
    }

    .reader-body {
        font-size: 1.2rem;
    }

    .search-wrap {
        margin: 0 1rem;
    }

    .reading-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .main-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .search-wrap {
        width: 100%;
        margin: 0;
    }

    .dev-badge {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    #reader-title {
        font-size: 2rem;
    }

    .reader-body {
        font-size: 1.1rem;
    }
}
/* Toast Notification System */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: var(--white);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: toastIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transition: var(--transition);
}

.toast.success { border-left-color: var(--success); }
.toast.info { border-left-color: var(--accent); }

.toast-icon { font-size: 1.25rem; }

.toast-content {
    flex-grow: 1;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Animations */
@keyframes toastIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.fade-out {
    opacity: 0;
    transform: translateY(20px);
}