/* ===========================
   RULES PAGE HEADER
=========================== */
.rules-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.rules-title-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.rules-title-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent, #7c3aed), var(--accent-dark, #4f46e5));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(var(--accent-rgb, 124,58,237),0.3);
}

.rules-title {
    font-size: 22px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.4px;
    line-height: 1.1;
}

.rules-subtitle {
    font-size: 12px;
    color: #555;
    margin-top: 2px;
}

.rules-updated {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: #444;
    background: #111318;
    border: 1px solid #1e2030;
    border-radius: 20px;
    padding: 6px 14px;
    white-space: nowrap;
}

.rules-updated i {
    color: var(--accent, #7c3aed);
    font-size: 11px;
}

/* ===========================
   WARNING BANNER
=========================== */
.rules-warning-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, rgba(239,68,68,0.08), rgba(239,68,68,0.04));
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 10px;
    padding: 13px 18px;
    font-size: 13px;
    color: #f87171;
    line-height: 1.5;
}

.rules-warning-banner i {
    font-size: 16px;
    flex-shrink: 0;
    color: #ef4444;
}

.rules-warning-banner strong {
    color: #fca5a5;
}

/* ===========================
   LAYOUT
=========================== */
.rules-layout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

/* ===========================
   SIDEBAR TOC
=========================== */
.rules-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: #111318;
    border-radius: 12px;
    padding: 16px 12px;
    position: sticky;
    top: 20px;
}

.rules-toc-title {
    font-size: 9px;
    font-weight: 700;
    color: #444;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 10px;
    padding-left: 4px;
}

.toc-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toc-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: #555;
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
    cursor: pointer;
}

.toc-link:hover {
    background: #1a1c24;
    color: #aaa;
}

.toc-link.active {
    background: linear-gradient(90deg, rgba(var(--accent-rgb, 124,58,237),0.15), rgba(var(--accent-dark-rgb, 79,70,229),0.08));
    color: var(--accent-lighter, #c084fc);
    border: 1px solid rgba(var(--accent-rgb, 124,58,237),0.2);
}

.toc-dot {
    font-size: 6px;
    flex-shrink: 0;
    opacity: 0.6;
}

.toc-link.active .toc-dot {
    opacity: 1;
    color: var(--accent-lighter, #c084fc);
}

/* ===========================
   RULES CONTENT
=========================== */
.rules-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ===========================
   RULE SECTION
=========================== */
.rule-section {
    background: #111318;
    border-radius: 12px;
    border: 1px solid #1a1c24;
    overflow: hidden;
    scroll-margin-top: 90px;
}

.rule-section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid #1a1c24;
    background: #0d0f14;
    flex-wrap: wrap;
}

.rule-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}

.rule-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.rule-section-sub {
    font-size: 11px;
    color: #555;
    margin-top: 2px;
}

.rule-section-badge {
    margin-left: auto;
    background: #1e2030;
    color: #666;
    font-size: 10px;
    font-weight: 700;
    border-radius: 20px;
    padding: 3px 10px;
    white-space: nowrap;
}

.rule-badge-red {
    background: rgba(239,68,68,0.12);
    color: #f87171;
}

/* Rule list */
.rule-list {
    display: flex;
    flex-direction: column;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid #0f1015;
    transition: background 0.18s;
}

.rule-item:last-child {
    border-bottom: none;
}

.rule-item:hover {
    background: #0d0f14;
}

.rule-item-danger {
    border-left: 2px solid rgba(239,68,68,0.3);
}

.rule-item-danger:hover {
    background: rgba(239,68,68,0.04);
}

.rule-num {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #1a1c24;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    flex-shrink: 0;
    margin-top: 1px;
}

.num-red {
    background: rgba(239,68,68,0.12);
    color: #f87171;
}

.rule-body {
    flex: 1;
    min-width: 0;
}

.rule-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 4px;
    line-height: 1.2;
}

.rule-desc {
    font-size: 12px;
    color: #555;
    line-height: 1.6;
}

/* Severity badge */
.rule-severity {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
    margin-top: 2px;
}

.sev-low  { background: rgba(16,185,129,0.12); color: #6ee7b7; }
.sev-mid  { background: rgba(245,158,11,0.12); color: #fcd34d; }
.sev-high { background: rgba(249,115,22,0.12); color: #fdba74; }
.sev-ban  { background: rgba(239,68,68,0.14);  color: #fca5a5; }

/* ===========================
   PENALTY TABLE
=========================== */
.penalty-table {
    display: flex;
    flex-direction: column;
}

.penalty-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 0;
    padding: 12px 20px;
    border-bottom: 1px solid #0f1015;
    align-items: center;
    transition: background 0.15s;
}

.penalty-row:last-child {
    border-bottom: none;
}

.penalty-row:hover:not(.penalty-header) {
    background: #0d0f14;
}

.penalty-header {
    font-size: 10px;
    font-weight: 700;
    color: #444;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    background: #0d0f14;
    border-bottom: 1px solid #1a1c24 !important;
    padding: 10px 20px;
}

.penalty-danger {
    background: rgba(239,68,68,0.04);
    border-left: 2px solid rgba(239,68,68,0.3);
}

.pen-name {
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pen-dot {
    font-size: 7px;
}

.pen-val {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* ===========================
   MOBILE
=========================== */
@media (max-width: 768px) {
    .rules-layout {
        flex-direction: column;
    }

    .rules-sidebar {
        width: 100%;
        position: static;
    }

    .toc-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .toc-link {
        flex: 1;
        min-width: 120px;
        justify-content: center;
        font-size: 11px;
        padding: 7px 8px;
    }

    .rules-page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .rule-section-header {
        flex-wrap: wrap;
    }

    .rule-section-badge {
        margin-left: 0;
    }

    .penalty-row {
        grid-template-columns: 1.5fr 1fr 1fr 1fr;
        padding: 10px 14px;
    }

    .rule-item {
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {
    .penalty-table {
        overflow-x: auto;
    }

    .penalty-row {
        min-width: 400px;
    }

    .rule-severity {
        display: none;
    }
}
