/**
 * KermanFoosball — Rules Page Styles
 * طراحی: مستندات مدرن در کادر واحد
 */
/* ==================================================
   هدر Sticky
   ================================================== */

.site-header {
    position: sticky !important;
    top: 0;
    z-index: 1000;
    background: #fff;
    border-bottom: 1px solid var(--kf-border);
    box-shadow: 0 2px 8px rgba(15, 52, 96, .04);
}

/* فاصله برای بخش‌های زیر هدر */
body {
    scroll-padding-top: 90px;
}
/* ==========================================
   ۱. پایه
   ========================================== */

.kf-rules-page {
    padding: 32px 0 64px;
    background: var(--kf-bg);
    min-height: 60vh;
}

/* ==========================================
   ۲. کادر بزرگ (کارت اصلی)
   ========================================== */

.kf-rules-card {
    background: #fff;
    border: 1px solid var(--kf-border);
    border-radius: var(--kf-radius);
    box-shadow: var(--kf-shadow);
    overflow: hidden;
}

/* ==========================================
   ۳. هدر کارت
   ========================================== */

.kf-rules-card-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
    padding: 28px 32px;
    background: linear-gradient(135deg, var(--kf-primary), var(--kf-primary-light));
    color: #fff;
    position: relative;
    overflow: hidden;
}

.kf-rules-card-header::before {
    content: "";
    position: absolute;
    top: -80px;
    left: -80px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(233, 69, 96, .1);
    pointer-events: none;
}

.kf-rules-card-header-text {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.kf-rules-label {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--kf-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    direction: ltr;
}

.kf-rules-card-title {
    margin: 0 0 6px;
    color: #fff;
    font-size: clamp(20px, 3.5vw, 28px);
    font-weight: 800;
    line-height: 1.3;
}

.kf-rules-card-subtitle {
    margin: 0;
    color: rgba(255, 255, 255, .8);
    font-size: 13px;
}

.kf-rules-card-header-search {
    position: relative;
    z-index: 1;
    flex: 0 1 320px;
    min-width: 240px;
}

.kf-rules-search {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: var(--kf-radius-pill);
    overflow: hidden;
    transition: background .2s, border-color .2s;
}

.kf-rules-search:focus-within {
    background: #fff;
    border-color: #fff;
}

.kf-rules-search-icon {
    padding: 0 4px 0 14px;
    font-size: 14px;
    line-height: 1;
    opacity: .7;
}

.kf-rules-search-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 10px;
    background: transparent;
    border: 0;
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.kf-rules-search-input::placeholder {
    color: rgba(255, 255, 255, .7);
}

.kf-rules-search:focus-within .kf-rules-search-input,
.kf-rules-search:focus-within .kf-rules-search-icon {
    color: var(--kf-text);
}

.kf-rules-search:focus-within .kf-rules-search-input::placeholder {
    color: var(--kf-text-muted);
}

.kf-rules-search-clear {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    margin-left: 4px;
    padding: 0;
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    transition: background .15s;
}

.kf-rules-search-clear:hover {
    background: rgba(0, 0, 0, .08);
}

.kf-rules-search-info {
    margin-top: 8px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, .2);
    border-radius: 6px;
    color: rgba(255, 255, 255, .9);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}

/* ==========================================
   ۴. بدنه کارت (دو ستونه)
   ========================================== */

.kf-rules-card-body {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 0;
    align-items: start;
}

/* ==========================================
   ۵. فهرست مطالب (Sticky)
   ========================================== */

.kf-rules-sidebar {
    position: sticky;
    top: 90px;
    padding: 24px 20px;
    border-left: 1px solid var(--kf-border);
    background: #fafbfc;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.kf-rules-toc-title {
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--kf-accent);
    color: var(--kf-primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .5px;
}

.kf-rules-toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kf-rules-toc-list li a {
    display: block;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--kf-text);
    font-size: 12px;
    line-height: 1.6;
    text-decoration: none;
    transition: background .15s, color .15s;
}

.kf-rules-toc-list li a:hover,
.kf-rules-toc-list li a.is-active {
    background: var(--kf-bg);
    color: var(--kf-accent);
    font-weight: 700;
}

.kf-rules-toc-list li a.is-active {
    background: #fff3f5;
    border-right: 3px solid var(--kf-accent);
    padding-right: 7px;
}

/* ==========================================
   ۶. محتوای اصلی
   ========================================== */

.kf-rules-main {
    min-width: 0;
    padding: 32px 36px 40px;
}

/* ==========================================
   ۷. هر بخش
   ========================================== */

.kf-rules-section {
    padding-bottom: 32px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--kf-border);
    scroll-margin-top: 100px;
}

.kf-rules-section:last-child {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.kf-rules-h2 {
    margin: 0 0 20px;
    padding-bottom: 12px;
    color: var(--kf-primary);
    font-size: clamp(20px, 2.5vw, 24px);
    font-weight: 800;
    line-height: 1.4;
    border-bottom: 2px solid var(--kf-accent);
}

.kf-rules-h3 {
    margin: 26px 0 10px;
    color: var(--kf-primary);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.5;
}

.kf-rules-h3:first-of-type {
    margin-top: 0;
}

/* ==========================================
   ۸. متن اصلی
   ========================================== */

.kf-rules-section p {
    margin: 0 0 12px;
    color: var(--kf-text);
    font-size: 15px;
    line-height: 2;
}

.kf-rules-section p:last-child {
    margin-bottom: 0;
}

.kf-rules-section ul,
.kf-rules-section ol {
    margin: 8px 0 14px;
    padding-right: 1.5rem;
    color: var(--kf-text);
    font-size: 15px;
    line-height: 1.9;
}

.kf-rules-section ul { list-style: disc; }
.kf-rules-section ol { list-style: decimal; }

.kf-rules-section ul li,
.kf-rules-section ol li {
    margin-bottom: 6px;
}

.kf-rules-section strong {
    color: var(--kf-primary);
    font-weight: 800;
}

/* ==========================================
   ۹. کادر مقدمه تعاریف
   ========================================== */

.kf-rules-intro {
    margin: 0 0 20px !important;
    padding: 14px 18px;
    background: #fffbf0;
    border-right: 4px solid var(--kf-accent);
    border-radius: var(--kf-radius-sm);
    color: #7a5b1a;
    font-size: 13px;
    line-height: 1.9;
}

/* ==========================================
   ۱۰. لیست تعاریف
   ========================================== */

.kf-rules-defs {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    gap: 0;
}

.kf-rules-defs dt {
    padding: 12px 16px;
    background: var(--kf-bg);
    border: 1px solid var(--kf-border);
    border-bottom: 0;
    color: var(--kf-primary);
    font-weight: 800;
    font-size: 13px;
    line-height: 1.6;
}

.kf-rules-defs dt:first-of-type {
    border-top-right-radius: var(--kf-radius-sm);
    border-top-left-radius: var(--kf-radius-sm);
}

.kf-rules-defs dd {
    margin: 0;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--kf-border);
    color: var(--kf-text-muted);
    font-size: 13px;
    line-height: 1.9;
}

.kf-rules-defs dd:last-of-type {
    border-bottom-right-radius: var(--kf-radius-sm);
    border-bottom-left-radius: var(--kf-radius-sm);
}

/* ==========================================
   ۱۱. جدول‌ها
   ========================================== */

.kf-rules-section table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0 20px;
    background: #fff;
    border: 1px solid var(--kf-border);
    border-radius: var(--kf-radius-sm);
    overflow: hidden;
    font-size: 13px;
}

.kf-rules-section thead th {
    padding: 11px 14px;
    background: var(--kf-primary);
    color: #fff;
    text-align: right;
    font-weight: 800;
    font-size: 12px;
    line-height: 1.6;
}

.kf-rules-section tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--kf-border);
    text-align: right;
    color: var(--kf-text);
    line-height: 1.9;
}

.kf-rules-section tbody tr:last-child td { border-bottom: 0; }
.kf-rules-section tbody tr:nth-child(even) { background: var(--kf-bg); }
.kf-rules-section tbody tr:hover { background: #f0f4f9; }

/* ==========================================
   ۱۲. کادر قانون
   ========================================== */

.kf-rules-law {
    margin: 16px 0;
    padding: 16px 20px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-right: 4px solid #3b82f6;
    border-radius: var(--kf-radius-sm);
}

.kf-rules-law-title {
    display: block;
    margin-bottom: 6px;
    color: #1e40af;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.kf-rules-law p {
    margin: 0 !important;
    color: #1e3a8a;
    font-size: 13px;
    line-height: 1.9;
}

.kf-rules-law ul {
    margin: 6px 0 0 !important;
    padding-right: 1.25rem;
}

.kf-rules-law ul li {
    color: #1e3a8a;
    font-size: 13px;
    line-height: 1.9;
    margin-bottom: 4px;
}

/* ==========================================
   ۱۳. کادر جریمه
   ========================================== */

.kf-rules-penalty {
    margin: 12px 0;
    padding: 14px 18px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-right: 4px solid #ef4444;
    border-radius: var(--kf-radius-sm);
}

.kf-rules-penalty-title {
    display: block;
    margin-bottom: 6px;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.kf-rules-penalty p {
    margin: 0 !important;
    color: #7f1d1d;
    font-size: 13px;
    line-height: 1.9;
}

/* ==========================================
   ۱۴. کادر تفسیر
   ========================================== */

.kf-rules-interpretation {
    margin: 16px 0;
    padding: 14px 18px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-right: 4px solid #22c55e;
    border-radius: var(--kf-radius-sm);
}

.kf-rules-interpretation-title {
    display: block;
    margin-bottom: 6px;
    color: #15803d;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.kf-rules-interpretation p,
.kf-rules-interpretation ol {
    margin: 0 !important;
    color: #14532d;
    font-size: 13px;
    line-height: 1.9;
}

.kf-rules-interpretation ol {
    padding-right: 1.25rem;
    margin-top: 4px !important;
}

.kf-rules-interpretation ol li {
    margin-bottom: 4px;
}

/* ==========================================
   ۱۵. هایلایت جستجو
   ========================================== */

.kf-rules-section mark.kf-rules-highlight {
    background: #fef08a;
    color: var(--kf-primary);
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 700;
}

.kf-rules-section.kf-search-hidden {
    display: none;
}

.kf-rules-section.kf-search-match .kf-rules-h2 {
    color: var(--kf-accent);
}

/* ==========================================
   ۱۶. دکمه بازگشت به بالا
   ========================================== */

.kf-back-to-top {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 999;
    width: 48px;
    height: 48px;
    padding: 0;
    background: var(--kf-primary);
    color: #fff;
    border: 0;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(15, 52, 96, .3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity .25s, visibility .25s, transform .25s, background .15s;
}

.kf-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.kf-back-to-top:hover {
    background: var(--kf-accent);
    transform: translateY(-2px);
}

/* ==========================================
   ۱۷. ریسپانسیو — تبلت (≤ ۹۹۲px)
   ========================================== */

@media (max-width: 992px) {
    .kf-rules-card-body {
        grid-template-columns: 1fr;
    }

    .kf-rules-sidebar {
        position: static;
        max-height: none;
        border-left: 0;
        border-bottom: 1px solid var(--kf-border);
        padding: 20px;
    }

    .kf-rules-toc-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
    }

    .kf-rules-main {
        padding: 24px 24px 32px;
    }
}

/* ==========================================
   ۱۸. ریسپانسیو — موبایل (≤ ۷۶۸px)
   ========================================== */

@media (max-width: 768px) {
    .kf-rules-page {
        padding: 20px 0 40px;
    }

    .kf-rules-card-header {
        padding: 22px 20px;
        gap: 20px;
    }

    .kf-rules-card-title {
        font-size: 20px;
    }

    .kf-rules-card-header-search {
        flex: 1 1 100%;
    }

    .kf-rules-search-input {
        padding: 9px 10px;
        font-size: 12px;
    }

    .kf-rules-toc-list {
        grid-template-columns: 1fr;
        max-height: 240px;
        overflow-y: auto;
    }

    .kf-rules-toc-list li a {
        font-size: 12px;
        padding: 6px 8px;
    }

    .kf-rules-main {
        padding: 20px 18px 26px;
    }

    .kf-rules-h2 {
        font-size: 19px;
    }

    .kf-rules-h3 {
        font-size: 14px;
    }

    .kf-rules-section p,
    .kf-rules-section ul,
    .kf-rules-section ol {
        font-size: 14px;
    }

    .kf-rules-defs dt,
    .kf-rules-defs dd {
        padding: 10px 12px;
        font-size: 12px;
    }

    .kf-rules-section table {
        font-size: 12px;
    }

    .kf-rules-section thead th,
    .kf-rules-section tbody td {
        padding: 8px 10px;
        font-size: 11px;
    }

    .kf-rules-law,
    .kf-rules-penalty,
    .kf-rules-interpretation {
        padding: 12px 14px;
    }

    .kf-rules-law p,
    .kf-rules-penalty p,
    .kf-rules-interpretation p {
        font-size: 12px;
    }

    .kf-back-to-top {
        bottom: 16px;
        left: 16px;
        width: 42px;
        height: 42px;
        font-size: 20px;
    }
}

/* ==========================================
   ۱۹. ریسپانسیو — موبایل کوچک (≤ ۴۸۰px)
   ========================================== */

@media (max-width: 480px) {
    .kf-rules-card-title {
        font-size: 18px;
    }

    .kf-rules-label {
        font-size: 10px;
        letter-spacing: 1.5px;
    }

    .kf-rules-main {
        padding: 16px 14px 20px;
    }

    .kf-rules-h2 {
        font-size: 17px;
    }

    .kf-rules-h3 {
        font-size: 13px;
    }

    .kf-rules-section p,
    .kf-rules-section ul,
    .kf-rules-section ol {
        font-size: 13px;
        line-height: 1.9;
    }

    .kf-rules-section ul,
    .kf-rules-section ol {
        padding-right: 1.2rem;
    }

    .kf-rules-section table {
        font-size: 11px;
    }

    .kf-rules-section thead th,
    .kf-rules-section tbody td {
        padding: 6px 8px;
        font-size: 10px;
    }

    .kf-rules-law p,
    .kf-rules-penalty p,
    .kf-rules-interpretation p,
    .kf-rules-interpretation ol {
        font-size: 11px;
    }
}

/* ==================================================
   فیکس Sticky هدر
   ================================================== */

html,
body,
#page,
.site {
    overflow: visible !important;
}

.site-header {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 9999 !important;
}