/* ============================================================
   UNESCO Heritage Tracker – Custom Styles
   Supports Bootstrap 5.3 light/dark modes
   ============================================================ */

/* ---------- Design Tokens ---------- */
:root {
    --cultural-color: #e67e22;
    --natural-color:  #27ae60;
    --mixed-color:    #8e44ad;
    --brand-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* ---------- Global ---------- */
html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

/* ---------- Navbar ---------- */
.navbar-blur {
    background: rgba(var(--bs-body-bg-rgb), 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--bs-border-color);
    z-index: 1030;
}

.brand-icon { font-size: 1.4rem; line-height: 1; }

/* ---------- Dark mode toggle ---------- */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--bs-border-color);
    background: transparent;
    color: var(--bs-body-color);
    transition: background .2s, color .2s;
}
.btn-icon:hover { background: var(--bs-tertiary-bg); }

/* ---------- Hero ---------- */
.hero-section {
    padding: 5rem 0 4rem;
    background: var(--brand-gradient);
    color: #fff;
}

[data-bs-theme="light"] .hero-section {
    background: var(--brand-gradient);
}

.hero-section .text-muted { color: rgba(255,255,255,.7) !important; }

.hero-badge .badge {
    background: rgba(255,255,255,.15);
    color: #fff;
    font-weight: 500;
    font-size: .85rem;
    border: 1px solid rgba(255,255,255,.2);
}

/* ---------- Stat cards ---------- */
.stat-card {
    padding: 1.5rem;
    border-radius: .75rem;
    background: var(--bs-tertiary-bg);
    transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-number {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1;
}
.stat-label {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color);
    margin-top: .25rem;
}

/* ---------- Feature cards ---------- */
.feature-card {
    padding: 2rem 1.5rem;
    border-radius: .75rem;
    background: var(--bs-tertiary-bg);
    transition: transform .2s, box-shadow .2s;
}
.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: .75rem;
    background: rgba(13,110,253,.1);
    color: #0d6efd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.feature-icon-virtual {
    background: rgba(13,202,240,.1);
    color: #0dcaf0;
}
.feature-icon-share {
    background: rgba(25,135,84,.1);
    color: #198754;
}

/* ---------- Category badges ---------- */
.badge-cultural {
    background-color: var(--cultural-color);
    color: #fff;
}
.badge-natural {
    background-color: var(--natural-color);
    color: #fff;
}
.badge-mixed {
    background-color: var(--mixed-color);
    color: #fff;
}

.text-cultural { color: var(--cultural-color) !important; }
.text-natural  { color: var(--natural-color)  !important; }
.text-mixed    { color: var(--mixed-color)    !important; }

/* ---------- Sites Table ---------- */
.table-header-sticky th {
    position: sticky;
    top: 0;
    background: var(--bs-body-bg);
    z-index: 10;
    border-bottom: 2px solid var(--bs-border-color);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.site-row { transition: background .15s; }
.site-row:hover { background: var(--bs-tertiary-bg); }

.site-name-link { color: var(--bs-body-color); }
.site-name-link:hover { color: var(--bs-primary); }

.flag-icon {
    width: 28px;
    height: 20px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    display: block;
}

.flag-icon-lg {
    width: 48px;
    height: 34px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    flex-shrink: 0;
}

/* ---------- Visit buttons ---------- */
.btn-xs {
    padding: .2rem .45rem;
    font-size: .75rem;
    line-height: 1.4;
    border-radius: .375rem;
}

.btn-visit {
    border: 1px solid var(--bs-border-color);
    background: transparent;
    color: var(--bs-secondary-color);
}
.btn-visit:hover { background: var(--bs-tertiary-bg); }

.btn-visit-active {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}
.btn-visit-virtual-active {
    background: #0dcaf0;
    border-color: #0dcaf0;
    color: #000;
}
.btn-visit-bucket-active {
    background: #ffc107;
    border-color: #ffc107;
    color: #000;
}

/* ---------- Detail page ---------- */
.site-meta-grid .meta-item {
    padding: .75rem;
    border-radius: .5rem;
    background: var(--bs-tertiary-bg);
}
.meta-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color);
    margin-bottom: .25rem;
}
.meta-value { font-weight: 500; font-size: .9rem; }

.community-stat {
    background: var(--bs-tertiary-bg);
    border-radius: .5rem;
}

.letter-spacing { letter-spacing: .08em; }
.cursor-pointer { cursor: pointer; }

/* ---------- Auth pages ---------- */
.divider-text {
    text-align: center;
    position: relative;
    font-size: .8rem;
    color: var(--bs-secondary-color);
}
.divider-text::before,
.divider-text::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: var(--bs-border-color);
}
.divider-text::before { left: 0; }
.divider-text::after  { right: 0; }

/* ---------- Profile ---------- */
.visit-card { transition: transform .2s, box-shadow .2s; }
.visit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,.12) !important;
}

.avatar-placeholder { color: var(--bs-secondary-color); }

/* ---------- Footer ---------- */
.footer {
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--bs-border-color);
}

/* ---------- Related sites ---------- */
.related-site-card {
    color: var(--bs-body-color);
    transition: transform .15s, box-shadow .15s;
}
.related-site-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1) !important;
}

/* ---------- DataTables overrides ---------- */
div.dataTables_wrapper div.dataTables_filter input {
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
    padding: .375rem .75rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    min-width: 220px;
}

div.dataTables_wrapper div.dataTables_filter input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13,110,253,.25);
    border-color: #86b7fe;
}

div.dataTables_wrapper div.dataTables_length select {
    border: 1px solid var(--bs-border-color);
    border-radius: .375rem;
    padding: .2rem .5rem;
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
}

.dataTables_info, .dataTables_paginate { color: var(--bs-secondary-color); font-size: .85rem; }

/* ---------- bg-subtle / tertiary for older BS ---------- */
.bg-subtle { background: var(--bs-tertiary-bg) !important; }

/* ---------- Responsive adjustments ---------- */
@media (max-width: 576px) {
    .hero-section { padding: 3rem 0 2.5rem; }
    .hero-section h1 { font-size: 1.75rem; }
    .stat-number { font-size: 1.75rem; }
}
