﻿:root {
    --brand-red-dark: #7a1315;
    --brand-red: #b3181b;
    --brand-red-light: #d8262a;
    --bg: #eef1f5;
    --surface: #ffffff;
    --text: #1c2530;
    --text-muted: #6b7686;
    --border: #e2e6ec;
    --shadow: 0 2px 10px rgba(20, 25, 35, 0.06);
    --radius: 10px;
}

    :root[data-theme="dark"] {
        --bg: #14171c;
        --surface: #1d2128;
        --text: #eef1f5;
        --text-muted: #9aa4b2;
        --border: #2b303a;
        --shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
    }

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
}

select, option {
    font-family: inherit;
    font-size: inherit
}

body {
    direction: rtl;
    text-align: right;
}

a {
    color: inherit;
    text-decoration: none;
}

.header {
    background: linear-gradient(90deg, var(--brand-red), var(--brand-red-light));
    color: #fff;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .header .brand {
        font-weight: 700;
        letter-spacing: 0.05em;
        font-size: 1.1rem;
    }

    .header .header-actions {
        display: flex;
        align-items: center;
        gap: 0.9rem;
    }

.theme-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
}

    .theme-toggle:hover {
        background: rgba(255, 255, 255, 0.28);
    }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.toolbar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0.9rem 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    flex-wrap: wrap;
}

    .breadcrumb a:hover {
        color: var(--brand-red);
    }

    .breadcrumb .sep {
        color: var(--text-muted);
    }

    .breadcrumb .home-icon {
        opacity: 0.7;
    }

.search-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0.6rem 0.9rem;
}

    .search-box input {
        border: none;
        outline: none;
        background: transparent;
        color: var(--text);
        font-family: inherit;
        font-size: 0.95rem;
        flex: 1;
    }

    .search-box button {
        background: var(--brand-red);
        color: #fff;
        border: none;
        border-radius: 6px;
        padding: 0.45rem 0.9rem;
        cursor: pointer;
        font-family: inherit;
    }

.hero {
    text-align: center;
    margin: 1rem 0 2rem;
}

    .hero h1 {
        font-size: 1.7rem;
        margin-bottom: 0.4rem;
    }

    .hero p {
        color: var(--text-muted);
        margin: 0;
    }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.1rem;
}

.category-card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--surface);
    border: 1px solid var(--border);
    display: block;
}

    .category-card .icon-block {
        background: linear-gradient(160deg, var(--brand-red-dark), var(--brand-red-light));
        height: 165px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #fff;
        font-size: 2.4rem;
    }

    .category-card .title-block {
        padding: 0.9rem;
        text-align: center;
        font-weight: 600;
    }

    .category-card:hover .icon-block {
        filter: brightness(1.08);
    }

    .category-card .icon-block.cover-block,
    .page-title-row .badge-icon.cover-block {
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
        background-color: var(--brand-red-dark);
        font-size: 0 !important;
    }

.page-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.3rem;
}

    .page-title-row h1 {
        margin: 0;
        font-size: 1.5rem;
    }

    .page-title-row .badge-icon {
        width: 82px;
        height: 54px;
        border-radius: var(--radius);
        background: linear-gradient(160deg, var(--brand-red-dark), var(--brand-red-light));
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
    }

.summary-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.3rem;
    margin-bottom: 1.5rem;
    line-height: 1.9;
}

    .summary-box p {
        white-space: pre-line;
    }


.item-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

    .item-card:hover {
        border-color: var(--brand-red-light);
    }

    .item-card .item-title {
        font-weight: 600;
        margin-bottom: 0.35rem;
    }

    .item-card .item-meta {
        color: var(--text-muted);
        font-size: 0.85rem;
    }

    .item-card .item-icon {
        color: var(--brand-red);
        font-size: 1.15rem;
        margin-top: 0.15rem;
    }

.layout-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 1.5rem;
    align-items: start;
}

    .layout-with-sidebar .article-main {
        order: 1;
    }

    .layout-with-sidebar .sidebar-panel {
        order: 2;
    }

.article-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.6rem 1.8rem;
    line-height: 2;
}

    .article-content h2 {
        font-size: 1.2rem;
        margin-top: 1.6rem;
    }

    .article-content h3 {
        font-size: 1.05rem;
    }

    .article-content img {
        max-width: 100%;
        border-radius: 8px;
    }

.article-video {
    margin-top: 1.8rem;
}

    .article-video iframe {
        width: 100%;
        aspect-ratio: 16/9;
        border: none;
        border-radius: 8px;
    }

footer {
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.85rem;
}

@media (max-width: 800px) {
    .layout-with-sidebar {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Phase 3: sidebar, TOC, meta bar, votes, copy-link */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.side-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
}

    .side-box h3 {
        margin: 0 0 0.6rem;
        font-size: 0.98rem;
    }

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

    .toc-list a {
        color: var(--text-muted);
        font-size: 0.88rem;
    }

        .toc-list a:hover {
            color: var(--brand-red);
        }

    .toc-list .toc-level-3 {
        padding-inline-start: 0.9rem;
    }

.article-meta-bar {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.print-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 6px;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    font-family: inherit;
}

    .print-btn:hover {
        border-color: var(--brand-red);
        color: var(--brand-red);
    }

.vote-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 6px;
    padding: 0.35rem 1.1rem;
    cursor: pointer;
    font-family: inherit;
    margin-inline-end: 0.5rem;
}

    .vote-btn.vote-yes:hover {
        border-color: #2e7d32;
        color: #2e7d32;
    }

    .vote-btn.vote-no:hover {
        border-color: var(--brand-red);
        color: var(--brand-red);
    }

.copy-link-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
}

    .copy-link-btn:hover {
        border-color: var(--brand-red);
        color: var(--brand-red);
    }

@media print {
    .header, .toolbar, .sidebar-panel, footer, .no-print {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .article-content {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .layout-with-sidebar {
        grid-template-columns: 1fr;
        display: block;
    }
}
