html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Gold accent on the footer to match the header (both modes). */
footer.footer, .footer {
    border-top: 2px solid #C8860A !important;
}

/* ═══════════════════════════════════════════════════════════
   LIGHT-MODE NAVBAR — fairgrounds identity (cream + gold + brown).
   The dark-mode block below overrides this when the OS is dark.
   ═══════════════════════════════════════════════════════════ */
.navbar.bg-white,
.navbar-light.bg-white {
    background: #FDF6E3 !important;
    border-bottom: 3px solid #C8860A !important;
    box-shadow: 0 2px 8px rgba(92, 58, 30, .12) !important;
}
.navbar-brand,
.navbar-light .navbar-brand {
    color: #5C3A1E !important;
    font-weight: 700;
    letter-spacing: .02em;
}
.nav-link.text-dark,
.navbar-light .nav-link { color: #3d2410 !important; font-weight: 600; }
.nav-link.text-dark:hover,
.navbar-light .nav-link:hover {
    color: #9a5e0a !important;
    background: rgba(200, 134, 10, .12);
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   SHARED PAGE HEADER (info pages: Contact, Calendar, Location,
   Facebook, Livestock Registration/Contact/Closed). One centered
   brown banner with a subtle pattern, gold pill badge (or eyebrow),
   title and subtitle. Consolidated here so it's edited in one place.
   ═══════════════════════════════════════════════════════════ */
.page-header {
    background: linear-gradient(135deg, #3B2007 0%, #5C3A1E 40%, #7A4F2A 100%);
    padding: 2.5rem 1.5rem;
    margin: 1.5rem -15px 1.5rem;
    position: relative;
    overflow: hidden;
    text-align: center;
}
.page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.06;
    background-image:
        repeating-linear-gradient(45deg, #fff 0, #fff 1px, transparent 0, transparent 50%),
        repeating-linear-gradient(-45deg, #fff 0, #fff 1px, transparent 0, transparent 50%);
    background-size: 30px 30px;
}
.page-header-inner { position: relative; z-index: 1; }
.page-badge {
    display: inline-block;
    background: var(--fair-gold, #C8860A);
    color: #fff;
    font-family: 'Georgia', serif;
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 0.3rem 1rem;
    border-radius: 2px;
    margin-bottom: 1rem;
}
.page-eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--fair-gold-light, #F5C842);
    margin-bottom: 0.4rem;
}
.page-header h1 {
    font-family: 'Georgia', serif;
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 700;
    color: #FDF6E3;
    margin: 0 0 0.5rem;
    text-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.page-header p {
    color: rgba(253,246,227,0.72);
    font-family: 'Georgia', serif;
    font-style: italic;
    font-size: 0.95rem;
    margin: 0;
}
@media (max-width: 576px) {
    .page-header { padding: 1.5rem 1rem; }
    .page-header h1 { font-size: 1.5rem; }
    .page-header p { font-size: 0.82rem; }
}

/* ═══════════════════════════════════════════════════════════
   AUTO DARK MODE — follows OS / browser preference
   Uses the existing fairgrounds brown/gold palette
   ═══════════════════════════════════════════════════════════ */
@media (prefers-color-scheme: dark) {

    html, body {
        background-color: #1c1208 !important;
        color: #f0e6d0 !important;
    }

    /* Navbar — dark-brown fairgrounds identity with a gold accent */
    .navbar.bg-white,
    .navbar-light.bg-white {
        background: linear-gradient(90deg, #241608 0%, #3a2410 50%, #241608 100%) !important;
        border-bottom: 3px solid #C8860A !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, .3) !important;
    }
    .navbar-brand,
    .navbar-light .navbar-brand {
        color: #F5C842 !important;
        font-weight: 700;
        letter-spacing: .02em;
    }
    .nav-link.text-dark,
    .navbar-light .nav-link { color: rgba(240,230,208,.85) !important; }
    .nav-link.text-dark:hover,
    .navbar-light .nav-link:hover {
        color: #F5C842 !important;
        background: rgba(200, 134, 10, .12);
        border-radius: 4px;
    }
    .navbar-toggler { border-color: #6a4a20 !important; }
    .navbar-toggler-icon { filter: invert(1) sepia(1) saturate(2) hue-rotate(5deg); }

    /* Page container */
    .container { background: transparent !important; }

    /* Cards */
    .card {
        background: #241608 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .card-header, .card-footer {
        background: #1c1208 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .card-body { color: #f0e6d0 !important; }

    /* Forms */
    .form-control, .form-select {
        background-color: #120d04 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .form-control:focus, .form-select:focus {
        background-color: #120d04 !important;
        border-color: #C8860A !important;
        box-shadow: 0 0 0 2px rgba(200,134,10,.25) !important;
        color: #f0e6d0 !important;
    }
    .form-control::placeholder { color: #6a5a40 !important; }
    .form-label { color: #c8b89a !important; }
    .form-check-input {
        background-color: #120d04 !important;
        border-color: #4a3010 !important;
    }
    .form-check-input:checked { background-color: #C8860A !important; border-color: #C8860A !important; }
    .form-text { color: #8a7a60 !important; }
    .input-group-text { background: #1c1208 !important; border-color: #4a3010 !important; color: #8a7a60 !important; }

    /* Tables */
    .table { color: #f0e6d0 !important; border-color: #4a3010 !important; }
    .table > :not(caption) > * > * {
        background-color: transparent !important;
        color: #f0e6d0 !important;
        border-color: #4a3010 !important;
    }
    .table-striped > tbody > tr:nth-of-type(odd) > * { background-color: rgba(255,255,255,.03) !important; }
    .table-hover > tbody > tr:hover > * { background-color: rgba(200,134,10,.08) !important; }
    thead, .table-light, .table-light th { background: #1c1208 !important; color: #8a7a60 !important; }

    /* Alerts */
    .alert-danger  { background: rgba(139,32,32,.25) !important; border-color: #5a1010 !important; color: #ffaaaa !important; }
    .alert-success { background: rgba(45,90,39,.25) !important; border-color: #1a5a20 !important; color: #90dd90 !important; }
    .alert-warning { background: rgba(140,100,0,.25) !important; border-color: #5a4000 !important; color: #f5c842 !important; }
    .alert-info    { background: rgba(10,60,100,.25) !important; border-color: #0a3060 !important; color: #80c8ff !important; }

    /* Badges */
    .badge.bg-secondary { background: #3a2a10 !important; color: #c8b89a !important; }
    .badge.bg-light     { background: #3a2a10 !important; color: #f0e6d0 !important; }

    /* Borders & dividers */
    .border, .border-top, .border-bottom, .border-start, .border-end {
        border-color: #4a3010 !important;
    }

    /* Footer */
    footer.footer, .footer {
        border-color: #4a3010 !important;
        color: #6a5a40 !important;
        background: #0f0a04 !important;
    }
    footer a { color: #C8860A !important; }

    /* Text helpers */
    .text-muted  { color: #8a7a60 !important; }
    .text-dark   { color: #f0e6d0 !important; }
    h1, h2, h3, h4, h5, h6 { color: #f0e6d0; }

    /* Modals */
    .modal-content {
        background: #241608 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .modal-header, .modal-footer {
        background: #1c1208 !important;
        border-color: #4a3010 !important;
    }

    /* Dropdowns */
    .dropdown-menu {
        background: #241608 !important;
        border-color: #4a3010 !important;
    }
    .dropdown-item { color: #f0e6d0 !important; }
    .dropdown-item:hover { background: rgba(200,134,10,.15) !important; }

    /* Buttons — keep primary/secondary readable */
    .btn-primary { background: #5C3A1E !important; border-color: #7A4F2A !important; color: #f0e6d0 !important; }
    .btn-primary:hover { background: #7A4F2A !important; border-color: #C8860A !important; color: #F5C842 !important; }
    .btn-secondary { background: #3a2a10 !important; border-color: #4a3a20 !important; color: #c8b89a !important; }
    .btn-outline-secondary { color: #8a7a60 !important; border-color: #4a3010 !important; }
    .btn-outline-secondary:hover { background: rgba(200,134,10,.1) !important; color: #f0e6d0 !important; }

    /* Scrollbar */
    ::-webkit-scrollbar { width: 8px; }
    ::-webkit-scrollbar-track { background: #1c1208; }
    ::-webkit-scrollbar-thumb { background: #4a3010; border-radius: 4px; }
    ::-webkit-scrollbar-thumb:hover { background: #C8860A; }

    /* ── Calendar page ── */
    .calendar-card {
        background: #241608 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid {
        border-color: #4a3010 !important;
    }
    .fc .fc-col-header-cell-cushion,
    .fc .fc-daygrid-day-number { color: #C8860A !important; }
    .fc .fc-daygrid-day { background: #241608 !important; }
    .fc .fc-daygrid-day.fc-day-today { background: #3a1e08 !important; }
    .fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-number { color: #5a4a30 !important; }
    .fc-toolbar-title { color: #f0e6d0 !important; }
    .fc .fc-button-primary { background: #5C3A1E !important; border-color: #7A4F2A !important; color: #f0e6d0 !important; }
    .fc .fc-button-primary:hover { background: #7A4F2A !important; border-color: #C8860A !important; }
    .fc .fc-button-primary.fc-button-active { background: #C8860A !important; border-color: #C8860A !important; }
    .fc-event { border-color: rgba(0,0,0,.3) !important; }
    .admin-notice {
        background: #2a1a04 !important;
        border-color: #5a3810 !important;
        color: #f0e6d0 !important;
    }

    /* ── Home page feature cards ── */
    .feature-card {
        background: #241608 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .feature-card h4 { color: #f0e6d0 !important; }
    .feature-card p { color: #a09070 !important; }
    .feature-card .card-link { color: #C8860A !important; }
    .feature-icon-wrap { background: #3a2010 !important; border-color: #4a3010 !important; }

    /* Announcements section */
    .announce-section {
        background: #2a1a04 !important;
        border-color: #5a3810 !important;
    }
    .announce-section * { color: #f0e6d0; }
    .news-strip { background: #2a1a04 !important; border-color: #4a3010 !important; color: #f0e6d0 !important; }

    /* Admin manage panel / modals */
    .manage-panel { background: #241608 !important; border-color: #4a3010 !important; }
    .modal-body   { background: #241608 !important; color: #f0e6d0 !important; }
    .modal-footer { background: #1c1208 !important; border-color: #4a3010 !important; }
    .modal-content { background: #241608 !important; border-color: #4a3010 !important; }
    .modal-header { background: #5C3A1E !important; }

    /* Home inline form inputs (manage panel) */
    input.form-control, textarea.form-control, select.form-select {
        background: #120d04 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }

    /* Stat row and footer CTA already dark brown — fine as-is */
    /* .btn-toggle / .btn-del tints */
    .btn-toggle-on  { background: #0d2a0c !important; color: #6ddd6d !important; border-color: #1a5a18 !important; }
    .btn-toggle-off { background: #2a2000 !important; color: #f5c842 !important; border-color: #5a4800 !important; }
    .btn-del        { background: #2a0808 !important; color: #ff9999 !important; border-color: #5a1010 !important; }

    /* ── Contact page ── */
    .info-card {
        background: #241608 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .info-card .info-label { color: #C8860A !important; }
    .info-card .info-value { color: #f0e6d0 !important; }
    .info-icon { background: #3a2010 !important; border-color: #4a3010 !important; }
    .form-card {
        background: #241608 !important;
        border-color: #4a3010 !important;
    }
    .form-card .form-card-header { background: #5C3A1E !important; }
    .contact-input, .contact-textarea {
        background: #120d04 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .contact-input::placeholder, .contact-textarea::placeholder { color: #6a5a40 !important; }
    .contact-input:focus, .contact-textarea:focus {
        border-color: #C8860A !important;
        background: #120d04 !important;
    }
    .contact-divider { border-color: #4a3010 !important; }

    /* ── Livestock registration form ── */
    .form-control-fair {
        background: #120d04 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .form-control-fair::placeholder { color: #6a5a40 !important; }
    .form-control-fair:focus { background: #120d04 !important; }
    .form-group label { color: #c8b89a !important; }
    .reg-form-wrap, .reg-card {
        background: #241608 !important;
        border-color: #4a3010 !important;
    }
    .dept-option, .radio-option {
        background: #2a1a08 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }
    .dept-option:hover, .radio-option:hover {
        background: #3a2010 !important;
        border-color: #C8860A !important;
    }
    .dept-option input:checked + label,
    .radio-option.selected {
        background: #3a2010 !important;
        border-color: #C8860A !important;
    }
    .reg-input, .reg-select {
        background: #120d04 !important;
        border-color: #4a3010 !important;
        color: #f0e6d0 !important;
    }

    /* ── Stat pills (Inbox, Livestock Inbox, Submissions, Users) ── */
    .stat-pill { background: #241608 !important; border-color: #4a3010 !important; }
    .stat-pill-value { color: #f0e6d0 !important; }
    .stat-pill-label { color: #8a7a60 !important; }
    .icon-bg-gold   { background: #3a2800 !important; }
    .icon-bg-red    { background: #3a0808 !important; }
    .icon-bg-green  { background: #0a2a0a !important; }
    .icon-bg-blue   { background: #0a1a2a !important; }
    .icon-bg-purple { background: #1a0a2a !important; }

    /* ── Table toolbar, card & search (Inbox, Submissions, Users) ── */
    .table-toolbar { background: #1c1208 !important; border-color: #4a3010 !important; }
    .table-card    { background: #241608 !important; border-color: #4a3010 !important; }
    table.sub-table thead tr { background: #1c1208 !important; border-bottom-color: #4a3010 !important; }
    table.sub-table thead th { color: #8a7a60 !important; }
    table.sub-table tbody tr:hover { background: rgba(200,134,10,.06) !important; }
    table.sub-table tbody tr.unread-row { background: rgba(200,134,10,.04) !important; }
    .search-wrap input { background: #120d04 !important; border-color: #4a3010 !important; color: #f0e6d0 !important; }
    .search-wrap input::placeholder { color: #6a5a40 !important; }
    .filter-select { background: #120d04 !important; border-color: #4a3010 !important; color: #f0e6d0 !important; }

    /* ── User Management page ── */
    .toggle-card { background: #241608 !important; border-color: #4a3010 !important; }
    .toggle-card-label { color: #f0e6d0 !important; }
    .toggle-card-sub   { color: #8a7a60 !important; }
    .create-card { background: #241608 !important; border-color: #4a3010 !important; }
    .fair-input    { background: #120d04 !important; border-color: #4a3010 !important; color: #f0e6d0 !important; }
    .fair-textarea { background: #120d04 !important; border-color: #4a3010 !important; color: #f0e6d0 !important; }
    .fair-input::placeholder, .fair-textarea::placeholder { color: #6a5a40 !important; }
    .fair-label  { color: #c8b89a !important; }
    .btn-demote  { background: #2a1a00 !important; color: #f5c842 !important; border-color: #5a4000 !important; }

    /* ── Section titles (Contact, Home, etc.) ── */
    .section-title { color: #f0e6d0 !important; }
    .section-label { color: #C8860A !important; }

    /* ── Sub-table cell text (Inbox, Submissions, Users) ── */
    table.sub-table td { color: #f0e6d0 !important; }
    table.sub-table td strong { color: #F5C842 !important; }
    table.sub-table tbody tr { border-bottom-color: #4a3010 !important; }
    .msg-cell  { color: #c8b89a !important; }
    .date-text { color: #8a7a60 !important; }

    /* ── Status badges (Inbox) ── */
    .badge-read   { background: #0a2a0a !important; color: #6ddd6d !important; }
    .badge-unread { background: #2a1a00 !important; color: #f5c842 !important; border-color: #5a4000 !important; }

    /* ── Inbox action buttons ── */
    .btn-toggle-read   { background: #0a2a0a !important; color: #6ddd6d !important; border-color: #1a5a18 !important; }
    .btn-toggle-unread { background: #2a1a00 !important; color: #f5c842 !important; border-color: #5a4000 !important; }
    .btn-delete { background: #2a0808 !important; color: #ff9999 !important; border-color: #5a1010 !important; }
    .btn-reply  { background: #0a1a2a !important; color: #80c8ff !important; border-color: #0a3060 !important; }

    /* ── Users action buttons ── */
    .btn-promote { background: #0a2a0a !important; color: #6ddd6d !important; border-color: #1a5a18 !important; }
    .btn-reset   { background: #0a1a2a !important; color: #80c8ff !important; border-color: #0a3060 !important; }

    /* ── Role chips (Users) ── */
    .role-chip           { background: #3a2a10 !important; color: #c8b89a !important; border-color: #4a3010 !important; }
    .role-chip.admin     { background: rgba(200,134,10,.15) !important; color: #F5C842 !important; border-color: rgba(200,134,10,.4) !important; }
    .role-chip.fairhelper { background: #1a0a2a !important; color: #c8a8ff !important; border-color: #4a2a8a !important; }

    /* ── Alert-error (Users) ── */
    .alert-error { background: rgba(139,32,32,.2) !important; color: #ff9999 !important; border-color: #5a1010 !important; }
    .livestock-icon-wrap { background: #2a1a08 !important; }
    .livestock-status { color: #6ddd6d !important; }

    /* ── Announcements text contrast ── */
    .announce-title { color: #F5C842 !important; }
    .announce-body  { color: #f0e6d0 !important; }

    /* ── Host Your Event rental list (Index.cshtml) ── */
    .rental-col p { color: #c8b89a !important; }
    .rental-col ul { color: #f0e6d0 !important; }
    .rental-col li { border-bottom-color: #4a3010 !important; }

    /* ── Livestock registration waiver & signature ── */
    .waiver-box { background: #1c1208 !important; border-color: #4a3010 !important; color: #f0e6d0 !important; }
    .waiver-box strong { color: #C8860A !important; }
    .waiver-agree { color: #c8b89a !important; }
    .sig-pad-actions { background: #1c1208 !important; border-top-color: #4a3010 !important; }
    .sig-hint, .sig-legal { color: #8a7a60 !important; }
    .success-card { background: #1c1208 !important; border-color: #2a5a20 !important; }

    /* ── FairBook admin upload ── */
    .admin-upload-card { background: #1c1208 !important; border-color: #4a3010 !important; border-left-color: #C8860A !important; }
    .no-pdf-box { background: #1c1208 !important; }
}