/* --- Base Styles --- */
    body {
        background-color: var(--bs-dark); /* Use Bootstrap's variable for dark background */
        color: var(--bs-light); /* Default text color for dark background */
        position: relative; /* Needed if using absolute positioning relative to body */
        min-height: 100vh; /* Ensure body takes at least full height */
    }

    /* --- Settings Icon --- */
    #settings-icon {
        position: fixed; /* Position relative to the viewport */
        top: 1rem;         /* Distance from the top edge of the viewport */
        right: 1rem;       /* Distance from the right edge of the viewport */
        font-size: 1.5rem;
        color: #adb5bd; /* Lighter grey for better visibility on dark background */
        cursor: pointer;
        z-index: 1100; /* Ensure it's above most other content, including modals */
    }
    #settings-icon:hover {
        color: #fff; /* White on hover */
    }

    .main-content-container {
        background-color: #fff; /* White background for the main box */
        color: #000; /* Black text inside the main box */
        padding: 1rem;
        border-radius: var(--bs-border-radius);
        /* Removed position: relative; as it's no longer needed for the icon */
        display: flex;
        flex-direction: column;
        margin-bottom: 2rem; /* Add some space at the bottom */
        margin-top: 1rem; /* Add some space below the header/icon */
    }

    /* --- Utility Class --- */
    .hidden {
        display: none !important; /* To hide the chapel section */
    }

    /* --- Tab Styles --- */
    .nav-tabs {
        border-top: 1px solid #dee2e6;
        border-bottom: none;
        justify-content: start;
        order: 2; /* Order after tab content */
    }
    .nav-tabs .nav-link {
        border-bottom: 2px solid transparent;
        border-radius: 0;
        color: #000;
        border-top: none;
        border-left: none;
        border-right: none;
    }
    .nav-tabs .nav-link.active {
        border-top: 1px solid #dee2e6;
        border-left: 1px solid #dee2e6;
        border-right: 1px solid #dee2e6;
        border-bottom: 2px solid #000;
        background-color: #fff;
        color: #000;
    }
    .nav-tabs .nav-link:not(.active) {
        background-color: transparent;
        border-color: transparent;
    }
    .tab-content {
        order: 1; /* Order before tabs */
        min-height: 150px;
    }

    /* --- Thick HR Separator --- */
    .thick-hr {
        border-color: #a9a9a9 !important;
        border-width: 5px !important;
        opacity: 1;
        order: 3; /* After tabs */
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }

    /* --- Chapel Toggle & Container Styles --- */
    #chapel-section-wrapper {
         order: 4; /* After HR */
         width: 100%; /* Take full width */
         display: flex; /* Use flex for centering the inner wrapper */
         flex-direction: column;
         align-items: center; /* Center the toggle-wrapper */
    }

    #chapel-toggle-wrapper {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%; /* Allow inner elements to size */
    }

    #chapel-toggle-button {
        width: 30px;
        height: 15px;
        background-color: black;
        clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
        cursor: pointer;
        margin-bottom: 10px;
        transition: transform 0.3s ease;
        flex-shrink: 0;
    }
    #chapel-toggle-button.expanded {
        transform: rotate(180deg);
    }

    #chapel-container {
        width: 95%;
        max-width: 95%;
        max-height: 0;
        overflow-y: auto; /* Allow scrolling if content overflows */
        opacity: 0;
        border: none;
        box-shadow: none;
        margin: 0 auto;
        padding-top: 0;
        padding-bottom: 0;
        transition: max-height 0.5s ease-out, opacity 0.5s ease-out, padding 0.5s ease-out;
        background-color: inherit; /* Inherit from main container */
        border-radius: 8px;
    }
    #chapel-container.expanded {
        max-height: 400px; /* Adjust as needed */
        opacity: 1;
        margin-top: 10px; /* Add space when expanded */
        padding: 5px; /* Add a little padding around the cards */
        transition: max-height 0.5s ease-in, opacity 0.5s ease-in, padding 0.5s ease-in;
    }
    
    /* --- Chapel Card Styles --- */
    .chapel-card {
        background-color: #f8f9fa; /* A very light grey */
        border: 1px solid #dee2e6; /* A subtle border */
        color: #212529; /* Dark text for readability */
    }

    .chapel-card .card-title {
        font-weight: 500;
        color: #000;
    }

    .chapel-card .card-subtitle {
        font-size: 0.9rem;
    }


    /* Adjust modal z-index if needed to be below the fixed settings icon */
    .modal {
        z-index: 1055; /* Default is 1055 for modal, 1060 for backdrop */
    }

    /* ---- Disclaimers ---- */
    .disclaimer {
        font-size: 0.75rem;   /* adjust as you like: 0.75 rem ≈ 12 px */
        line-height: 1.2;
    }

    .toggle-desc i {
        vertical-align: middle;
        transition: transform .2s;
      }

    /* Response Box Styling and Animation */
    .station-response-box {
    overflow: hidden; /* Necessary for height transition */
    max-height: 0; /* Start collapsed */
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0; /* Start with no top margin */
    border: none; /* Start with no border */
    background-color: #e9ecef; /* Light background for contrast */
    border-radius: 0.25rem;
    transition: max-height 0.5s ease-in-out, 
                padding-top 0.5s ease-in-out, 
                padding-bottom 0.5s ease-in-out,
                margin-top 0.5s ease-in-out,
                border 0.3s linear;
    color: #333; /* Darker text */
    }

    .station-response-box.visible {
    max-height: 500px; /* Allow expansion up to 500px (adjust if needed) */
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-top: 0.5rem; /* Add space above when visible */
    border: 1px solid #ced4da; /* Add border when visible */
    }

    /* Optional: Loading spinner */
    .station-response-box .spinner-border-sm {
        width: 1rem;
        height: 1rem;
        border-width: .2em;
        vertical-align: -0.125em; /* Align better with text */
    }

    /* Ensure buttons are hidden/shown with chapel toggle correctly */
    .d-none { 
    display: none !important; /* Ensure Bootstrap's d-none works */
    } 

    /* Response Box Styling and Animation */
    .station-response-box {
        overflow: hidden; 
        max-height: 0; 
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 0.75rem; /* Added some horizontal padding */
        padding-right: 0.75rem; /* Added some horizontal padding */
        margin-top: 0; 
        border: none; /* Start with no border */
        background-color: #e9ecef; 
        border-radius: 0.25rem;
        transition: max-height 0.5s ease-in-out, 
                    padding-top 0.5s ease-in-out, 
                    padding-bottom 0.5s ease-in-out,
                    margin-top 0.5s ease-in-out,
                    border 0.3s linear;
        color: #333; 
        white-space: pre-wrap; /* <<< THIS HANDLES NEWLINES */
    }
    
    .station-response-box.visible {
        max-height: 500px; 
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        margin-top: 0.5rem; 
        border: 1px solid #ced4da; /* <<< THIS ADDS THE OUTLINE/BORDER */
    }
    
    /* Ensure buttons are hidden/shown with chapel toggle correctly */
    .d-none { 
        display: none !important; 
    } 
    
    /* Ensure buttons are hidden/shown with chapel toggle correctly */
    .d-none { 
        display: none !important; /* Ensure Bootstrap's d-none works */
    }