/* ══════════════════════════════════════════════ */
/*  HELP PAGE – SIDEBAR LAYOUT                   */
/* ══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

/* ── reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background: #f0f2f5;
    color: #2d3748;
    line-height: 1.9;
    direction: rtl;
    display: flex;
    min-height: 100vh;
}

/* ══════════════════════════════════════════════ */
/*  SIDEBAR                                      */
/* ══════════════════════════════════════════════ */

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(175deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.2);
}

/* subtle gradient overlay */
.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 0%, rgba(56, 189, 248, 0.06) 0%, transparent 60%);
    pointer-events: none;
}

/* left accent glow */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #38bdf8 0%, #0ea5e9 30%, #0284c7 60%, transparent 100%);
    pointer-events: none;
}

/* ── sidebar header ── */
.sidebar-header {
    padding: 40px 28px 28px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
}

.sidebar-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #0ea5e9, #38bdf8);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.35);
    transform: rotate(-3deg);
    transition: transform 0.3s ease;
}

.sidebar-logo:hover {
    transform: rotate(0deg) scale(1.05);
}

.sidebar-header h1 {
    font-size: 21px;
    font-weight: 800;
    color: #f1f5f9;
    letter-spacing: -0.3px;
}

.sidebar-subtitle {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 6px;
    font-weight: 400;
}

/* ── sidebar navigation ── */
.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    border-radius: 12px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.25s ease;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.07);
    transform: translateX(-2px);
}

.nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(56, 189, 248, 0.1));
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.2);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 55%;
    background: #38bdf8;
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.nav-icon {
    font-size: 15px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

.nav-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── sidebar footer ── */
.sidebar-footer {
    padding: 16px 20px 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.back-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.65);
    border-radius: 12px;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.25s ease;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* ══════════════════════════════════════════════ */
/*  MAIN CONTENT                                 */
/* ══════════════════════════════════════════════ */

.main {
    flex: 1;
    margin-right: 280px;
    padding: 36px 44px 80px;
    max-width: 100%;
    min-height: 100vh;
}

/* ── section ── */
.section {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
    padding: 36px 40px;
    margin-bottom: 28px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 8px 32px rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}

/* top accent bar */
.section::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8, #7dd3fc);
    opacity: 0.8;
}

/* number badge */
.section-badge {
    position: absolute;
    top: 22px;
    left: 28px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    color: #0369a1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.12);
}

.section h2 {
    font-size: 22px;
    color: #0c4a6e;
    padding-bottom: 16px;
    margin-bottom: 24px;
    font-weight: 800;
    position: relative;
    border-bottom: none;
}

.section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 56px;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
    border-radius: 3px;
}

.section h3 {
    font-size: 15.5px;
    color: #334155;
    margin-top: 28px;
    margin-bottom: 10px;
    font-weight: 700;
}

.section p {
    font-size: 14.5px;
    margin-bottom: 10px;
    color: #475569;
}

.section ul {
    padding-right: 0;
    margin-bottom: 14px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section li {
    font-size: 14.5px;
    color: #475569;
    position: relative;
    padding: 12px 20px 12px 12px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.section li:hover {
    background: #f0f9ff;
    border-color: #bae6fd;
    transform: translateX(-2px);
}

.section li::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, #38bdf8, #7dd3fc);
    border-radius: 0 4px 4px 0;
}

.section li strong {
    color: #0369a1;
}

.section-intro {
    margin-bottom: 22px;
    color: #64748b;
    font-size: 15px;
}

/* ── chart card ── */
.chart-card {
    background: linear-gradient(135deg, #f8fdff 0%, #f0f9ff 100%);
    border: 1px solid #e0f2fe;
    border-radius: 16px;
    padding: 24px 28px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.chart-card::before {
    content: '';
    position: absolute;
    top: 16px;
    right: 0;
    width: 4px;
    height: calc(100% - 32px);
    background: linear-gradient(180deg, #0ea5e9, #38bdf8, #7dd3fc);
    border-radius: 4px 0 0 4px;
}

.chart-card:hover {
    box-shadow: 0 8px 30px rgba(14, 165, 233, 0.12);
    transform: translateY(-2px);
    border-color: #bae6fd;
}

.chart-card h3 {
    margin-top: 0 !important;
    color: #0c4a6e;
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 12px;
}

.chart-card p {
    font-size: 13.5px;
    color: #64748b;
    margin-bottom: 8px;
}

.chart-card .unit-label {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e2e8f0;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* ── direction badges ── */
.direction {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 999px;
    margin: 3px 4px 3px 0;
    letter-spacing: 0.2px;
}

.direction.up {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.direction.down {
    background: linear-gradient(135deg, #fef2f2, #fecaca);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ── category table ── */
.cat-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 16px;
    font-size: 13.5px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.cat-table th,
.cat-table td {
    padding: 13px 20px;
    text-align: right;
}

.cat-table th {
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    font-weight: 700;
    color: #0c4a6e;
    font-size: 13px;
    letter-spacing: 0.2px;
}

.cat-table td {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s ease;
}

.cat-table tr:last-child td {
    border-bottom: none;
}

.cat-table tr:nth-child(even) td {
    background: #f8fafc;
}

.cat-table tr:hover td {
    background: #f0f9ff;
}

.cat-swatch {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    vertical-align: middle;
    margin-left: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ── control item ── */
.control-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 14px;
    margin-bottom: 6px;
    border-radius: 14px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.control-item:hover {
    background: #f0f9ff;
    border-color: #e0f2fe;
    transform: translateX(-2px);
}

.control-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #e0f2fe, #bae6fd);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: #0369a1;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.control-text h4 {
    font-size: 14.5px;
    margin-bottom: 4px;
    color: #1e293b;
    font-weight: 700;
}

.control-text p {
    font-size: 13.5px;
    color: #64748b;
    margin-bottom: 0;
    line-height: 1.8;
}

/* ── kbd ── */
kbd {
    display: inline-block;
    padding: 3px 9px;
    font-size: 12px;
    font-family: inherit;
    background: linear-gradient(180deg, #fafafa, #f1f5f9);
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 2px 0 #94a3b8, inset 0 1px 0 #fff;
    font-weight: 600;
    color: #334155;
}

/* ── note box ── */
.note {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-right: 4px solid #f59e0b;
    padding: 18px 22px;
    border-radius: 14px;
    margin-top: 20px;
    font-size: 13.5px;
    color: #78350f;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.08);
}

.note strong {
    color: #d97706;
    font-weight: 700;
}

/* ── inline code ── */
code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12.5px;
    direction: ltr;
    unicode-bidi: embed;
    color: #be185d;
    border: 1px solid #e2e8f0;
    font-weight: 600;
}

/* ══════════════════════════════════════════════ */
/*  RESPONSIVE                                   */
/* ══════════════════════════════════════════════ */

/* ── tablet ── */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .main {
        margin-right: 240px;
        padding: 28px 28px 60px;
    }

    .section {
        padding: 28px 28px;
    }

    .sidebar-header {
        padding: 32px 20px 22px;
    }

    .sidebar-logo {
        width: 52px;
        height: 52px;
        font-size: 24px;
        border-radius: 16px;
    }

    .sidebar-header h1 {
        font-size: 19px;
    }
}

/* ── mobile: sidebar → top nav ── */
@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        max-height: none;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    }

    .sidebar::after {
        display: none;
    }

    .sidebar-header {
        padding: 24px 20px 18px;
        display: flex;
        align-items: center;
        gap: 14px;
        text-align: right;
    }

    .sidebar-logo {
        width: 44px;
        height: 44px;
        font-size: 20px;
        border-radius: 12px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .sidebar-header h1 {
        font-size: 17px;
    }

    .sidebar-subtitle {
        display: none;
    }

    .sidebar-nav {
        padding: 12px 14px;
        gap: 3px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-link {
        padding: 9px 14px;
        font-size: 12.5px;
        border-radius: 10px;
        flex: 0 0 auto;
    }

    .nav-link.active::before {
        display: none;
    }

    .nav-icon {
        display: none;
    }

    .sidebar-footer {
        padding: 12px 16px 18px;
        text-align: center;
    }

    .back-link {
        font-size: 13px;
        padding: 9px 16px;
    }

    .main {
        margin-right: 0;
        padding: 16px 14px 60px;
    }

    .section {
        padding: 22px 18px;
        border-radius: 16px;
        margin-bottom: 18px;
    }

    .section-badge {
        top: 16px;
        left: 14px;
        width: 32px;
        height: 32px;
        font-size: 14px;
        border-radius: 10px;
    }

    .section h2 {
        font-size: 18px;
        margin-bottom: 18px;
        padding-bottom: 12px;
    }

    .section h3 {
        font-size: 14.5px;
        margin-top: 22px;
    }

    .section p {
        font-size: 13.5px;
        line-height: 1.85;
    }

    .section li {
        font-size: 13.5px;
        padding: 10px 16px 10px 10px;
    }

    .section-intro {
        font-size: 14px;
    }

    .chart-card {
        padding: 18px 18px 18px 22px;
        border-radius: 14px;
        margin-bottom: 16px;
    }

    .chart-card h3 {
        font-size: 15px;
    }

    .chart-card p {
        font-size: 13px;
    }

    .chart-card .unit-label {
        font-size: 11.5px;
    }

    .direction {
        font-size: 11.5px;
        padding: 3px 10px;
    }

    /* table: horizontal scroll */
    .cat-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 14px;
    }

    .cat-table {
        min-width: 500px;
        font-size: 12.5px;
        border-radius: 14px;
    }

    .cat-table th,
    .cat-table td {
        padding: 10px 14px;
        white-space: nowrap;
    }

    .cat-swatch {
        width: 14px;
        height: 14px;
        border-radius: 4px;
    }

    .control-item {
        gap: 12px;
        padding: 12px 10px;
    }

    .control-icon {
        width: 38px;
        height: 38px;
        font-size: 15px;
        border-radius: 10px;
    }

    .control-text h4 {
        font-size: 13.5px;
    }

    .control-text p {
        font-size: 12.5px;
        line-height: 1.75;
    }

    .note {
        padding: 14px 16px;
        border-radius: 12px;
        font-size: 13px;
        margin-top: 16px;
    }

    kbd {
        padding: 2px 7px;
        font-size: 11px;
    }
}

/* ── small phones ── */
@media (max-width: 420px) {
    .sidebar-header {
        padding: 18px 14px 14px;
    }

    .sidebar-logo {
        width: 38px;
        height: 38px;
        font-size: 18px;
        border-radius: 10px;
    }

    .sidebar-header h1 {
        font-size: 15px;
    }

    .sidebar-nav {
        padding: 10px 10px;
        gap: 2px;
    }

    .nav-link {
        padding: 7px 10px;
        font-size: 11.5px;
        border-radius: 8px;
    }

    .main {
        padding: 12px 10px 50px;
    }

    .section {
        padding: 18px 14px;
        border-radius: 14px;
        margin-bottom: 14px;
    }

    .section-badge {
        width: 28px;
        height: 28px;
        font-size: 13px;
        top: 12px;
        left: 10px;
        border-radius: 8px;
    }

    .section h2 {
        font-size: 16px;
    }

    .chart-card {
        padding: 14px 14px 14px 18px;
        border-radius: 12px;
    }

    .chart-card h3 {
        font-size: 14px;
    }

    .control-icon {
        width: 34px;
        height: 34px;
        font-size: 14px;
        border-radius: 8px;
    }

    .cat-table {
        min-width: 420px;
        font-size: 11.5px;
    }

    .cat-table th,
    .cat-table td {
        padding: 8px 10px;
    }
}