/* ==============================================================================
   ElimaPub - Rules & Privacy Policy Stylesheet
   Module: css/05-pages/rules.css
   Modern, Animated, Visually Refined & 100% Mobile-Optimized
   ============================================================================== */

.rules-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    padding-bottom: 90px;
    overflow-x: hidden;
}

/* ---------------- Ambient Background Lights & Animations ---------------- */
.rules-ambient-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(90px);
    opacity: 0.6;
    animation: ambientFloat 14s ease-in-out infinite alternate;
}
.rules-orb-1 {
    top: 60px;
    right: -120px;
    width: 440px;
    height: 440px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.22) 0%, rgba(99, 102, 241, 0.05) 70%, transparent 100%);
    animation-duration: 16s;
}
.rules-orb-2 {
    top: 520px;
    left: -140px;
    width: 460px;
    height: 460px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.16) 0%, rgba(5, 150, 105, 0.04) 70%, transparent 100%);
    animation-duration: 20s;
    animation-delay: -5s;
}
.rules-orb-3 {
    top: 1100px;
    right: 10%;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.14) 0%, transparent 70%);
    animation-duration: 22s;
    animation-delay: -10s;
}

html.dark-theme .rules-orb-1, body.dark-theme .rules-orb-1 {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
}
html.dark-theme .rules-orb-2, body.dark-theme .rules-orb-2 {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.22) 0%, transparent 70%);
}
html.dark-theme .rules-orb-3, body.dark-theme .rules-orb-3 {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
}

@keyframes ambientFloat {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(30px, 25px, 0) scale(1.08);
    }
    100% {
        transform: translate3d(-25px, 45px, 0) scale(0.95);
    }
}

.rules-shell {
    position: relative;
    z-index: 1;
    width: min(100%, 1200px);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------------- Hero Section (Never Fixed, Pure Fluid Flow) ---------------- */
.rules-hero-section {
    position: relative;
    max-width: 860px;
    margin: 0 auto 40px;
    padding-top: 24px;
    text-align: right;
    animation: rulesHeroFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes rulesHeroFade {
    from {
        opacity: 0;
        transform: translate3d(0, 18px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Breadcrumb */
.rules-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.rules-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.18s ease;
}
.rules-breadcrumb a:hover {
    color: var(--primary);
}
.rules-breadcrumb .sep {
    opacity: 0.5;
}
.rules-breadcrumb .current {
    color: var(--text-title);
    font-weight: 700;
}

/* Animated Eyebrow Badge */
.rules-eyebrow-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.18);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 18px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.rules-eyebrow-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.16);
}
html.dark-theme .rules-eyebrow-badge, body.dark-theme .rules-eyebrow-badge {
    background: rgba(99, 102, 241, 0.14);
    border-color: rgba(99, 102, 241, 0.28);
    color: #c7d2fe;
}

.pulse-indicator {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
}
.pulse-core {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px #10b981;
}
.pulse-wave {
    position: absolute;
    inset: -3px;
    border: 1.5px solid #10b981;
    border-radius: 50%;
    animation: wavePulse 2s cubic-bezier(0.25, 1, 0.5, 1) infinite;
}
@keyframes wavePulse {
    0% { transform: scale(0.6); opacity: 0.9; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* Main Title */
.rules-main-title {
    font-size: clamp(1.8rem, 3.8vw, 2.7rem);
    font-weight: 900;
    color: var(--text-title);
    line-height: 1.32;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}
.rules-main-title span {
    background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
html.dark-theme .rules-main-title span, body.dark-theme .rules-main-title span {
    background: linear-gradient(135deg, #a5b4fc 0%, #34d399 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.rules-lead-text {
    font-size: clamp(0.94rem, 1.7vw, 1.05rem);
    color: var(--text-body);
    line-height: 2;
    margin-bottom: 24px;
}

/* Meta Pills Grid */
.rules-meta-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 26px;
}
.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    background: var(--bg-cards);
    border: 1px solid var(--border-glass);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
    font-size: 0.8rem;
    color: var(--text-muted);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.meta-pill strong {
    color: var(--text-title);
    font-weight: 700;
}
.meta-pill .meta-icon {
    color: var(--primary);
    flex-shrink: 0;
}
.meta-pill.is-link {
    text-decoration: none;
    cursor: pointer;
}
.meta-pill:hover {
    transform: translateY(-2px);
    border-color: rgba(79, 70, 229, 0.3);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.08);
}

/* Interactive Search Bar */
.rules-search-wrap {
    margin-top: 10px;
}
.rules-search-glass-card {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 620px;
    background: var(--input-bg);
    border: 1.5px solid var(--border-glass);
    border-radius: 16px;
    padding: 6px 16px;
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}
.rules-search-glass-card:focus-within {
    border-color: var(--primary);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.12), 0 0 0 3px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}
.rules-search-glass-card .search-svg {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 10px;
    transition: color 0.18s ease;
}
.rules-search-glass-card:focus-within .search-svg {
    color: var(--primary);
}
.rules-search-glass-card input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-title);
    outline: none;
}
.search-clear-btn {
    border: none;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text-muted);
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
    line-height: 1;
    transition: background-color 0.18s ease, color 0.18s ease;
}
.search-clear-btn:hover {
    background: rgba(239, 68, 68, 0.16);
    color: #ef4444;
}

/* ---------------- Main Layout (TOC Sidebar + Content Grid) ---------------- */
.rules-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 36px;
    align-items: start;
}

/* Desktop TOC Sidebar */
.rules-nav-column {
    position: sticky;
    top: 96px;
    animation: rulesSidebarFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}
@keyframes rulesSidebarFade {
    from { opacity: 0; transform: translate3d(0, 16px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

.rules-toc-card {
    padding: 20px 16px;
    border-radius: 22px;
    background: var(--bg-cards);
    border: 1px solid var(--border-glass);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}
.toc-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--text-title);
    padding-bottom: 12px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-glass);
}
.toc-header svg {
    color: var(--primary);
}

.toc-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.toc-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 12px;
    color: var(--text-body);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.5;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.toc-badge {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 800;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background-color 0.18s ease, color 0.18s ease;
}
html.dark-theme .toc-badge, body.dark-theme .toc-badge {
    background: rgba(255, 255, 255, 0.06);
}

.toc-link:hover {
    background: rgba(79, 70, 229, 0.06);
    color: var(--primary);
    transform: translateX(-3px);
}
.toc-link.is-active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    font-weight: 800;
}
.toc-link.is-active .toc-badge {
    background: var(--primary);
    color: #ffffff;
}
html.dark-theme .toc-link.is-active, body.dark-theme .toc-link.is-active {
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
}

/* ---------------- Content Column ---------------- */
.rules-content-column {
    display: flex;
    flex-direction: column;
    gap: 26px;
    min-width: 0;
}

/* Individual Section Cards */
.rules-section {
    position: relative;
    padding: 32px 30px;
    border-radius: 24px;
    background: var(--bg-cards);
    border: 1px solid var(--border-glass);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    scroll-margin-top: 100px;
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.22s ease, 
                box-shadow 0.22s ease;
    animation: rulesCardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.rules-section:hover {
    transform: translateY(-3px);
    border-color: rgba(79, 70, 229, 0.25);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.07);
}
html.dark-theme .rules-section:hover, body.dark-theme .rules-section:hover {
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(99, 102, 241, 0.35);
}

.rules-section.is-match {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16), var(--glass-shadow);
}
.rules-section.is-hidden {
    display: none !important;
}

@keyframes rulesCardIn {
    from {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* Section Header */
.rules-section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-glass);
}
.sec-badge-box {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 10px;
    background: rgba(79, 70, 229, 0.08);
    border: 1px solid rgba(79, 70, 229, 0.14);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    flex-shrink: 0;
}
html.dark-theme .sec-badge-box, body.dark-theme .sec-badge-box {
    background: rgba(99, 102, 241, 0.16);
    border-color: rgba(99, 102, 241, 0.28);
    color: #c7d2fe;
}
.rules-section h2 {
    font-size: clamp(1.1rem, 2vw, 1.28rem);
    font-weight: 800;
    color: var(--text-title);
    letter-spacing: -0.015em;
    margin: 0;
}

/* Section Body & Typography */
.rules-section-body {
    font-size: 0.94rem;
    color: var(--text-body);
    line-height: 2.05;
}
.rules-section-body p {
    margin-bottom: 16px;
}
.rules-section-body p:last-child {
    margin-bottom: 0;
}
.rules-section-body code {
    font-family: inherit;
    font-size: 0.88em;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--primary);
    font-weight: 700;
}
html.dark-theme .rules-section-body code, body.dark-theme .rules-section-body code {
    background: rgba(255, 255, 255, 0.08);
    color: #a5b4fc;
}

/* Bullet Points */
.rules-points {
    list-style: none;
    padding: 0;
    margin: 14px 0 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.rules-points li {
    position: relative;
    padding-right: 20px;
    line-height: 1.95;
    transition: transform 0.18s ease;
}
.rules-points li::before {
    content: '';
    position: absolute;
    right: 0;
    top: 11px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 6px rgba(79, 70, 229, 0.4);
}
.rules-points li strong {
    color: var(--text-title);
    font-weight: 700;
}

/* Law Card (Citation Box) */
.law-card {
    padding: 18px 22px;
    border-radius: 16px;
    background: rgba(245, 158, 11, 0.06);
    border-right: 4px solid #d97706;
    border-top: 1px solid rgba(245, 158, 11, 0.12);
    border-bottom: 1px solid rgba(245, 158, 11, 0.12);
    border-left: 1px solid rgba(245, 158, 11, 0.12);
    margin: 18px 0 20px;
    font-size: 0.88rem;
    line-height: 1.95;
}
.law-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b45309;
    font-size: 0.88rem;
    margin-bottom: 8px;
}
.law-card-head svg {
    flex-shrink: 0;
}
html.dark-theme .law-card, body.dark-theme .law-card {
    background: rgba(245, 158, 11, 0.08);
}
html.dark-theme .law-card-head, body.dark-theme .law-card-head {
    color: #fbbf24;
}
.law-card p {
    margin: 0;
    color: var(--text-body);
}

/* ---------------- Footer Action Card ---------------- */
.rules-footer-action {
    margin-top: 48px;
    padding: 32px 28px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.07) 0%, rgba(5, 150, 105, 0.05) 100%);
    border: 1.5px solid rgba(79, 70, 229, 0.18);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.footer-action-content h3 {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--text-title);
    margin-bottom: 6px;
}
.footer-action-content p {
    font-size: 0.9rem;
    color: var(--text-body);
    margin: 0;
}
.rules-footer-btns {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}
.rules-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, #3730a3 100%);
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.rules-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(79, 70, 229, 0.38);
}
.rules-btn-secondary {
    display: inline-flex;
    align-items: center;
    padding: 12px 20px;
    border-radius: 14px;
    background: var(--bg-cards);
    border: 1px solid var(--border-glass);
    color: var(--text-title);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.rules-btn-secondary:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    color: var(--primary);
}

/* ---------------- 100% Mobile Optimization ---------------- */
@media (max-width: 900px) {
    .rules-shell {
        padding: 0 16px;
    }
    .rules-hero-section {
        margin-bottom: 28px;
    }
    .rules-layout {
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

    /* Mobile: Frosted Glass Sticky Horizontal Pill Bar */
    .rules-nav-column {
        position: sticky;
        top: 80px;
        z-index: 50;
        width: 100%;
        margin-bottom: 4px;
    }
    .rules-toc-card {
        padding: 8px 10px;
        border-radius: 16px;
        background: var(--header-bg-scrolled, rgba(255, 255, 255, 0.92));
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
    }
    html.dark-theme .rules-toc-card, body.dark-theme .rules-toc-card {
        background: rgba(11, 17, 32, 0.92);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    }
    .toc-header {
        display: none;
    }
    .toc-links-list {
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        padding-bottom: 2px;
    }
    .toc-links-list::-webkit-scrollbar {
        display: none;
    }
    .toc-link {
        white-space: nowrap;
        padding: 7px 12px;
        font-size: 0.78rem;
        border-radius: 999px;
        background: var(--input-bg);
        border: 1px solid var(--border-glass);
        flex-shrink: 0;
    }
    .toc-link.is-active {
        background: var(--primary);
        color: #ffffff;
        border-color: var(--primary);
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    }
    html.dark-theme .toc-link.is-active, body.dark-theme .toc-link.is-active {
        background: var(--primary);
        color: #ffffff;
    }

    .rules-section {
        padding: 22px 18px;
        border-radius: 18px;
        scroll-margin-top: 140px;
    }
    .rules-section-header {
        padding-bottom: 12px;
        margin-bottom: 14px;
        gap: 10px;
    }
    .rules-section h2 {
        font-size: 1.05rem;
    }
    .rules-section-body {
        font-size: 0.88rem;
        line-height: 1.95;
    }
    .rules-footer-action {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        padding: 24px 20px;
    }
    .rules-btn-primary, .rules-btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .rules-main-title {
        font-size: 1.55rem;
    }
    .rules-lead-text {
        font-size: 0.88rem;
    }
    .rules-meta-grid {
        gap: 8px;
    }
    .meta-pill {
        font-size: 0.74rem;
        padding: 6px 10px;
    }
    .rules-search-glass-card {
        padding: 4px 12px;
    }
    .rules-search-glass-card input {
        font-size: 0.84rem;
    }
}
