/**
 * Dovidka.in.ua — Main Styles
 * Polished Light + High-Contrast Dark Theme
 */

/* ============================================================
   LIGHT THEME VARIABLES
   ============================================================ */
:root {
    --bg-primary:    #ffffff;
    --bg-secondary:  #f3f5fb;
    --bg-tertiary:   #e7ebf7;
    --bg-card:       #ffffff;

    --text-primary:   #1b1f36;
    --text-secondary: #4b5270;
    --text-tertiary:  #8890b0;

    --primary:        #5b6ef5;
    --primary-hover:  #4358e0;
    --primary-light:  #eef0ff;
    --primary-rgb:    91, 110, 245;

    --border-color:   #dde2f0;
    --shadow-sm:      0 1px 4px rgba(27,31,54,0.07);
    --shadow-md:      0 4px 18px rgba(27,31,54,0.10);
    --shadow-lg:      0 8px 36px rgba(27,31,54,0.13);
    --shadow-hover:   0 6px 24px rgba(91,110,245,0.20);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger:  #ef4444;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

/* ============================================================
   DARK THEME — HIGH CONTRAST
   ============================================================ */
[data-theme="dark"] {
    --bg-primary:    #0d0f1a;
    --bg-secondary:  #141726;
    --bg-tertiary:   #1e2238;
    --bg-card:       #181c30;

    --text-primary:   #eef0ff;
    --text-secondary: #c0c8e8;
    --text-tertiary:  #7a84a8;

    --primary:        #8494ff;
    --primary-hover:  #6878f0;
    --primary-light:  #1e2445;

    --border-color:   #2a3050;
    --shadow-sm:      0 1px 4px rgba(0,0,0,0.45);
    --shadow-md:      0 4px 18px rgba(0,0,0,0.55);
    --shadow-lg:      0 8px 36px rgba(0,0,0,0.65);
    --shadow-hover:   0 6px 24px rgba(132,148,255,0.24);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.65;
    color: var(--text-primary);
    background: var(--bg-secondary);
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
img { max-width: 100%; display: block; }

/* ============================================================
   CONTAINER
   ============================================================ */
.container { max-width: 1240px; margin: 0 auto; padding: 0 1.25rem; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background 0.3s, border-color 0.3s;
}

.header-content {
    display: flex;
    align-items: center;
    padding: 0.9rem 0;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.3px;
    white-space: nowrap;
    transition: color 0.2s;
    flex-shrink: 0;
}

.site-logo:hover { color: var(--primary); }
.logo-icon { font-size: 1.4rem; flex-shrink: 0; }
.site-logo img { flex-shrink: 0; width: auto !important; height: 36px; max-height: 36px; }

.main-nav { display: flex; gap: 0.2rem; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow: visible; align-items: center; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.18s;
    white-space: nowrap;
}

.nav-link:hover { color: var(--primary); background: var(--primary-light); }
.nav-icon { font-size: 1rem; }

.header-actions { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; margin-left: auto; }

/* nav-gap-wrap з layout.php може перекривати flex — перебиваємо */
nav.main-nav { flex: 1 1 auto !important; min-width: 0 !important; }

.btn-search, .btn-theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-search:hover, .btn-theme-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.site-main { min-height: 60vh; padding: 2rem 0; }

/* Pages that start with a hero/banner — remove top padding so hero touches header */
.site-main:has(> .home-hero:first-child),
.site-main:has(> .section-banner:first-child),
.site-main:has(> .category-header:first-child) {
    padding-top: 0;
}

/* ============================================================
   HERO
   ============================================================ */
.home-hero {
    background: linear-gradient(135deg, var(--primary) 0%, #9b59d0 100%);
    color: white;
    padding: 4rem 0;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}

.home-hero::before {
    content: '';
    position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.home-hero .container { position: relative; }

.home-hero h1 {
    font-size: 2.6rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.lead { font-size: 1.15rem; margin-bottom: 2rem; opacity: 0.93; }

.search-form { max-width: 580px; margin: 0 auto; }

.search-input-group {
    display: flex;
    background: white;
    padding: 5px;
    border-radius: 50px;
    box-shadow: 0 6px 32px rgba(0,0,0,0.2);
}

.search-input {
    flex: 1;
    border: none;
    padding: 0.7rem 1.25rem;
    font-size: 1rem;
    border-radius: 50px;
    outline: none;
    background: transparent;
    color: #1b1f36;
}

.search-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.7rem 1.75rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
}

.search-button:hover { background: var(--primary-hover); transform: scale(1.02); }

/* ============================================================
   SECTIONS GRID
   ============================================================ */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.section-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-decoration: none;
    transition: all 0.22s;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.section-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--section-color, var(--primary));
    opacity: 0;
    transition: opacity 0.22s;
}

.section-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--section-color, var(--primary));
}

.section-card:hover::after { opacity: 1; }

.section-card--shadow  { border-color: transparent; box-shadow: var(--shadow-md); }
.section-card--flat    { box-shadow: none; }
.section-card--filled  { background: var(--section-color, var(--primary)); border-color: transparent; }
.section-card--filled .section-name,
.section-card--filled .section-icon { color: white; }
.section-card--filled .section-description { color: rgba(255,255,255,0.85); }
.section-card--filled .stat-number { color: white; }
.section-card--filled .stat-label  { color: rgba(255,255,255,0.7); }
.section-card--filled .section-stats { border-top-color: rgba(255,255,255,0.2); }

.section-icon { font-size: 2.5rem; margin-bottom: 0.85rem; line-height: 1; }

.section-name {
    color: var(--section-color, var(--primary));
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    line-height: 1.3;
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 1.2rem;
    flex: 1;
    line-height: 1.55;
}

.section-stats {
    display: flex;
    gap: 1.5rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.stat { display: flex; flex-direction: column; align-items: center; }

.stat-number {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--section-color, var(--primary));
    line-height: 1;
}

.stat-label { font-size: 0.75rem; color: var(--text-tertiary); margin-top: 0.2rem; }

/* ============================================================
   INFO CARDS
   ============================================================ */
.home-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
    margin: 2.5rem 0;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    text-align: center;
    transition: box-shadow 0.2s, transform 0.2s;
}

.info-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.info-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.info-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* ============================================================
   GENERAL CARDS
   ============================================================ */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: all 0.22s;
    color: var(--text-primary);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: #13162a;
    color: #a0a8c8;
    padding: 3rem 0 0;
    margin-top: 4rem;
}

[data-theme="dark"] .site-footer {
    background: #08091a;
    border-top: 1px solid #1a1e34;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.footer-section h4 {
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.1rem;
}

[data-theme="dark"] .footer-section h4 { color: #d0d8ff; }

.footer-section p { font-size: 0.9rem; line-height: 1.65; }

.footer-links { list-style: none; }
.footer-links li { margin-bottom: 0.5rem; }

.footer-links a {
    color: #7880a8;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover { color: #ffffff; }

[data-theme="dark"] .footer-links a { color: #505878; }
[data-theme="dark"] .footer-links a:hover { color: #b0b8e0; }

.footer-bottom {
    background: rgba(0,0,0,0.28);
    padding: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-bottom p { font-size: 0.85rem; color: #505878; }
[data-theme="dark"] .footer-bottom p { color: #383e58; }

.footer-bottom-links { display: flex; gap: 1.25rem; }

.footer-bottom-links a {
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-bottom-links a:hover { color: #ffffff !important; }

.footer-socials { display: flex; gap: 0.75rem; margin-top: 0.9rem; flex-wrap: wrap; }

.footer-socials a {
    font-size: 1.35rem;
    text-decoration: none;
    opacity: 0.65;
    transition: opacity 0.2s, transform 0.2s;
}

.footer-socials a:hover { opacity: 1; transform: scale(1.15); }

.footer-logo { margin-bottom: 0.5rem; color: #ffffff; font-weight: 700; }
.footer-custom { margin-top: 0.75rem; font-size: 0.875rem; line-height: 1.6; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-hover); }

.btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--border-color); transform: translateY(-1px); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91,110,245,0.12);
}

[data-theme="dark"] .form-control:focus {
    box-shadow: 0 0 0 3px rgba(132,148,255,0.15);
}

textarea.form-control { min-height: 100px; resize: vertical; }

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumbs {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.breadcrumbs a { color: var(--text-tertiary); text-decoration: none; transition: color 0.2s; }
.breadcrumbs a:hover { color: var(--primary); }

/* ============================================================
   VERIFIED BADGE
   ============================================================ */
.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
    color: white;
    width: 20px; height: 20px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    margin-left: 0.4rem;
    vertical-align: middle;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-tertiary); }
.empty-state p { font-size: 1.05rem; margin-bottom: 1rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .sections-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ── Header responsive ── */

/* Середній екран: зменшуємо nav-link */
@media (max-width: 1200px) {
    nav.main-nav .nav-link { font-size: 0.8rem; padding: 0.3rem 0.4rem; }
    .header-content { gap: 0.25rem; }
}

/* Малий екран: бургер */
@media (max-width: 1024px) {
    .main-nav { display: none !important; }
    .burger-btn { display: flex; }
}

/* ============================================================
   THEME TOGGLE ANIMATION
   ============================================================ */
@keyframes spin-once { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.btn-theme-toggle.rotating { animation: spin-once 0.45s ease; }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    .site-header, .site-footer, .header-actions { display: none; }
    body { background: white; color: black; }
}

/* ============================================================
   PHONE REVEAL
   ============================================================ */
.phone-reveal-wrap {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.phone-masked {
    font-family: monospace;
    font-size: 1em;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.phone-reveal-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.85rem;
    background: var(--primary-light);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
    line-height: 1;
}

.phone-reveal-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.03);
}

.phone-reveal-btn:active { transform: scale(0.97); }

.phone-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.phone-link:hover { text-decoration: underline; }

.contact-item--big .phone-link,
.contact-item--big .phone-masked {
    font-size: 1.25rem;
    font-weight: 700;
}

.contact-item--big .phone-reveal-btn { font-size: 0.9rem; padding: 0.4rem 1rem; }

/* ============================================================
   DARK THEME — COMPONENT OVERRIDES
   ============================================================ */

/* ── Body & base ── */
[data-theme="dark"] body {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* ── Header ── */
[data-theme="dark"] .site-header {
    background: #10121f !important;
    border-bottom-color: #1e2340 !important;
    box-shadow: 0 2px 16px rgba(0,0,0,0.5) !important;
}
[data-theme="dark"] .site-header .nav-link,
[data-theme="dark"] .site-header .logo-text {
    color: #c8d0f0 !important;
}
[data-theme="dark"] .site-header .nav-link:hover {
    color: #8494ff !important;
}
[data-theme="dark"] .site-header .nav-link.nav-active {
    color: #8494ff !important;
}
[data-theme="dark"] .nav-separator {
    color: #2a3050 !important;
}

/* ── Header actions (theme btn, search) ── */
[data-theme="dark"] .btn-search,
[data-theme="dark"] .btn-theme-toggle {
    color: #c8d0f0;
}
[data-theme="dark"] .btn-search:hover,
[data-theme="dark"] .btn-theme-toggle:hover {
    background: rgba(255,255,255,0.08);
}

/* ── Header live search box ── */
[data-theme="dark"] .header-search-box {
    background: #141726;
    border-color: #2a3050;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
[data-theme="dark"] .header-search-inner {
    border-bottom-color: #2a3050;
}
[data-theme="dark"] #header-search-input {
    color: #eef0ff;
}
[data-theme="dark"] #header-search-input::placeholder {
    color: #4b5270;
}
[data-theme="dark"] .hs-item {
    color: #d0d8f8;
    border-bottom-color: #1e2340;
}
[data-theme="dark"] .hs-item:hover,
[data-theme="dark"] .hs-item.active {
    background: #1e2238;
}
[data-theme="dark"] .hs-logo {
    background: #1e2238;
    border-color: #2a3050;
}
[data-theme="dark"] .hs-meta,
[data-theme="dark"] .hs-addr {
    color: #5a6488;
}
[data-theme="dark"] .hs-state {
    color: #4b5270;
}
[data-theme="dark"] .hs-footer {
    border-top-color: #2a3050;
}
[data-theme="dark"] .hs-clear {
    color: #4b5270;
}
[data-theme="dark"] .hs-clear:hover {
    color: #c8d0f0;
}

/* ── Cards (org-card, section-card) ── */
[data-theme="dark"] .organization-card,
[data-theme="dark"] .section-card,
[data-theme="dark"] .org-card-item {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .organization-card:hover,
[data-theme="dark"] .section-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 24px rgba(132,148,255,0.2);
}
[data-theme="dark"] .org-name a {
    color: #eef0ff;
}
[data-theme="dark"] .org-name a:hover {
    color: var(--primary);
}
[data-theme="dark"] .org-description,
[data-theme="dark"] .detail-text {
    color: var(--text-secondary);
}
[data-theme="dark"] .org-logo {
    background: #1e2238;
}

/* ── Category / Section header ── */
[data-theme="dark"] .category-header {
    background: #10121f !important;
    border-bottom-color: var(--primary) !important;
}
[data-theme="dark"] .category-title h1,
[data-theme="dark"] .section-title h1 {
    color: #eef0ff;
}
[data-theme="dark"] .category-lead,
[data-theme="dark"] .category-meta {
    color: var(--text-secondary);
}
[data-theme="dark"] .breadcrumbs,
[data-theme="dark"] .breadcrumbs a {
    color: var(--text-tertiary);
}
[data-theme="dark"] .breadcrumbs a:hover {
    color: var(--primary);
}

/* ── Filter & Sort bar ── */
[data-theme="dark"] .fs-bar {
    background: #141726;
    border-color: #2a3050;
}
[data-theme="dark"] .fs-search-wrap {
    background: #0d0f1a;
    border-color: #2a3050;
}
[data-theme="dark"] .fs-search {
    color: #eef0ff;
}
[data-theme="dark"] .fs-btn,
[data-theme="dark"] .fs-chip {
    background: #1e2238;
    border-color: #2a3050;
    color: var(--text-secondary);
}
[data-theme="dark"] .fs-btn:hover,
[data-theme="dark"] .fs-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}
[data-theme="dark"] .fs-btn.active,
[data-theme="dark"] .fs-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
[data-theme="dark"] .fs-label,
[data-theme="dark"] .fs-counter {
    color: var(--text-tertiary);
}

/* ── Map controls ── */
[data-theme="dark"] .cat-view-btns {
    background: #1e2238;
}
[data-theme="dark"] .cat-view-btn {
    color: var(--text-tertiary);
}
[data-theme="dark"] .cat-view-btn.active {
    background: #2a3050;
    color: var(--primary);
}
[data-theme="dark"] .map-controls-bar {
    background: #141726;
    border-top-color: #2a3050;
}
[data-theme="dark"] .map-action-btn {
    background: #1e2238;
    border-color: #2a3050;
    color: #c8d0f0;
}
[data-theme="dark"] .map-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
[data-theme="dark"] .cat-map-wrap {
    border-color: #2a3050;
}

/* ── Home hero ── */
[data-theme="dark"] .home-hero {
    background: linear-gradient(135deg, #10121f 0%, #1a1e38 100%);
}
[data-theme="dark"] .home-hero h1 {
    color: #eef0ff;
}
[data-theme="dark"] .home-hero p {
    color: var(--text-secondary);
}

/* ── Section cards on home ── */
[data-theme="dark"] .section-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .section-card:hover {
    border-color: var(--primary);
    background: #1e2238;
}
[data-theme="dark"] .section-card h3 {
    color: #eef0ff;
}
[data-theme="dark"] .section-card p {
    color: var(--text-secondary);
}

/* ── Buttons ── */
[data-theme="dark"] .btn-secondary {
    background: #1e2238;
    color: #c8d0f0;
    border-color: #2a3050;
}
[data-theme="dark"] .btn-secondary:hover {
    background: #2a3050;
}

/* ── Forms ── */
[data-theme="dark"] .form-control {
    background: #141726;
    border-color: #2a3050;
    color: #eef0ff;
}
[data-theme="dark"] .form-control::placeholder {
    color: #4b5270;
}
[data-theme="dark"] .form-group label {
    color: var(--text-secondary);
}

/* ── Organization detail page ── */
[data-theme="dark"] .org-detail-card,
[data-theme="dark"] .contact-card,
[data-theme="dark"] .info-block {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .contact-label,
[data-theme="dark"] .info-label {
    color: var(--text-tertiary);
}
[data-theme="dark"] .contact-value,
[data-theme="dark"] .info-value {
    color: var(--text-primary);
}

/* ── Footer dark adjustments ── */
[data-theme="dark"] .footer-links a {
    color: #6878a0 !important;
}
[data-theme="dark"] .footer-links a:hover {
    color: #c8d0f0 !important;
}
[data-theme="dark"] .footer-bottom p {
    color: #4b5270 !important;
}

/* ── Search page ── */
[data-theme="dark"] .search-result-card {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .search-result-card:hover {
    border-color: var(--primary);
}

/* ── Scrollbar ── */
[data-theme="dark"] ::-webkit-scrollbar { width: 8px; }
[data-theme="dark"] ::-webkit-scrollbar-track { background: #0d0f1a; }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #2a3050; border-radius: 4px; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #3a4268; }

/* ============================================================
   RESPONSIVE — EXTENDED BREAKPOINTS
   ============================================================ */

/* ── 1024px: tablet landscape ── */
@media (max-width: 1024px) {
    .container { padding: 0 1rem; }
    .sections-grid { grid-template-columns: repeat(2, 1fr); gap: 1.1rem; }
    .home-hero { padding: 3rem 0; }
    .home-hero h1 { font-size: 2.1rem; }
    .lead { font-size: 1.05rem; }
    .site-main { padding: 1.5rem 0; }
}

/* ── 768px: tablet portrait ── */
@media (max-width: 768px) {
    .container { padding: 0 0.875rem; }

    /* Header */
    .header-content { padding: 0.7rem 0; gap: 0.4rem; }
    .site-logo { font-size: 1.05rem; }
    .site-logo img { height: 30px; max-height: 30px; }

    /* Hero */
    .home-hero { padding: 2.25rem 0; margin-bottom: 1.5rem; }
    .home-hero h1 { font-size: 1.75rem; letter-spacing: -0.3px; }
    .lead { font-size: 0.95rem; margin-bottom: 1.5rem; }
    .search-form { max-width: 100%; }
    .search-input-group { border-radius: 16px; }
    .search-input { padding: 0.6rem 1rem; font-size: 0.95rem; }
    .search-button { padding: 0.6rem 1.25rem; font-size: 0.88rem; }

    /* Sections grid */
    .sections-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.875rem; }
    .section-card { padding: 1.25rem; }
    .section-icon { font-size: 2rem; margin-bottom: 0.6rem; }
    .section-name { font-size: 1.05rem; }

    /* Info cards */
    .home-info { gap: 0.875rem; margin: 1.5rem 0; }
    .info-card { padding: 1.25rem; }

    /* Footer */
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.875rem 0;
    }
    .footer-bottom-links { gap: 0.875rem; }

    /* General */
    .site-main { padding: 1.25rem 0; }
    .content-card { padding: 1.1rem; }
}

/* ── 480px: mobile ── */
@media (max-width: 480px) {
    .container { padding: 0 0.75rem; }

    /* Hero */
    .home-hero { padding: 1.75rem 0; }
    .home-hero h1 { font-size: 1.45rem; }
    .lead { font-size: 0.88rem; margin-bottom: 1.25rem; }
    .search-input-group { flex-direction: column; border-radius: 12px; padding: 4px; gap: 4px; }
    .search-input { border-radius: 10px !important; padding: 0.65rem 1rem; }
    .search-button { border-radius: 10px !important; padding: 0.65rem 1rem; width: 100%; }

    /* Sections: 1 column */
    .sections-grid { grid-template-columns: 1fr !important; gap: 0.75rem; }
    .section-card { padding: 1rem; }
    .section-stats { gap: 1rem; }

    /* Info cards */
    .home-info { grid-template-columns: 1fr; gap: 0.65rem; }
    .info-card { padding: 1rem; }

    /* Breadcrumbs */
    .breadcrumbs { font-size: 0.78rem; }

    /* Footer */
    .footer-content { gap: 1.5rem; }
    .footer-bottom-links { flex-wrap: wrap; gap: 0.65rem; }
    .site-footer { padding: 2rem 0 0; margin-top: 2.5rem; }

    /* General */
    .site-main { padding: 1rem 0; }
    .content-card { padding: 0.875rem; }
    .btn { padding: 0.55rem 1.1rem; font-size: 0.88rem; }
}

/* ── 360px: small phones ── */
@media (max-width: 360px) {
    .home-hero h1 { font-size: 1.3rem; }
    .sections-grid { gap: 0.6rem; }
}
