:root {
    --primary-color: #6b7280; /* 高级灰 */
    --primary-hover: #4b5563;
    --primary-light: rgba(107, 114, 128, 0.1);
    --accent-color: #9ca3af; /* 浅灰 */
    --text-main: #ffffff;
    --text-muted: #d1d5db;
    --text-light: #e5e7eb;
    --bg-dark: #1f2937; /* 深灰底 */
    --bg-card: #374151; /* 中灰卡片 */
    --bg-card-hover: #4b5563;
    --border-color: #4b5563;
    --border-light: rgba(75, 85, 99, 0.5);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --sp-sm: 0.5rem;
    --sp-md: 1rem;
    --sp-lg: 2rem;
    --sp-xl: 4rem;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.4);
    --shadow-glow: 0 0 20px rgba(107, 114, 128, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(107, 114, 128, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(156, 163, 175, 0.08) 0%, transparent 50%);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: var(--sp-md) var(--sp-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: rgba(31, 41, 55, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

header:hover {
    background: rgba(31, 41, 55, 0.95);
    border-bottom-color: var(--border-color);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--sp-md) var(--sp-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    flex-shrink: 0;
}

.logo img {
    height: 45px;
    display: block;
    transition: transform 0.3s ease;
}

.logo:hover img {
    transform: scale(1.05);
}

/* Navigation */
.main-nav {
    display: flex;
    align-items: center;
}

.nav-list {
    display: flex;
    list-style: none;
    gap: var(--sp-lg);
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-link {
    color: var(--text-light);
    font-weight: 500;
    font-size: 0.95rem;
    padding: var(--sp-sm) var(--sp-md);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    position: relative;
    display: block;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 80%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transition: transform 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-main);
    background: rgba(99, 102, 241, 0.1);
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: translateX(-50%) scaleX(1);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--sp-sm);
    z-index: 1001;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover span {
    background: var(--primary-color);
}

/* A11y */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Header search */
.main-nav {
    gap: var(--sp-md);
}

.header-search-box {
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    animation: none;
    align-items: center;
    max-width: 620px;
}

.header-search-box:hover {
    transform: none;
    box-shadow: var(--shadow-md);
}

.header-search-state {
    flex: 0 0 160px;
}

.header-search-box .form-control {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.btn-search--compact {
    padding: 0.75rem 1.25rem;
    min-width: auto;
    height: 46px;
    align-self: center;
}

/* Hero Section */
.hero {
    position: relative;
    height: 80vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: var(--sp-lg);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    /* 你用了 background-image, 但实际上页面中的 hero 背景是由内联样式写的 linear-gradient 设置的（在 HTML 里 .hero 选择器有 background: linear-gradient(...)），
       所以外部 style.css 的这个 background-image 被覆盖了，起不了作用。
       要让它生效，建议把 html 里的 .hero background 去掉，或者在 style.css 里加 !important: 
       background-image: url('assets/jailmugshots_hero_bg.png') !important;
    */
    background-image: url('assets/jailmugshots_hero_bg.png') !important;
    /* Background Image will be set properly in PHP or via separate class if dynamic */
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(31, 41, 55, 0.6) 0%, rgba(31, 41, 55, 0.95) 100%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    width: 100%;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: var(--sp-md);
    background: linear-gradient(135deg, #ffffff 0%, #e5e7eb 50%, #d1d5db 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    animation: fadeInUp 0.8s ease-out;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: var(--sp-xl);
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Box */
.search-box {
    background: rgba(55, 65, 81, 0.9);
    backdrop-filter: blur(10px);
    padding: var(--sp-lg);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    display: flex;
    gap: var(--sp-md);
    flex-wrap: nowrap;
    align-items: flex-end;
    animation: fadeInUp 0.8s ease-out 0.4s both;
    transition: all 0.3s ease;
}

.search-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(107, 114, 128, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.form-group {
    flex: 1 1 0;
    min-width: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: var(--sp-sm);
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: rgba(31, 41, 55, 0.8);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:hover {
    border-color: var(--border-color);
    background: rgba(31, 41, 55, 0.9);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(31, 41, 55, 1);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn-search {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border: none;
    padding: 0.875rem 2.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    flex-shrink: 0;
    height: 50px;
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.3);
    position: relative;
    overflow: hidden;
    align-self: flex-end;
}

.btn-search::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-search:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #6b7280 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

.btn-search:hover::before {
    left: 100%;
}

.btn-search:active {
    transform: translateY(0) scale(0.98);
}

/* Info Section */
.info-section {
    padding: var(--sp-xl) var(--sp-lg);
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.info-section h2 {
    font-size: 2.5rem;
    margin-bottom: var(--sp-lg);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--sp-lg);
    margin-top: var(--sp-lg);
}

.info-card {
    background: var(--bg-card);
    padding: var(--sp-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.info-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.info-card:hover::before {
    transform: scaleX(1);
}

.info-card h3 {
    margin-bottom: var(--sp-sm);
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.info-card:hover h3 {
    color: var(--accent-color);
}

.info-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.info-card:hover p {
    color: var(--text-light);
}

/* State Directory */
.state-directory {
    background: var(--bg-card);
    padding: var(--sp-xl) var(--sp-lg);
    margin-top: var(--sp-xl);
    border-top: 1px solid var(--border-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 2rem;
    text-align: center;
    margin-bottom: var(--sp-lg);
}

.state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--sp-md);
}

.state-link {
    display: block;
    padding: var(--sp-md) var(--sp-sm);
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    color: var(--text-muted);
    transition: all 0.3s ease;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.state-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--primary-light), transparent);
    transition: left 0.5s ease;
}

.state-link:hover {
    border-color: var(--primary-color);
    color: var(--text-main);
    transform: translateY(-3px);
    background: var(--primary-light);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.2);
}

.state-link:hover::before {
    left: 100%;
}

/* Footer */
footer {
    padding: var(--sp-lg);
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: var(--sp-xl);
    font-size: 0.875rem;
    background: rgba(31, 41, 55, 0.5);
}

footer .container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: var(--sp-sm) var(--sp-md);
    }

    /* Mobile menu */
    .mobile-menu-toggle {
        display: flex;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(31, 41, 55, 0.98);
        border-bottom: 1px solid var(--border-light);
        padding: var(--sp-md);
        gap: var(--sp-md);
    }

    .main-nav.active {
        display: block;
    }

    .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: var(--sp-sm);
    }
    
    .header-search-box {
        margin-top: var(--sp-md);
        max-width: none;
    }
    
    .logo img {
        height: 35px;
    }
    
    .hero {
        min-height: 500px;
        padding: var(--sp-md);
    }
    
    .hero h1 {
        font-size: 2.5rem;
        margin-top: 200px;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .search-box {
        flex-direction: column;
        align-items: stretch;
        padding: var(--sp-md);
    }
    
    .form-group {
        min-width: 100%;
    }
    
    .btn-search {
        width: 100%;
        margin-top: var(--sp-sm);
    }
    
    .info-section {
        padding: var(--sp-lg) var(--sp-md);
    }
    
    .info-section h2 {
        font-size: 2rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: var(--sp-md);
    }
    
    .state-directory {
        padding: var(--sp-lg) var(--sp-md);
    }
    
    .state-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: var(--sp-sm);
    }
    
    .section-title {
        font-size: 1.75rem;
    }
}

/* ========================================
   Data Table Styles
   ======================================== */
.data-table-wrapper {
    overflow-x: auto;
    margin-top: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    font-size: 0.95rem;
}

.data-table thead {
    background: linear-gradient(135deg, rgba(107, 114, 128, 0.3) 0%, rgba(75, 85, 99, 0.4) 100%);
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-light);
    vertical-align: middle;
}

/* Zebra striping */
.data-table tbody tr:nth-child(even) {
    background: rgba(55, 65, 81, 0.3);
}

.data-table tbody tr:nth-child(odd) {
    background: var(--bg-card);
}

/* Hover effect */
.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(107, 114, 128, 0.2);
    transform: scale(1.002);
}

/* Table cell types */
.data-table .cell-index {
    width: 60px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
}

.data-table .cell-name {
    font-weight: 500;
    color: var(--text-main);
}

.data-table .cell-action {
    width: 140px;
    text-align: center;
}

.data-table .cell-preview {
    width: 60px;
    padding: 0.5rem;
}

.data-table .cell-preview img {
    width: 48px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.data-table .cell-preview img:hover {
    transform: scale(1.5);
    box-shadow: var(--shadow-md);
}

.data-table .cell-snippet {
    max-width: 300px;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.data-table .cell-snippet-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table .cell-source {
    white-space: nowrap;
}

.data-table .gov-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
    text-transform: uppercase;
}

/* Table links */
.data-table a.table-link {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.2s ease;
}

.data-table a.table-link:hover {
    color: var(--primary-color);
}

.table-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.table-btn:hover {
    background: linear-gradient(135deg, var(--primary-hover), #6b7280);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
    color: white;
}

.table-btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* No preview placeholder */
.no-preview {
    width: 48px;
    height: 36px;
    background: rgba(75, 85, 99, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.6rem;
}

/* ========================================
   Resource Card Grid (County detail page)
   ======================================== */
.resource-grid {
    display: grid;
    /* 2 columns on wide screens, 1 column on medium screens */
    grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
    gap: 1rem;
}

.resource-card {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem;
    background: rgba(55, 65, 81, 0.7);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease, background 0.2s ease;
    overflow: hidden;
}

.resource-card:hover {
    background: rgba(55, 65, 81, 0.9);
    transform: translateY(-2px);
}

.resource-thumb {
    display: block;
    width: 200px;
    height: 150px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    background: rgba(75, 85, 99, 0.25);
}

.resource-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.no-preview-lg {
    width: 100%;
    height: 100%;
    border-radius: 0;
    font-size: 0.85rem;
}

.resource-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.resource-title {
    color: var(--text-main);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.25;
    text-decoration: none;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.resource-title:hover {
    color: var(--primary-color);
}

.resource-source {
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.resource-source-text {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.resource-snippet {
    color: var(--text-light);
    font-size: 0.9rem;
    line-height: 1.55;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.resource-actions {
    margin-top: auto;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Responsive table */
@media (max-width: 768px) {
    .data-table-wrapper {
        margin-top: 1rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .data-table .cell-snippet {
        max-width: 150px;
    }
    
    .data-table .cell-preview img {
        width: 40px;
        height: 30px;
    }
    
    .no-preview {
        width: 40px;
        height: 30px;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }

    .resource-card {
        grid-template-columns: 1fr;
    }

    .resource-thumb {
        width: 100%;
        height: 180px;
    }
}