/* ========================================
   Enhanced Rules Section Styling
   ======================================== */

.rules-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Document Cards */
.rules-document-card {
    background: var(--rr-ink);
    border-radius: 10px;
    padding: 30px;
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    margin-bottom: 30px;
}

.rules-document-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.document-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
}

.document-icon {
    font-size: 3rem;
    color: #ffffff;
    opacity: 0.9;
}

.document-info h3 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
}

.document-info p {
    margin: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
}

.document-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-download, .btn-view {
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-download {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-download:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    transform: translateY(-2px);
}

.btn-view {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.btn-view:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Interactive Rules Section */
.rules-interactive-section {
    margin-top: 40px;
}

.rules-header {
    text-align: center;
    margin-bottom: 30px;
}

.rules-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--rr-ink);
    margin-bottom: 10px;
}

.rules-subtitle {
    color: #5d6b66;
    font-size: 1.1rem;
    margin: 0;
}

/* Modern Rules Accordion */
.rules-accordion {
    margin-bottom: 40px;
    max-width: 100%;
}

.rules-accordion-item {
    background: white;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
}

.rules-accordion-item:hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-color: rgba(19, 133, 119, 0.2);
    transform: translateY(-2px);
}

.rules-accordion-header {
    margin: 0;
}

.rules-accordion-button {
    width: 100%;
    padding: 24px 28px;
    border: none;
    background: white;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    position: relative;
    outline: none;
}

.rules-accordion-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(19, 133, 119, 0.05);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rules-accordion-button:hover {
    background: #f6f8f7;
}

.rules-accordion-button:hover::before {
    opacity: 1;
}

.rules-accordion-button.collapsed {
    background: white;
}

.rules-accordion-button:not(.collapsed) {
    background: #f6f8f7;
    border-bottom: 1px solid #e4e8e6;
}

.accordion-button-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.accordion-icon {
    font-size: 1.5rem;
    color: var(--rr-accent);
    transition: all 0.3s ease;
    padding: 12px;
    border-radius: 10px;
    background: rgba(19, 133, 119, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
}

.rules-accordion-button:hover .accordion-icon {
    background: rgba(19, 133, 119, 0.15);
    transform: scale(1.1);
}

.rules-accordion-button:not(.collapsed) .accordion-icon {
    background: rgba(19, 133, 119, 0.2);
    color: var(--rr-accent-deep);
}

.accordion-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.category-name {
    font-weight: 600;
    color: var(--rr-ink);
    font-size: 1.1rem;
}

.rules-count {
    color: #5d6b66;
    font-size: 0.9rem;
}

.accordion-chevron {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.3rem;
    color: #5d6b66;
    padding: 8px;
    border-radius: 50%;
    background: #f6f8f7;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
}

.rules-accordion-button:hover .accordion-chevron {
    background: rgba(19, 133, 119, 0.1);
    color: var(--rr-accent);
    transform: scale(1.1);
}

.rules-accordion-button:not(.collapsed) .accordion-chevron {
    transform: rotate(180deg);
}

/* Enhanced Rules Content with Smooth Animations */
.rules-accordion-collapse {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Modern Collapse States */
.rules-accordion-collapse.collapse {
    max-height: 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: max-height 0.4s ease, opacity 0.3s ease, transform 0.3s ease;
}

.rules-accordion-collapse.collapsing {
    position: relative;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.rules-accordion-collapse.collapse.show {
    max-height: 1000px;
    opacity: 1;
    transform: translateY(0);
    transition: max-height 0.4s ease, opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

/* Enhanced Accordion Button States */
.rules-accordion-button:not(.collapsed) {
    background: #f6f8f7;
    border-bottom: 1px solid #e4e8e6;
}

.rules-accordion-button:not(.collapsed) .accordion-chevron {
    transform: rotate(180deg);
    color: var(--rr-accent);
}

.rules-accordion-button.collapsed .accordion-chevron {
    transform: rotate(0deg);
    color: #5d6b66;
}

.rules-accordion-button:focus {
    box-shadow: 0 0 0 3px rgba(19, 133, 119, 0.1);
    outline: none;
}

.rules-accordion-body {
    padding: 0 25px 25px 25px;
    border-top: 1px solid #e4e8e6;
}

.rules-list {
    margin-top: 20px;
}

.rule-item {
    padding: 24px;
    border-radius: 10px;
    margin-bottom: 16px;
    background: #f6f8f7;
    border-left: 4px solid var(--rr-accent);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(19, 133, 119, 0.1);
    overflow: hidden;
}

.rule-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(19, 133, 119, 0.05);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.rule-item:hover {
    background: var(--rr-accent-soft);
    transform: translateX(8px) translateY(-2px);
    border-left-color: var(--rr-accent-deep);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.rule-item:hover::before {
    opacity: 1;
}

.rule-item.highlighted {
    background: var(--rr-gold-soft);
    border-left-color: var(--rr-gold);
    border-color: rgba(212, 162, 76, 0.2);
}

.rule-item.highlighted::before {
    background: rgba(212, 162, 76, 0.1);
}

.rule-item.highlighted:hover {
    background: var(--rr-gold-soft);
    border-left-color: var(--rr-gold-deep);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.rule-item.highlighted .rule-highlight-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    color: var(--rr-gold);
    font-size: 1.3rem;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    animation: pulse-warning 2s infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.rule-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--rr-ink);
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rule-title::before {
    content: '▶';
    color: var(--rr-accent);
    font-size: 0.8rem;
    transition: transform 0.3s ease;
}

.rule-item:hover .rule-title::before {
    transform: scale(1.2);
}

.rule-text {
    color: #5d6b66;
    line-height: 1.7;
    position: relative;
    z-index: 1;
    font-size: 1rem;
}

.rule-text p {
    margin-bottom: 10px;
}

.rule-text ul, .rule-text ol {
    margin-left: 20px;
    margin-bottom: 10px;
}

/* Notice Section */
.rules-notice {
    background: var(--rr-accent);
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    color: white;
}

.notice-content {
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.notice-icon {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
}

.notice-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: white;
}

.notice-description {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin: 0;
}

/* Contact Section */
.rules-contact {
    margin-top: 40px;
}

.contact-card {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.contact-header {
    margin-bottom: 20px;
}

.contact-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--rr-ink);
    margin-bottom: 10px;
}

.contact-content p {
    color: #5d6b66;
    margin-bottom: 25px;
}

.contact-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.contact-actions .btn {
    padding: 12px 25px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.contact-actions .btn:hover {
    transform: translateY(-2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .rules-container {
        padding: 0 15px;
    }
    
    .rules-document-card {
        padding: 20px;
    }
    
    .document-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .document-actions {
        justify-content: center;
    }
    
    .btn-download, .btn-view {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .rules-accordion-button {
        padding: 14px 16px;
        gap: 10px;
        align-items: flex-start;
    }

    .rules-accordion-item .rules-accordion-button .accordion-button-content {
        flex-direction: row !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        text-align: left !important;
        gap: 12px !important;
        width: 100% !important;
        flex: 1;
        min-width: 0;
    }

    .rules-accordion-item .rules-accordion-button .accordion-text {
        text-align: left !important;
        width: auto !important;
        flex: 1;
        min-width: 0;
    }

    .rules-accordion-item .rules-accordion-button .category-name {
        text-align: left !important;
        width: 100% !important;
        font-size: 1rem;
        line-height: 1.35;
    }

    .rules-accordion-item .rules-accordion-button .rules-count {
        text-align: left !important;
        width: 100% !important;
        margin-top: 2px;
    }

    .rules-accordion-body {
        padding: 0 14px 16px 14px;
    }

    .rule-item {
        padding: 14px;
    }

    .notice-content {
        flex-direction: column;
        text-align: center;
    }

    .contact-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .contact-actions .btn {
        width: 100%;
        max-width: none;
        justify-content: center;
    }
}

/* Override scroll animations that create zig-zag pattern */
.rules-accordion-item.animate-on-scroll {
    transform: translateX(0) !important; /* Center all items */
}

.rules-accordion-item:nth-child(even).animate-on-scroll {
    transform: translateX(0) !important; /* Center even items too */
}

.rules-accordion-item.animate-on-scroll.is-visible {
    transform: translateX(0) !important; /* Keep centered when visible */
}

.rules-accordion-item:nth-child(even).animate-on-scroll.is-visible {
    transform: translateX(0) !important; /* Keep even items centered when visible */
}

@media (hover: none), (pointer: coarse) {
    .rule-item:hover {
        transform: none;
    }
}

@media (max-width: 480px) {
    .rules-title {
        font-size: 1.5rem;
    }
    
    .document-actions {
        flex-direction: column;
    }
    
    .btn-download, .btn-view {
        width: 100%;
        justify-content: center;
    }
    
    .rules-accordion-button {
        font-size: 1rem;
    }
    
    .category-name {
        font-size: 1rem;
    }
}

/* ── Content injected via admin (tables, link lists) ─────────────────────── */
.rules-section-public .rules-table-scroll {
    margin: 0.35rem 0 0.65rem;
    border-radius: 10px;
    border: 1px solid #e4e8e6;
    background: #fff;
}

.rules-section-public .rules-data-table {
    font-size: 0.8125rem;
    margin-bottom: 0;
}

.rules-section-public .rules-data-table th,
.rules-section-public .rules-data-table td {
    vertical-align: top;
    padding: 0.45rem 0.55rem;
}

.rules-section-public .rules-ref-list {
    margin: 0;
    padding-left: 1.15rem;
}

.rules-section-public .rules-ref-list li {
    margin-bottom: 0.4rem;
}

.rules-section-public .rules-ref-list a {
    text-decoration: none;
    word-break: break-word;
}

.rules-section-public .rules-ref-list a:hover {
    text-decoration: underline;
}

.rules-section-public .rules-title-icon {
    color: var(--rr-accent);
}

.rules-accordion-button .accordion-chevron {
    flex-shrink: 0;
    align-self: center;
}

.rules-accordion-button:focus-visible {
    outline: 2px solid rgba(19, 133, 119, 0.55);
    outline-offset: 2px;
}

/* =====================================================================
   TASK-285 — rules: squared rr-kit buttons + brand-consistent rule cards
   ===================================================================== */
.events-page #rules .btn-outline-primary {
    border-radius: var(--rr-radius-btn, 6px) !important;
    border: 1.5px solid var(--rr-accent, #138577) !important;
    color: var(--rr-accent, #138577) !important;
    background: transparent !important;
    font-weight: 600;
    box-shadow: none !important;
}
.events-page #rules .btn-outline-primary:hover {
    background: var(--rr-accent, #138577) !important;
    color: #fff !important;
}
.events-page #rules .rule-item { border-radius: var(--rr-radius-card, 10px); }
.events-page #rules .rule-title { font-family: var(--rr-display, 'Space Grotesk', sans-serif); }