﻿﻿html {
    height: 100%; /* Ensure the html element takes full height */
    font-size: 87.5%;
    line-height: 1.5; /* BS5 default for looser, readable text */
}

/* Site Banner */
.site-banner {
    background-color: #0e406a;
    color: #fff;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
}

.site-banner .site-banner-icon {
    fill: #ffc107;
    width: 3.5rem;
    height: 3.5rem;
    flex-shrink: 0;
    align-self: center;
}

.site-banner a {
    color: #fff;
    text-decoration: underline;
}

.site-banner a:hover,
.site-banner a:focus {
    color: #cce5ff;
}

/* General */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Minimum height is 100% of viewport height */
    font-family: 'Open Sans', sans-serif;
    color: #0E1A30;
    background-color: #fff;
    font-size: 1rem;
    line-height: 1.5; /* BS5 standard */
}

#main-content { /* Or whatever ID/class wraps your main content (e.g., the <main> or <div class="container"> in _Layout.cshtml) */
    flex: 1 0 auto; /* Allows the main content to grow and fill space */
}

/* Buttons */
.btn {
    font-size: 1rem; /* BS5 default */
    padding: 0.375rem 0.75rem; /* BS5 default */
    margin: .25rem;
}

/* Buttons (orange primary) */
.btn-primary {
    background-color: #9B3431;
    border-color: #9B3431;
    color: #fff;
}

    .btn-primary:hover, .btn-primary:focus, .btn-primary.active {
        background-color: rgb(3, 127, 174);
        border-color: rgb(3, 127, 174);
    }

/* Debug Panels */
.debug-panel-purple {
    border: 1px solid purple;
    padding: 1rem;
    margin: 1rem 0;
    background: #f3e5f5;
}

.debug-panel-red {
    display: none;
    border: 1px solid red;
    padding: 1rem;
    margin: 1rem 0;
    background: #ffebee;
}

.debug-panel-blue {
    border: 1px solid blue;
    padding: 0.5rem;
    margin-bottom: 1rem;
    background: #e0f7fa;
}

.debug-info {
    font-style: italic;
    color: #555;
}

/* Map Container */
.map-container {
    display: block;
    min-height: 500px;
    border: 1px solid #ccc;
}

.map-inner {
    width: 100%;
    height: 500px;
}

/* Print Styles (example extension for noprint class) */
@media print {
    .noprint {
        display: none !important;
    }
}

/* Dark blue for section titles (matches your previous #0e406a) */
.card-header,
h3 { /* Or target specifically, e.g., .search-criteria h2 */
    background-color: #0e406a !important;
    color: white;
}

/* Force the browser scrollbar to appear when content is wider than viewport */
html {
    overflow-x: scroll !important; /* Always show horizontal scrollbar when needed */
}


/* Responsive table stacking for smaller screens - UPDATED FOR VERTICAL LABEL/VALUE STACKING */
@media (max-width: 999px) {
    .responsive-table thead {
        /* Visually hidden but accessible to screen readers */
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .responsive-table tbody tr {
        display: block; /* Each row becomes a block/card */
        margin-bottom: 1.5rem; /* Space between cards */
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        padding: .5rem;
        background-color: #fff;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }

    .responsive-table td {
        display: block; /* Full vertical stacking */
        text-align: left;
        border: none;
        padding: 0.5rem 0; /* Increased vertical padding for separation */
        border-bottom: 1px solid #eee; /* Lighter separator */
        line-height: 1.2; /* Tighter line spacing for text content to reduce space between rows */
    }

        .responsive-table td:empty {
            display: none; /* Hide entire field (label and value) if value is empty */
        }

        .responsive-table td:last-child {
            border-bottom: none;
        }

        .responsive-table td::before {
            content: attr(data-label) ": ";
            font-weight: bold;
            display: block; /* Label on its own line */
            margin-bottom: 0.1rem; /* Space between label and value */
            color: #333; /* Slightly darker for emphasis */
            line-height: 1.2; /* Tighter line height for labels */
            white-space: normal; /* Allow labels to wrap naturally if very long */
        }
        /* Preserve inner HTML rendering (br, links, etc.) in values */
        .responsive-table td br {
            content: ""; /* Reset if needed, but <br> works fine */
        }

        .responsive-table td a {
            color: #007bff; /* Bootstrap link color */
            text-decoration: underline;
        }
}
/* Desktop/tablet horizontal view remains unchanged */
.responsive-table {
    table-layout: fixed;
}

    .responsive-table th,
    .responsive-table td {
        word-wrap: break-word;
        hyphens: auto;
    }


@media print {
    body {
        margin: 0; /* Remove any body margins for clean print */
        padding: 0;
        width: 100% !important;
    }

    .official-banner, footer, .header, .noprint, #font-size-slider, .card-header:not(.table-card-header) {
        display: none !important; /* Hide global header, footer, sliders, non-table cards */
    }

    .container {
        max-width: none !important; /* Remove Bootstrap container limits */
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #printable-table {
        display: block !important; /* Ensure only the table container shows */
        page-break-inside: avoid; /* Prevent table breaking across pages */
        page-break-before: avoid; /* Avoid break before table to prevent blank page */
        margin: 0 !important;
        padding: 0 !important;
        position: relative;
        top: 0;
    }

        #printable-table .table {
            width: 100%; /* Full width for print */
            font-size: 8pt !important; /* Slightly smaller font to fit more */
            border-collapse: collapse; /* Clean borders */
            table-layout: auto; /* Let content determine widths for better fit */
        }

        #printable-table thead {
            display: table-header-group; /* Ensure headers repeat on multi-page prints */
        }

        #printable-table th, #printable-table td {
            border: 1px solid #000; /* Visible borders for print */
            padding: 0.2rem !important; /* Reduced padding to save space */
            word-wrap: break-word;
            overflow-wrap: break-word;
            hyphens: auto; /* Allow hyphenation for better wrapping */
        }

    /* Hide any debug or extra elements */
    .debug-panel-red {
        display: none !important;
    }

    /* Force horizontal table layout for print (override responsive stacking) */
    .responsive-table {
        display: table !important; /* Ensure table behaves as table */
        width: 100% !important;
        table-layout: auto !important; /* Auto for content-based widths */
    }

        .responsive-table thead {
            display: table-header-group !important; /* Show headers */
        }

        .responsive-table tbody tr {
            display: table-row !important; /* Rows as horizontal */
            margin-bottom: 0 !important;
            border: none !important;
            padding: 0 !important;
            background: none !important;
            box-shadow: none !important;
        }

        .responsive-table td {
            display: table-cell !important; /* Cells side-by-side */
            position: static !important; /* Remove relative positioning */
            padding: 0.2rem !important; /* Reduced padding */
            border: 1px solid #000 !important; /* Borders for print */
            text-align: left !important;
            line-height: 1.1 !important; /* Tighter lines for more content */
        }

            .responsive-table td::before {
                display: none !important; /* Hide data-label pseudo-elements */
            }

            .responsive-table td br {
                content: normal !important; /* Preserve <br> if needed */
            }

    .table-responsive {
        overflow: visible !important; /* Prevent clipping in print */
        width: 100% !important;
        margin: 0 !important;
    }

    @page {
        /* size: landscape; */ /* Uncomment if always wide; otherwise let user/browser decide */
        margin: 0.635cm; /* Safe 0.25-inch equivalent all around */
    }
}

body.wide-table #printable-table .table {
    font-size: 6pt !important; /* Extra small for wide tables */
}


.loading-overlay {
    display: none; /* Use JS to toggle visibility */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black */
    z-index: 1050; /* Above Bootstrap modals */
    align-items: center;
    justify-content: center;
}

    .loading-overlay.active {
        display: flex;
    }

.spinner-border.large {
    width: 3rem;
    height: 3rem;
}

/* Accessibility: Focus-visible styles for interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="combobox"]:focus-visible,
.form-range:focus-visible {
    outline: 3px solid #0d6efd;
    outline-offset: 2px;
}

.selectize-input:focus-within {
    outline: 3px solid #0d6efd;
    outline-offset: 2px;
}

/* Fieldset/legend styling to match card appearance */
fieldset.card {
    border: none;
    padding: 0;
    margin: 0;
    min-inline-size: auto;
}

fieldset.card > legend.card-header {
    float: none;
    width: 100%;
    padding: 0.5rem 1rem;
    margin-bottom: 0;
    font-size: inherit;
}