/* Modern Responsive CSS for Bar Exam Syllabus & Digest Utility */

:root {
    --bg-main: #0f1117;
    --bg-card: #181b25;
    --bg-input: #212533;
    --border-color: rgba(255, 255, 255, 0.1);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-secondary: #00b4d8;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-stack);
    line-height: 1.6;
    font-size: 15px;
}

a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #38bdf8;
    text-decoration: underline;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.app-header {
    background: linear-gradient(180deg, #161924 0%, var(--bg-main) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 32px 0;
    margin-bottom: 32px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 28px;
}

.brand h1 {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 6px;
}

.author {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 6px;
}

/* Subject Grid */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.subject-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.2s, border-color 0.2s;
}

.subject-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-secondary);
}

.subject-number {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-secondary);
}

.subject-title {
    font-size: 18px;
    font-weight: 700;
}

.subject-meta {
    display: flex;
    gap: 8px;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    margin-top: auto;
}

.btn-primary {
    background: var(--accent-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: #2563eb;
    text-decoration: none;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-info { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-active { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-case { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-section { background: rgba(0, 180, 216, 0.15); color: var(--accent-secondary); border: 1px solid rgba(0, 180, 216, 0.3); }
.badge-digest { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }

/* Layout Wrapper for Subject Pages */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 320px;
    background: #12141d;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 24px 16px;
    flex-shrink: 0;
}

.sidebar-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.back-link {
    font-size: 12px;
    color: var(--text-muted);
}

.sidebar-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin-top: 8px;
}

.sidebar-nav ul {
    list-style: none;
    padding-left: 12px;
}

.sidebar-nav li {
    margin: 4px 0;
}

.nav-link {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    text-decoration: none;
}

.nav-digest-dot {
    color: var(--accent-secondary);
    font-weight: bold;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px;
    max-width: 900px;
}

.page-header {
    margin-bottom: 32px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.subject-main-heading {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.3;
}

.page-meta {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* Syllabus Nodes */
.syllabus-node {
    margin-bottom: 32px;
    padding-left: 12px;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
}

.node-heading {
    color: #ffffff;
    margin-top: 24px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

h2.node-heading { font-size: 20px; font-weight: 700; border-bottom: 1px solid rgba(255, 255, 255, 0.08); padding-bottom: 6px; }
h3.node-heading { font-size: 17px; font-weight: 600; }
h4.node-heading { font-size: 15px; font-weight: 600; }
h5.node-heading { font-size: 14px; font-weight: 600; }

.anchor-link {
    color: var(--text-muted);
    opacity: 0.3;
    font-size: 80%;
}

.anchor-link:hover {
    opacity: 1;
    text-decoration: none;
}

.node-badges {
    display: inline-flex;
    gap: 6px;
    margin-left: 6px;
}

/* Callouts */
.callout {
    padding: 14px 18px;
    border-radius: 6px;
    margin: 12px 0;
    font-size: 13px;
}

.callout-danger {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--accent-danger);
    color: #fca5a5;
}

.callout-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--accent-warning);
    color: #fde68a;
}

/* Case Meta Box */
.case-meta-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    margin: 12px 0;
    color: var(--text-muted);
}

.case-brief-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
}

/* Digest Card */
.digest-card {
    background: var(--bg-card);
    border: 1px solid rgba(0, 180, 216, 0.3);
    border-radius: 8px;
    margin: 16px 0;
    overflow: hidden;
}

.digest-header {
    background: rgba(0, 180, 216, 0.1);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-secondary);
    border-bottom: 1px solid rgba(0, 180, 216, 0.2);
}

.digest-body {
    padding: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: #cbd5e1;
}

.digest-body h1, .digest-body h2, .digest-body h3, .digest-body h4 {
    color: #ffffff;
    margin-top: 16px;
    margin-bottom: 8px;
}

.digest-body ul, .digest-body ol {
    margin-left: 24px;
    margin-bottom: 12px;
}

.digest-body blockquote {
    border-left: 3px solid var(--accent-secondary);
    padding-left: 14px;
    color: var(--text-muted);
    font-style: italic;
    margin: 12px 0;
}

/* Citations */
.citations-container {
    margin: 16px 0;
}

.citations-title {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.citation-details {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
    padding: 10px 14px;
    font-size: 13px;
}

.citation-details summary {
    cursor: pointer;
    color: var(--accent-secondary);
}

.citation-body {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dotted var(--border-color);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

/* Master TOC Tree on index page */
.master-tree {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    margin-top: 16px;
}

.master-toc-list, .master-toc-list ul {
    list-style: none;
    padding-left: 18px;
}

.master-toc-list li {
    margin: 6px 0;
}

.toc-item-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toc-subject-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

/* Responsive */
@media (max-width: 900px) {
    .layout-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .main-content {
        padding: 20px;
    }
}
