/* ========================================
   CSS VARIABLES - CBI Government Style
   ======================================== */
:root {
    --primary: #024D90;
    --primary-dark: #061B59;
    --primary-light: #1a6bb5;
    --nav-bg: #1e5d99;
    --nav-bg-dark: #0a3a6e;
    --link-color: #4A7CAC;
    --heading-color: #024D90;
    --text-dark: #333333;
    --text-body: #3F3F3F;
    --text-light: #666666;
    --text-muted: #757B7F;
    --bg-page: #f0f0f0;
    --bg-white: #ffffff;
    --bg-light: #f8f8f8;
    --border: #d7d7d7;
    --border-light: #e4e4e4;
    --accent: #024D90;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --max-width: 980px;
    --content-width: 800px;
}

/* ========================================
   RESET & BASE
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-body);
    background-color: var(--bg-page);
}

a {
    color: var(--link-color);
    text-decoration: underline;
}

a:hover {
    color: var(--primary);
    text-decoration: none;
}

.content-section img {
    display: block;
    max-width: 75%;
    margin: 20px auto;
    height: auto;
}

/* ========================================
   LAYOUT
   ======================================== */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.container-narrow {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* ========================================
   HEADER - Two-tier CBI Style
   ======================================== */
.header {
    background-color: var(--bg-white);
    border-bottom: none;
    padding: 0;
}

/* Top bar: logo left, utility links right */
.header-top {
    background-color: var(--bg-white);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-light);
}

.header-top-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo:hover {
    text-decoration: none;
    opacity: 0.85;
}

.logo img {
    height: 40px;
    width: auto;
}

.header-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.header-links a {
    color: var(--link-color);
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s;
}

.header-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Navigation bar: blue bar below header top */
.header-nav {
    background: linear-gradient(to bottom, #2a6faa, #1a5080);
    border-bottom: 3px solid var(--primary-dark);
}

.nav {
    display: flex;
    gap: 0;
}

.nav a {
    padding: 10px 20px;
    color: #ececec;
    font-weight: 400;
    font-size: 15px;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.nav a:first-child {
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.nav a:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    text-decoration: none;
}

.nav a.active {
    background-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 26px;
    cursor: pointer;
    padding: 8px 12px;
    color: var(--bg-white);
    line-height: 1;
}

.header-nav .container {
    position: relative;
}

/* ========================================
   BREADCRUMBS
   ======================================== */
.breadcrumbs {
    padding: 12px 0;
    font-size: 14px;
    color: var(--text-light);
    background-color: transparent;
    border-bottom: none;
}

.breadcrumbs a {
    color: var(--link-color);
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs span {
    margin: 0 8px;
    color: var(--text-light);
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main {
    padding: 20px 0 40px;
    background-color: var(--bg-page);
}

.content-section {
    background-color: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.content-section h1 {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 1.8em;
    font-weight: 600;
    color: var(--heading-color);
    margin-bottom: 20px;
    line-height: 1.3;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 12px;
}

.content-section h2 {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 1.35em;
    font-weight: 600;
    color: var(--heading-color);
    margin: 25px 0 15px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}

.content-section h2:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.content-section h3 {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 1.15em;
    font-weight: 600;
    color: var(--text-dark);
    margin: 20px 0 10px;
}

.content-section p {
    margin-bottom: 15px;
    color: var(--text-body);
    line-height: 1.6;
}

.content-section p:last-child {
    margin-bottom: 0;
}

.content-section ul {
    margin: 10px 0 15px 25px;
}

.content-section ul li {
    margin-bottom: 6px;
    line-height: 1.5;
}

/* ========================================
   STATS BOX
   ======================================== */
.stats-box {
    background-color: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 25px 30px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.stats-box h3 {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 1.15em;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--heading-color);
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background-color: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 6px;
}

.stat-number {
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 1.8em;
    font-weight: 600;
    color: var(--primary);
    display: block;
}

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ========================================
   INFO TABLE
   ======================================== */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.info-table th,
.info-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.info-table th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
    width: 40%;
}

.info-table td {
    color: var(--text-body);
}

.info-table tr:last-child th,
.info-table tr:last-child td {
    border-bottom: none;
}

/* ========================================
   LINK GRID (Counties, Cities)
   ======================================== */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.link-card {
    background-color: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 15px;
    text-align: left;
    text-decoration: none;
    transition: background-color 0.2s, border-color 0.2s;
}

.link-card:hover {
    text-decoration: none;
    background-color: var(--bg-light);
    border-color: var(--primary);
}

.link-card::before {
    content: none;
}

.link-card-title {
    font-weight: 400;
    color: var(--link-color);
    font-size: 15px;
}

.link-card:hover .link-card-title {
    color: var(--primary);
    text-decoration: underline;
}

/* Compact grid for large lists */
.link-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.link-grid-compact .link-card {
    padding: 10px 12px;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    border-radius: 5px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background-color 0.2s;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(to bottom, #2a6faa, #1a5080);
    color: var(--bg-white);
}

.btn-primary:hover {
    background: linear-gradient(to bottom, #1a5080, #2a6faa);
    color: var(--bg-white);
}

.btn-secondary {
    background: linear-gradient(to bottom, #bfc5c9, #919598);
    color: var(--bg-white);
    border: none;
}

.btn-secondary:hover {
    background: linear-gradient(to bottom, #919598, #bfc5c9);
    color: var(--bg-white);
}

.btn-block {
    display: block;
    width: 100%;
}

/* ========================================
   FOOTER - CBI Centered Style
   ======================================== */
.footer {
    background-color: var(--bg-white);
    border-top: 3px solid var(--primary);
    padding: 25px 0;
    margin-top: 0;
    text-align: center;
}

.footer-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 15px;
}

.footer-nav a {
    color: var(--link-color);
    font-size: 14px;
    text-decoration: none;
    padding: 0 10px;
}

.footer-nav a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.footer-nav .sep {
    color: var(--text-muted);
    font-size: 14px;
}

/* Legacy footer-inner support */
.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    flex-wrap: wrap;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--link-color);
    font-size: 14px;
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.footer-links a:not(:last-child)::after {
    content: " |";
    color: var(--text-muted);
    margin-left: 8px;
}

.footer-disclaimer {
    max-width: 700px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: center;
    margin: 10px auto 0;
}

.footer-copyright {
    width: 100%;
    text-align: center;
    padding-top: 15px;
    margin-top: 10px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================
   SEARCH FORM COMPONENT
   ======================================== */
.search-form {
    max-width: 500px;
    margin: 0 auto;
}

.search-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.search-form-row.stacked {
    flex-direction: column;
}

.search-form input[type="text"],
.search-form select {
    flex: 1;
    padding: 10px 12px;
    font-size: 15px;
    font-family: 'Open Sans', Arial, sans-serif;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: var(--bg-white);
}

.search-form input[type="text"]:focus,
.search-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 3px rgba(2, 77, 144, 0.3);
}

.search-form button {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Open Sans', Arial, sans-serif;
    background: linear-gradient(to bottom, #2a6faa, #1a5080);
    color: var(--bg-white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-form button:hover {
    background: linear-gradient(to bottom, #1a5080, #2a6faa);
}

/* Sidebar version */
.search-form-sidebar {
    max-width: 300px;
}

.search-form-sidebar .search-form-row {
    flex-direction: column;
}

/* ========================================
   SEARCH WIDGET (JS Generated - Horizontal)
   ======================================== */
.search-widget {
    width: 100%;
}

.search-widget .search-form {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.search-widget .search-input,
.search-widget .search-select,
.search-widget .search-button {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    font-family: 'Open Sans', Arial, sans-serif;
    border: 1px solid var(--border);
    border-radius: 4px;
    background-color: var(--bg-white);
    box-sizing: border-box;
}

.search-widget .search-button {
    background: linear-gradient(to bottom, #2a6faa, #1a5080);
    color: var(--bg-white);
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.search-widget .search-input:focus,
.search-widget .search-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 3px rgba(2, 77, 144, 0.3);
}

.search-widget .search-button:hover {
    background: linear-gradient(to bottom, #1a5080, #2a6faa);
}

/* Search Embed Box */
.search-embed {
    background-color: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 25px;
    padding-bottom: 65px;
    margin: 20px 0;
    position: relative;
}

.search-embed h3 {
    font-family: 'Open Sans', Arial, sans-serif;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.15em;
    font-weight: 600;
    color: var(--heading-color);
}

/* Sponsored Results - Light gray, bottom left corner */
.search-embed p.search-form-note {
    position: absolute;
    left: 25px;
    bottom: 12px;
    font-size: 13px;
    color: #ccc;
    margin: 0;
}

/* ========================================
   UTILITIES
   ======================================== */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-30 {
    margin-bottom: 30px;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .header-top-inner {
        flex-direction: row;
        text-align: left;
        gap: 10px;
    }

    .header-links {
        display: none;
    }

    .nav-toggle {
        display: block;
    }

    .nav {
        display: none;
        flex-direction: column;
        width: 100%;
        background: linear-gradient(to bottom, #2a6faa, #1a5080);
    }

    .nav.open {
        display: flex;
    }

    .nav a {
        padding: 12px 20px;
        font-size: 15px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        width: 100%;
    }

    .nav a:first-child {
        border-left: none;
    }

    .nav a:last-child {
        border-bottom: none;
    }

    .content-section {
        padding: 20px;
        border-radius: 6px;
    }

    .content-section h1 {
        font-size: 1.5em;
    }

    .content-section h2 {
        font-size: 1.2em;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }

    .footer-disclaimer {
        text-align: center;
    }

    .search-form-row {
        flex-direction: column;
    }

    .link-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-box {
        padding: 20px;
        border-radius: 6px;
    }
}

/* Mobile - Search Widget Stacks Vertically */
@media (max-width: 700px) {
    .search-widget .search-form {
        grid-template-columns: 1fr;
    }

    .search-embed {
        padding: 20px 15px;
        padding-bottom: 45px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 15px;
    }

    .container {
        padding: 0 15px;
    }

    .logo img {
        height: 32px;
    }

    .content-section {
        padding: 15px;
        margin-bottom: 15px;
    }

    .content-section h1 {
        font-size: 1.3em;
    }

    .link-grid {
        grid-template-columns: 1fr;
    }

    .link-grid-compact {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-table th,
    .info-table td {
        padding: 10px;
        font-size: 14px;
    }

    .info-table th {
        width: 45%;
    }
}
