/* ========================================
   REUSABLE COMPONENT LIBRARY

   Generalized CSS components for the Legislative Bill Tracking System.
   These styles are documented in component-style-guide.html
   ======================================== */

/* ========================================
   RESPONSIVE BREAKPOINTS

   Standard breakpoints used throughout the application.
   Use these consistently for all responsive design.

   MOBILE-FIRST APPROACH:
   - Start with mobile styles as the default
   - Use min-width for larger screens
   - Use max-width sparingly for mobile-specific overrides

   BREAKPOINT REFERENCE:
   - Mobile Small:    <= 576px   (Small phones, compact views)
   - Mobile/Tablet:   <= 768px   (Tablets, large phones)
   - Tablet/Desktop:  <= 1024px  (Small laptops, tablets in landscape)
   - Desktop:         >= 1440px  (Standard desktop monitors)
   - Large Desktop:   >= 1800px  (Large monitors, 1080p+)
   - XL Desktop:      >= 2200px  (Ultra-wide, 4K monitors)

   USAGE EXAMPLES:
   Mobile-first (recommended):
     .component { ... }
     @media (min-width: 768px) { .component { ... } }

   Desktop-first (use for mobile-specific overrides):
     .component { ... }
     @media (max-width: 1024px) { .component { ... } }
   ======================================== */

/* ========== LAYOUT COMPONENTS ========== */

/* Main Container - Primary page wrapper with responsive sizing */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== SEARCH AND HIGHLIGHTING ========== */

/* Search query highlight - emphasize matching search terms */
.highlight-query {
    background-color: #fff3cd;
    color: #856404;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

@media (min-width: 1440px) {
    .main-container {
        max-width: 85%;
        padding: 20px 40px;
    }
}

@media (min-width: 1800px) {
    .main-container {
        max-width: 90%;
        padding: 20px 60px;
    }
}

@media (min-width: 2200px) {
    .main-container {
        max-width: 2000px;
    }
}

/* Content Grid - Flexible grid system using CSS variables */
.content-grid {
    display: grid;
    grid-template-columns: var(--grid-cols);
    gap: 20px;
}

@media (min-width: 1440px) {
    .content-grid {
        gap: 30px;
    }
}

@media (min-width: 1800px) {
    .content-grid {
        gap: 40px;
    }
}

@media (min-width: 2200px) {
    .content-grid {
        gap: 50px;
    }
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Grid utility - span all columns */
.grid-span-full {
    grid-column: 1 / -1;
}

@media (max-width: 1024px) {
    .grid-span-full {
        grid-column: auto;
    }
}

/* ========== CARD COMPONENT ========== */

.card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

.card__header {
    background: linear-gradient(135deg, #080530 0%, #3477b2 100%);
    color: white;
    padding: 15px 20px;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: filter 0.2s ease;
}

.card__body {
    padding: 20px;
}

@media (min-width: 768px) {
    .card__body {
        padding: 25px;
    }
}

/* ========== COLLAPSIBLE BEHAVIOR ========== */

/* Always Collapsible - Works on all screen sizes */
.collapsible .card__header,
.collapsible__header {
    cursor: pointer;
}

.collapsible .card__header:hover,
.collapsible__header:hover {
    filter: brightness(1.1);
}

.collapsible .card__body,
.collapsible__body {
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.collapsible.collapsed .card__body,
.collapsible.collapsed .collapsible__body {
    max-height: 0;
    padding: 0 15px;
    overflow: hidden;
}

/* Mobile-Only Collapsible - Only collapses on mobile (≤1024px), always expanded on desktop */
.collapsible-mobile-only .card__header,
.collapsible-mobile-only__header {
    cursor: default;
}

@media (max-width: 1024px) {
    .collapsible-mobile-only .card__header,
    .collapsible-mobile-only__header {
        cursor: pointer;
    }

    .collapsible-mobile-only .card__header:hover,
    .collapsible-mobile-only__header:hover {
        filter: brightness(1.1);
    }

    .collapsible-mobile-only .card__body,
    .collapsible-mobile-only__body {
        transition: max-height 0.3s ease, padding 0.3s ease;
    }

    .collapsible-mobile-only.collapsed .card__body,
    .collapsible-mobile-only.collapsed .collapsible__body {
        max-height: 0;
        padding: 0 15px;
        overflow: hidden;
    }
}

/* ========== INFO BAR COMPONENT ========== */

/* Info Bar - Displays label-value pairs in a highlighted container */
.info-bar {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: #ffffff;
    border: 1px solid #9D9D9D;
    border-radius: 6px;
    margin-bottom: 20px;
}

.info-bar__label {
    font-weight: 600;
    color: #000000;
    white-space: nowrap;
}

.info-bar__text {
    color: #000000;
}

/* ========== HEADER COMPONENTS ========== */

.main-header {
    background: #080530;
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.main-header-text {
    font-size: 1.75rem;
    font-weight: bold;
    margin-bottom: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: block;
}

.main-header-description {
    font-size: 1.125rem;
    opacity: 0.95;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.heading--label {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========== LINK CARD COMPONENTS ========== */

.link-card-stack {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.link-card-item {
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #1e3a5f;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: block;
    text-align: left;
    width: auto;
}

.link-card-item:hover,
.link-card-item-with-chip:hover {
    background: #1e3a5f;
    color: white;
    border-color: #1e3a5f;
    text-decoration: none;
}

.link-card-item-with-chip {
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #1e3a5f;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: auto;
}

/* ========== STATUS CHIP COMPONENTS ========== */

.round-status-chip {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.square-status-chip {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-chip--success {
    background: #28a745;
    color: white;
}

.status-chip--warning {
    background: #ffc107;
    color: #000;
}

.status-chip--danger {
    background: #dc3545;
    color: white;
}

.status-chip--info {
    background: #17a2b8;
    color: white;
}

.status-chip--secondary {
    background: #6c757d;
    color: white;
}

/* ========== DETAIL GRID COMPONENT ========== */

/* Detail Grid - Two-column grid for label-value pairs */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

@media (max-width: 1024px) {
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* Detail Grid Item - Container for each label-value pair */
.detail-grid__item {
    padding: 8px 0;
}

/* Detail Grid Label - Small uppercase label */
.detail-grid__label {
    font-size: 0.75rem;
    color: #6c757d;
    display: block;
    margin-bottom: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Detail Grid Value - The actual content/value */
.detail-grid__value {
    font-size: 0.875rem;
    color: #000000;
    font-weight: 500;
}

.detail-grid__value a {
    color: #1e3a5f;
    text-decoration: none;
}

.detail-grid__value a:hover {
    text-decoration: underline;
}

/* ========== TEXT CONTENT COMPONENT ========== */

/* Text Content Preformatted - For displaying preformatted text like bill summaries */
.text-content--preformatted {
    white-space: pre-wrap;
    line-height: 1.6;
    color: #000000;
    font-size: 0.95rem;
}

/* ========== CHEVRON ARROW ========== */

/* Base chevron arrow - All visual styling */
.chevron-arrow {
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-left: 0;
    border-bottom: 0;
    transform: rotate(45deg); /* Default collapsed state - points right */
    transition: transform 0.3s ease;
    display: inline-block;
}

/* Rotate when parent is collapsed */
.collapsed .chevron-arrow {
    transform: rotate(45deg);
}

/* Bootstrap collapse integration - when expanded, point down */
[aria-expanded="true"] .chevron-arrow {
    transform: rotate(135deg); /* Expanded state - points down */
}

/* Bootstrap collapse integration - when collapsed, point right */
[aria-expanded="false"] .chevron-arrow {
    transform: rotate(45deg); /* Collapsed state - points right */
}

/* Mobile-only chevron variant - inherits from .chevron-arrow, only controls visibility */
.chevron-arrow-only-mobile {
    display: none;
}

@media (max-width: 1024px) {
    .chevron-arrow-only-mobile {
        display: inline-block !important;
    }
}

@media (min-width: 1025px) {
    .chevron-arrow-only-mobile {
        display: none !important;
    }
}

/* All other styling (size, border, rotation, transition) comes from .chevron-arrow base class */

/* Chevron for always-collapsible elements - always visible */
.collapsible .chevron-arrow {
    display: inline-block;
}

/* Chevron for mobile-only collapsible - only visible on mobile */
.collapsible-mobile-only .chevron-arrow {
    display: none;
}

@media (max-width: 1024px) {
    .collapsible-mobile-only .chevron-arrow {
        display: inline-block;
    }
}

/* ========== MODAL COMPONENT ========== */

.modal {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal__content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

/* Large modal variant - wider and taller */
.modal__content--large {
    max-width: 1200px;
    max-height: 85vh;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal__header {
    background: linear-gradient(135deg, #080530 0%, #3477b2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-radius: 8px 8px 0 0;
}

.modal__header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal__body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.btn-modal-close {
    background-color: transparent;
    color: white;
    border: 2px solid white;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.9em;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-modal-close:hover,
.btn-modal-close:focus {
    background-color: white;
    color: #080530;
    text-decoration: none;
    outline: 3px solid #3477b2;
    outline-offset: 2px;
}

/* ========== SCROLL TO TOP BUTTON ========== */

/* Base scroll to top button */
.btn-scroll-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #1e3a5f;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-scroll-top::before {
    content: '↑';
    font-size: 20px;
    font-weight: bold;
}

.btn-scroll-top:hover,
.btn-scroll-top:focus {
    background-color: #0d2a4a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 58, 95, 0.4);
    outline: 3px solid #3477b2;
    outline-offset: 2px;
}

.btn-scroll-top.show {
    opacity: 1;
    visibility: visible;
}

/* Responsive sizing */
@media (max-width: 768px) {
    .btn-scroll-top {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 16px;
    }

    .btn-scroll-top::before {
        font-size: 18px;
    }
}

@media (max-width: 576px) {
    .btn-scroll-top {
        bottom: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .btn-scroll-top::before {
        font-size: 16px;
    }
}

/* Mobile-only variant */
.btn-scroll-top-only-mobile {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: #1e3a5f;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
    display: none;
}

.btn-scroll-top-only-mobile::before {
    content: '↑';
    font-size: 20px;
    font-weight: bold;
}

.btn-scroll-top-only-mobile:hover,
.btn-scroll-top-only-mobile:focus {
    background-color: #0d2a4a;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 58, 95, 0.4);
    outline: 3px solid #3477b2;
    outline-offset: 2px;
}

.btn-scroll-top-only-mobile.show {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1024px) {
    .btn-scroll-top-only-mobile {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .btn-scroll-top-only-mobile {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 16px;
    }

    .btn-scroll-top-only-mobile::before {
        font-size: 18px;
    }
}

@media (max-width: 576px) {
    .btn-scroll-top-only-mobile {
        bottom: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .btn-scroll-top-only-mobile::before {
        font-size: 16px;
    }
}

/* ========== INDEX PAGE SPECIFIC COMPONENTS ========== */

/* Bill Actions Header - Sticky navigation header */
.bill-actions-header {
    background-color: #080530 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1030 !important;
    top: 0;
    position: sticky !important;
}

.bill-actions-header .btn-outline-light {
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #fff;
    font-weight: 600;
    padding: 8px 16px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bill-actions-header .btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.bill-actions-header .btn-outline-light:active,
.bill-actions-header .btn-outline-light:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.6);
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

.bill-actions-header .btn-light,
.bill-actions-header .btn-primary {
    background-color: #3477b2;
    border: 1px solid #3477b2;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    padding: 8px 16px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bill-actions-header .btn-light:hover,
.bill-actions-header .btn-primary:hover {
    background-color: #2a5f8f;
    border-color: #2a5f8f;
    color: white;
    box-shadow: 0 4px 12px rgba(51, 122, 183, 0.3);
    transform: translateY(-2px);
}

.bill-actions-header .form-control,
.bill-actions-header .form-select {
    background-color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.2s ease;
    color: #080530;
}

.bill-actions-header .form-control::placeholder {
    color: #080530;
    opacity: 0.7;
}

.bill-actions-header .form-control:focus,
.bill-actions-header .form-select:focus {
    background-color: #fff;
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
    color: #080530;
}

/* Mobile Navigation & Hamburger Menu */
.nav-hamburger {
    display: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-hamburger:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-hamburger i {
    font-size: 1.25rem;
}

.nav-links-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-text-full {
    display: inline;
}

.btn-text-short {
    display: none;
}

/* ========== MOBILE/TABLET NAVIGATION (up to 1024px) ========== */
@media (max-width: 1024px) {
    /* Row 1: Year, Session, Hamburger - all flex to fit */
    .header-row-1 {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Hide Jump To dropdown on mobile and tablet */
    .header-item-jump {
        display: none !important;
    }

    /* Show hamburger menu on mobile and tablet */
    .nav-hamburger,
    .header-item-hamburger {
        display: inline-flex !important;
        align-items: center;
        gap: 0.5rem;
        order: 3;
    }

    /* Year and Session flex to fit */
    .header-item-year {
        order: 1;
        flex: 0 1 auto;
    }

    .header-item-session {
        order: 2;
        flex: 0 1 auto;
    }

    /* Search moves to its own row visually - full width */
    .header-item-search {
        order: 4;
        width: 100%;
        flex: 1 1 100%;
        min-width: 0 !important;
        margin-top: 0.5rem;
    }

    .header-item-search .form-control {
        flex: 1;
    }

    /* Nav links hidden until hamburger is clicked */
    .nav-links-container {
        display: none;
        width: 100%;
        flex-direction: column;
    }

    .nav-links-container.show {
        display: flex;
    }

    /* Use short button text on mobile/tablet */
    .btn-text-full {
        display: none;
    }

    .btn-text-short {
        display: inline;
    }

    .nav-links-container .btn {
        width: 100%;
        justify-content: center;
    }

    .bill-actions-header .btn-primary {
        padding: 8px 12px;
        height: auto;
    }

    /* Row 2 contains nav links only - centers the nav links container */
    .header-row-2 {
        justify-content: center;
    }
}

/* ========== MOBILE-ONLY ADJUSTMENTS (phones) ========== */
@media (max-width: 767px) {
    /* Keep all items in row format but allow wrapping */
    .header-row-1 {
        gap: 0.5rem;
    }

    /* Year and Session dropdowns - flex to fit side by side */
    .header-item-year,
    .header-item-session {
        flex: 1 1 auto;
        min-width: 0;
    }

    .header-item-year select,
    .header-item-session select {
        width: 100% !important;
        min-width: 0;
    }

    .header-item-year label,
    .header-item-session label {
        display: none;
    }
}

/* Card Overlay Modal (Alternative to standard modal) */
.card-overlay-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.card-overlay-panel {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    transform: translate(-50%, -50%) !important;
    width: min(600px, calc(100vw - 48px)) !important;
    max-width: 600px !important;
    max-height: min(80vh, calc(100vh - 48px));
    overflow: auto;
    background: #fff;
    border-radius: .75rem;
    box-shadow: 0 1.5rem 3rem rgba(0,0,0,.6);
    z-index: 2010 !important;
    animation: overlayIn .2s ease;
}

@keyframes overlayIn {
    from {
        transform: translate(-50%, -50%) scale(.98);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@media (max-width: 991.98px) {
    .card-overlay-panel {
        width: calc(100vw - 32px) !important;
        max-width: calc(100vw - 32px) !important;
    }
}

.card-overlay-panel .overlay-header {
    position: sticky;
    top: 0;
    background-color: #080530;
    color: white;
    z-index: 10;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: .75rem .75rem 0 0;
}

.card-overlay-panel .overlay-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.card-overlay-panel .overlay-close:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

/* ========== SEARCH RESULT CARDS IN MODAL ========== */
.search-result-card {
    border-radius: 0.375rem;
    overflow: hidden;
}

.search-result-header {
    transition: filter 0.2s ease;
}

.search-result-header:hover {
    filter: brightness(1.1);
}

/* Chevron rotation for search results */
.search-chevron {
    transition: transform 0.3s ease;
}

.search-result-header[aria-expanded="true"] .search-chevron {
    transform: rotate(180deg);
}

/* Sticky header for expanded search results - becomes sticky when expanded */
.search-result-card .collapse.show + .search-result-header,
.search-result-header[aria-expanded="true"] {
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Ensure the card body in expanded results is scrollable if needed */
.search-result-card .collapse.show .card-body {
    max-height: 50vh;
    overflow-y: auto;
}

.card-overlay-panel .overlay-body {
    padding: 1rem;
}

button.overlay-close {
    position: absolute;
    top: .5rem;
    right: .5rem;
    z-index: 2;
}

/* Section and Bill Cards */
.section-card .card-header {
    background: #080530;
    color: #fff;
    border-radius: .5rem .5rem 0 0;
}

.section-card__header {
    gap: .75rem;
}

.section-card__header:focus {
    outline: none;
    box-shadow: none;
}

.section-card__chev {
    transition: transform .2s ease;
}

.section-card .collapse.show ~ .card-footer,
.section-card .collapse.show .section-card__chev {
    transform: rotate(180deg);
}

.section-chip {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.12);
    border-radius: 50%;
    font-weight: 700;
}

.bill-block + .bill-block {
    border-top: 1px dashed var(--bs-border-color);
    padding-top: .75rem;
    margin-top: .75rem;
}

.bill-block__title {
    margin-bottom: .35rem;
}

.bill-pill {
    display: inline-block;
    padding: .25rem .5rem;
    border-radius: 999px;
    background: var(--bs-gray-100);
    border: 1px solid var(--bs-border-color);
    font-weight: 600;
}

.lr-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: .35rem 0;
}

.lr-list code {
    flex-shrink: 0;
    margin-top: 0.15rem;
    background: var(--bs-gray-100);
    padding: .05rem .35rem;
    border-radius: .25rem;
}

.lr-list .badge {
    display: inline-block;
    padding: .35rem .65rem;
    font-size: 0.75rem;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
    min-width: 140px;
    width: 140px;
    vertical-align: middle;
}

.section-card--compact .card-body {
    padding: .75rem 1rem;
}

.section-card--compact .bill-block + .bill-block {
    margin-top: .5rem;
    padding-top: .5rem;
}

.section-card--compact .lr-list li {
    display: inline-block;
    margin-right: .5rem;
}

.section-card--flat {
    box-shadow: none !important;
    border: 0 !important;
}

.section-card--borderless .card-header {
    background: transparent;
    color: var(--bs-body-color);
}

.section-card--borderless .card {
    border: 0;
}

.section-card--accent .card-header {
    background: linear-gradient(90deg, #080530, #3b2ccf);
}

.section-card-header {
    background: linear-gradient(135deg, #080530 0%, #3477b2 100%) !important;
    color: white !important;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0.375rem 0.375rem 0 0 !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    /* Sticky header - applies to all screen sizes */
    position: sticky;
    top: 0;
    z-index: 10;
}

.section-card-header:hover {
    background: linear-gradient(135deg, #080530 0%, #3477b2 100%) !important;
    filter: brightness(1.1);
}

/* Chapter card headers with solid color */
.chapter-card-header {
    background: #080530 !important;
    color: white !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    transition: all 0.2s ease;
    /* Sticky header - applies to all screen sizes */
    position: sticky;
    top: 0;
    z-index: 10;
}

.chapter-card-header:hover {
    filter: brightness(1.1);
}

/* Ensure badges are visible on gradient backgrounds */
.chapter-card .badge.bg-secondary {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.section-card-header .badge.bg-light {
    background-color: rgba(255, 255, 255, 0.25) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Badge alignment for title and chapter cards */
.section-card-header .d-flex,
.chapter-card-header .d-flex {
    align-items: center !important;
}

.section-card-header .badge,
.chapter-card .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
    padding: 0.375rem 0.65rem;
    margin-right: 5px;
}

/* Chevron positioning - 5px from right edge */
.section-card-header {
    padding-right: 5px !important;
}

.chapter-card-header {
    padding-right: 5px !important;
}

.section-card .card {
    border-radius: 0.375rem !important;
}

.section-card {
    border-radius: 0.375rem !important;
    transition: all 0.2s ease;
    cursor: pointer;
}

a[data-section-toggle-link] {
    display: block;
    color: inherit;
}

a[data-section-toggle-link]:hover .section-card {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

/* Responsive Grid Layout */
@media (min-width: 998px) {
    .col-xl-2dot4 {
        flex: 0 0 auto;
        width: 20%;
    }
}

@media (min-width: 768px) and (max-width: 997px) {
    .col-xl-2dot4 {
        flex: 0 0 auto;
        width: 25%;
    }
}

/* Expanding Card System */
.section-collapse {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.section-card.expanded .section-collapse {
    max-height: 2000px;
}

.section-chevron {
    transition: transform 0.3s ease;
}

.section-card.expanded .section-chevron {
    transform: rotate(135deg); /* Match chevron-arrow expanded state - points down */
}

/* Custom Badge Colors */
.badge-perf {
    background-color: #3477b2;
    color: white;
}

.badge-com {
    background-color: #495057;
    color: white;
}

.badge-int {
    background-color: #495057;
    color: white;
}

.badge-fs {
    background-color: #657281;
    color: white;
}

.badge-perf-h-amen {
    background-color: #3477b2;
    color: white;
}

/* Overflow handling utilities */
.prewrap, .wrap-long {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Lazy Loading Animation */
.lazy-load {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lazy-load.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Title Card layout - prevent collapsed cards from stretching */
.row.g-3 {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start; /* Prevent cards from stretching to match tallest card */
}

.title-card-col {
    display: flex;
}

.title-card-col .card {
    width: 100%;
    display: flex;
    flex-direction: column;
}

.title-card-col .card-header {
    align-items: center;
}

/* Remove default flex: 1 from card-body */
/* Only apply when collapse is shown (expanded state) */
.title-card-col .collapse.show .card-body {
    flex: 1;
}

/* Title Card text styling - ONLY for Level 1 */
/* Center the title text horizontally */
.title-card-col .section-card-header .flex-grow-1 h6 {
    text-align: center;
}

/* Uniform header height for Level 1 Title Cards - Desktop */
.title-card-col .section-card-header {
    height: 80px;
}

/* ========== SCROLLABLE CARDS - ALL SCREEN SIZES ========== */
/* Make expanded card bodies scrollable with sticky headers */

/* Title Card - when expanded, make body scrollable */
.title-card-col .card .collapse.show {
    max-height: 70vh; /* Limit height to 70% of viewport */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Chapter Card - when expanded, make body scrollable */
.chapter-card .collapse.show {
    max-height: 60vh; /* Limit height to 60% of viewport */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Add subtle shadow to sticky headers when scrolling */
.section-card-header.scrolled,
.chapter-card-header.scrolled {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Smooth scrollbar styling for webkit browsers */
.collapse.show::-webkit-scrollbar {
    width: 6px;
}

.collapse.show::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.collapse.show::-webkit-scrollbar-thumb {
    background: rgba(8, 5, 48, 0.3);
    border-radius: 3px;
}

.collapse.show::-webkit-scrollbar-thumb:hover {
    background: rgba(8, 5, 48, 0.5);
}

/* ========== MOBILE-SPECIFIC ADJUSTMENTS ========== */
@media (max-width: 767px) {
    /* Ensure proper spacing in scrollable areas on mobile */
    .title-card-col .card-body,
    .chapter-card .card-body {
        padding: 10px;
    }
}
