:root {
    --bg-dark: #121612;
    /* Very Dark Brown-Green */
    --bg-card: rgba(30, 36, 30, 0.75);
    /* Glass */
    --text-primary: #f2f0e9;
    /* Warm Cream */
    --text-secondary: #a8a29e;
    /* Warm Stone */
    --accent: #d97706;
    /* Amber/Golden */
    --accent-glow: rgba(217, 119, 6, 0.4);
    --border: rgba(168, 162, 158, 0.15);
    /* Stone */
    --radius: 16px;
    --font-main: 'Inter', sans-serif;

    /* Standardization Vars (Directive Compliance) */
    --brand-color: #d97706;
    /* Mapping accent */
    --text-main: #f2f0e9;
    /* Mapping text-primary */
    --bg-light: #1e293b;
    /* Mapping bg-surface (card bg/lighter dark) */
    --max-width: 1200px;
    --border-radius: 16px;
    --table-stripe: rgba(255, 255, 255, 0.03);

    /* Existing Refs */
    --text-muted: #94a3b8;
    --bg-input: #0f172a;
    --bg-surface: #1e293b;
    --color-error: #ef4444;
    --border-subtle: #334155;
}

/* --- Master Classes (Directive Compliance) --- */

/* .btn-primary is already defined below, ensuring it uses vars */

/* .form-control (Unified Input) */
.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 8px;
    /* Or var(--border-radius) / 2 for inputs */
    outline: none;
    transition: all 0.2s;
    font-family: var(--font-main);
    width: 100%;
    box-sizing: border-box;
    /* Fixes padding overflow */
    /* Default to full width in containers usually */
}

.form-control:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Alias .input-field to .form-control for backward compatibility if needed, 
   but directive says "Update tags to use new Master Classes". */
.input-field {
    /* Extending form-control logic or just inheriting */
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 10px 16px;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s;
    font-family: var(--font-main);
}

.input-field:focus {
    border-color: var(--brand-color);
}


/* .data-table (Striped, Padding) */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: rgba(25, 30, 25, 0.9);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

.data-table tr:hover {
    background: var(--table-stripe);
}

/* Striping logic if desired, though hover is usually enough for dark mode. 
   Adding nth-child for strict 'stripe' requirement if needed. */
.data-table tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.01);
}

/* --- Utilities --- */
.text-muted {
    color: var(--text-muted) !important;
}

.w-full {
    width: 100%;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Standardized Components --- */

/* Primary Button (Gradient Amber) */
.btn-primary {
    background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.4);
    transition: all 0.2s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* Standard Input Field (Dark/Glassy) */
.input-field {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s;
    font-family: var(--font-main);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    /* Subtle Earthy overlaid gradients */
    background-image:
        radial-gradient(at 0% 0%, rgba(87, 83, 78, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(65, 84, 65, 0.2) 0px, transparent 50%);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* --- Hero Section --- */
.hero-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 40px;
    background: radial-gradient(circle at center, rgba(30, 36, 30, 0) 0%, var(--bg-dark) 100%);
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    text-align: center;
    /* Earthy Gold Gradient */
    background: linear-gradient(135deg, #fcd34d 0%, #d97706 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
    filter: drop-shadow(0 0 20px rgba(217, 119, 6, 0.2));
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 40px;
    font-weight: 400;
}

/* --- Search Box --- */
.search-wrapper {
    width: 100%;
    max-width: 450px;
    position: relative;
    margin-bottom: 30px;
}

.search-input-group {
    display: flex;
    gap: 12px;
    background: rgba(30, 36, 30, 0.8);
    padding: 8px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
}

.search-input-group:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow), 0 8px 30px rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

#searchInput {
    flex: 1;
    background: transparent;
    border: none;
    padding: 16px 24px;
    color: var(--text-primary);
    font-size: 1.2rem;
    outline: none;
    font-family: var(--font-main);
}

#searchBtn {
    /* Rich Amber Gradient */
    background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    color: #fff;
    border: none;
    padding: 0 32px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.4);
    transition: all 0.2s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#searchBtn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

#searchBtn:active {
    transform: translateY(1px);
}

/* --- Links --- */
.quick-links {
    margin-bottom: 30px;
    margin-top: 40px;
    display: flex;
    gap: 20px;
}

.quick-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 20px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.quick-links a:hover {
    color: var(--accent);
    background: rgba(217, 119, 6, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    transform: translateY(-1px);
}


/* --- Filters --- */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    justify-content: center;
    align-items: center;
    max-width: 900px;
    margin: 32px auto 0;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* --- Advanced Form Layout --- */
/* --- Advanced Form Layout --- */
.advanced-form {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 30px;
    align-items: flex-start;
    /* Align tops (labels) so variable heights don't stagger them */
}

.advanced-form .full-width {
    flex: 1 1 100%;
    width: 100%;
    margin-bottom: 12px;
}

.advanced-form .form-group {
    flex: 0 0 200px;
    /* Fixed width, forces wrap, prevents overlap */
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.advanced-form .form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* Specific button layout for advanced search */
.search-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
    padding-top: 24px;
}


.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Form Elements */
select {
    background: rgba(20, 24, 20, 0.9);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-family: var(--font-main);
    transition: border-color 0.2s;
}

select:hover,
select:focus {
    border-color: var(--accent);
}

/* Radio Tiles */
.radio-tile-group {
    display: flex;
    gap: 8px;
}

.radio-tile-group label {
    cursor: pointer;
    position: relative;
}

.radio-tile-group input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-tile {
    display: block;
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.radio-tile-group input:checked+.radio-tile {
    background: rgba(217, 119, 6, 0.15);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* --- Results Area --- */
.results-section {
    flex: 1;
    width: 100%;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(20, 24, 20, 0.4);
}

.results-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    /* Center the container */
}

/* --- Table Styles --- */
.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th {
    background: rgba(25, 30, 25, 0.9);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.results-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

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

.results-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.results-table a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.results-table a:hover {
    text-decoration: underline;
    text-shadow: 0 0 8px var(--accent-glow);
}

/* --- Cards (Detail View) --- */
.license-card {
    background: linear-gradient(180deg, rgba(30, 36, 30, 0.9) 0%, rgba(18, 22, 18, 0.95) 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 32px;
    margin: 0 auto;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

.license-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.5;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.card-header h2 {
    margin: 0;
    font-size: 2rem;
    color: var(--text-primary);
    text-shadow: 0 0 15px var(--accent-glow);
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.A {
    background: rgba(34, 197, 94, 0.15);
    /* Green stays Green (Active) */
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge.E {
    background: rgba(234, 179, 8, 0.15);
    /* Yellow stays Yellow (Expired) */
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.badge.C {
    background: rgba(239, 68, 68, 0.15);
    /* Red stays Red (Canceled) */
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Keep logic consistent colors */

/* Address Block */
.address-block {
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--text-secondary);
    margin: 10px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #d6d3d1;
    /* Warm light gray */
}

.map-link,
.map-link:visited {
    color: #d97706 !important;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 8px;
    display: inline-block;
    transition: color 0.2s;
}

.map-link:hover {
    color: #fbbf24;
    /* Brighter on hover */
    text-decoration: underline;
}

/* Helper Utilities */
.hide-mobile {
    display: table-cell;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none;
    }

    .hero-title {
        font-size: 2rem;
    }
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-switch .slider {
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    position: relative;
    transition: 0.3s;
    border: 1px solid var(--border);
}

.toggle-switch .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-secondary);
    top: 2px;
    left: 2px;
    transition: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.toggle-switch input:checked+.slider {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
}

.toggle-switch input:checked+.slider::before {
    transform: translateX(20px);
    background: #22c55e;
}

.toggle-switch .label-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- Facts Grid --- */
.facts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    width: 100%;
    margin-bottom: 30px;
}

.facts-grid.small-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.fact-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
    transition: transform 0.2s, border-color 0.2s;
}

.fact-card:hover {
    border-color: rgba(217, 119, 6, 0.3);
    /* Hover accent */
    transform: translateY(-2px);
}

.fact-card.active-card {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, rgba(20, 24, 20, 0.8) 100%);
    border-color: rgba(34, 197, 94, 0.1);
}

.fact-card.expired-card {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.05) 0%, rgba(20, 24, 20, 0.8) 100%);
    border-color: rgba(234, 179, 8, 0.1);
}

.fact-card.class-card {
    /* Blue was here, change to Stone or Teal or Amber? Keep Blue for contrast or switch to Rust? */
    /* Let's keep a muted blue-grey or Teal for classes to distinct from status */
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.05) 0%, rgba(20, 24, 20, 0.8) 100%);
    border-color: rgba(20, 184, 166, 0.15);
    /* Teal */
    align-items: center;
    text-align: center;
}

.fact-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.fact-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
}

.fact-card.class-card .fact-value {
    font-size: 2rem;
}

.fact-sub {
    font-size: 0.8rem;
    color: rgba(168, 162, 158, 0.6);
    margin-top: 8px;
}

.fact-icon {
    position: absolute;
    right: 20px;
    bottom: 20px;
    font-size: 3rem;
    opacity: 0.1;
    filter: sepia(100%) hue-rotate(20deg);
    /* Earthy filter */
}

.section-title {
    width: 100%;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--accent);
    border-radius: 3px;
    opacity: 0.6;
}

@media (max-width: 600px) {
    .facts-grid {
        grid-template-columns: 1fr;
    }

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

footer,
.site-footer {
    padding: 30px;
    text-align: center;
    font-size: 0.85rem;
    color: rgba(168, 162, 158, 0.5);
    margin-top: auto;
    border-top: 1px solid var(--border);
}

/* --- Layout Skeleton (Header/Hero) --- */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.site-header .brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-color);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.site-header nav {
    display: flex;
    gap: 24px;
}

.site-header nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.site-header nav a:hover {
    color: var(--text-main);
}

/* Sub-page Hero (Advanced, Facts, Help) */
.page-hero {
    text-align: center;
    margin-bottom: 40px;
}

.page-hero h1 {
    font-size: 2.5rem;
    margin-bottom: 16px;
    color: var(--text-main);
}

.page-hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}