/* ============================================
   SyriaToday - Main Stylesheet v2
   Dark theme inspired by WorldMonitor
   ============================================ */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2332;
    --bg-card: #151d2b;
    --border-color: #1e293b;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --font-main: 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Light theme: same design tokens, light values */
body.light-theme {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --bg-card: #ffffff;
    --border-color: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --accent-glow: rgba(59, 130, 246, 0.25);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
}

/* App page (index): full-viewport locked layout */
body.app-page {
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   TOP BAR (app page)
   ============================================ */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    height: 50px;
    z-index: 1000;
    flex-shrink: 0;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-text .highlight {
    color: var(--accent);
}

.version {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.status-indicators {
    display: flex;
    gap: 20px;
    align-items: center;
}

.indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.indicator.live {
    color: var(--success);
    font-weight: 600;
}

.pulse {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px var(--success);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.top-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-icon {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: var(--font-main);
}

.btn-icon:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ============================================
   SITE HEADER (sub-pages)
   ============================================ */
.site-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.site-header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 8px 20px;
    flex-wrap: wrap;
}

.site-nav {
    display: flex;
    gap: 4px;
    flex: 1;
    flex-wrap: wrap;
}

.nav-link {
    padding: 6px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active {
    color: #fff;
    background: var(--accent);
}

.city-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 5px 20px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    overflow-x: auto;
    white-space: nowrap;
    font-size: 12px;
}

.city-strip-label {
    color: var(--text-muted);
    flex-shrink: 0;
}

.city-strip a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.city-strip a:hover {
    color: var(--accent);
}

/* ============================================
   CITY CHIPS (index strip)
   ============================================ */
.city-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 7px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    flex-shrink: 0;
    scrollbar-width: thin;
}

.city-chips a {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.city-chips a:hover,
.city-chips a.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ============================================
   MAIN LAYOUT (app page)
   ============================================ */
.main-container {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 1px;
    background: var(--border-color);
}

.map-section {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
    min-width: 0;
}

.sidebar {
    width: 380px;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

/* ============================================
   MAP
   ============================================ */
#map {
    width: 100%;
    height: 100%;
    background: #0d1117;
}

/* Leaflet Dark Theme Overrides */
.leaflet-container {
    background: #0d1117 !important;
    font-family: var(--font-main);
}

.leaflet-bar a {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.leaflet-bar a:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
}

.leaflet-control-attribution {
    background: rgba(10, 14, 23, 0.7) !important;
    color: var(--text-muted);
    font-size: 9px;
    padding: 1px 5px;
}

.leaflet-control-attribution a {
    color: var(--text-secondary);
}

.leaflet-popup-content-wrapper {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.leaflet-popup-tip {
    background: var(--bg-card);
}

.syria-popup .leaflet-popup-content-wrapper {
    background: #151d2b !important;
    border: 1px solid #1e293b !important;
}

.syria-popup .leaflet-popup-tip {
    background: #151d2b !important;
}

/* Pulse marker animation (expanding ring; transform applies to SVG too) */
@keyframes marker-pulse {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
    }
    70% {
        transform: scale(1.3);
        opacity: 0.7;
        box-shadow: 0 0 0 12px rgba(59, 130, 246, 0);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

.pulse-marker {
    animation: marker-pulse 2s ease-out infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.gov-pulse {
    cursor: pointer;
}

/* Governorate circle label: tooltip-like, white text with shadow */
.gov-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #fff !important;
    font-family: var(--font-main);
    font-weight: 700;
    font-size: 12px;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.7);
    white-space: nowrap;
    direction: rtl;
}

.gov-label::before {
    display: none !important;
}

/* Layer Panel */
.layer-panel {
    position: absolute;
    top: 60px;
    left: 15px;
    z-index: 500;
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    min-width: 160px;
    box-shadow: var(--shadow);
}

body.light-theme .layer-panel {
    background: rgba(255, 255, 255, 0.95);
}

.layer-panel h4 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.layer-item:hover {
    color: var(--text-primary);
}

.layer-item input[type="checkbox"] {
    accent-color: var(--accent);
    cursor: pointer;
}

.layer-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.layer-panel hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 10px 0;
}

/* Time Filter */
.time-filter {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    gap: 4px;
    background: rgba(17, 24, 39, 0.9);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

body.light-theme .time-filter {
    background: rgba(255, 255, 255, 0.9);
}

.time-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-main);
    transition: all 0.2s;
    white-space: nowrap;
}

.time-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.time-btn.active {
    background: var(--accent);
    color: white;
    font-weight: 600;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    left: 15px;
    z-index: 500;
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 12px;
}

body.light-theme .map-legend {
    background: rgba(255, 255, 255, 0.9);
}

.legend-title {
    color: var(--text-muted);
    margin-bottom: 6px;
    font-size: 11px;
    text-transform: uppercase;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
    color: var(--text-secondary);
}

.legend-note {
    color: var(--text-muted);
    font-size: 11px;
    border-top: 1px solid var(--border-color);
    padding-top: 6px;
    margin-top: 6px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============================================
   SIDEBAR
   ============================================ */

/* Exchange Rates Ticker */
.rates-ticker {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 15px;
}

.ticker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ticker-header span:first-child {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.ticker-header small {
    font-size: 11px;
    color: var(--text-muted);
}

.ticker-more {
    font-size: 11px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.ticker-more:hover {
    text-decoration: underline;
}

.ticker-content {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.rate-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 8px 12px;
    min-width: 100px;
    text-align: center;
    flex-shrink: 0;
}

a.rate-item {
    text-decoration: none;
    color: inherit;
    display: block;
}

.rate-currency {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.rate-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.rate-gov {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
}

/* News Panel */
.news-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 14px;
    font-weight: 700;
}

.news-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 2px 10px;
    border-radius: 12px;
}

.news-filters {
    display: flex;
    gap: 8px;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
}

.news-filters select {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-size: 12px;
    cursor: pointer;
    min-width: 0;
}

.news-filters select:focus {
    outline: none;
    border-color: var(--accent);
}

/* News List */
.news-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.news-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.news-card:hover {
    border-color: var(--accent);
    border-right-color: var(--accent);
    background: var(--bg-tertiary);
    transform: translateX(-2px);
}

.news-card.active {
    border-color: var(--accent);
    border-right-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

.news-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.news-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.news-gov {
    font-size: 11px;
    color: var(--text-muted);
}

.news-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-right: auto;
}

.news-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.news-summary {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.news-source {
    font-size: 11px;
    color: var(--text-muted);
}

.read-more {
    font-size: 11px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.read-more:hover {
    text-decoration: underline;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 4px;
}

.empty-state small {
    font-size: 12px;
}

/* Quick Services */
.quick-services {
    padding: 12px 15px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.quick-services h4 {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.service-link {
    display: inline-block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 12px;
    margin: 2px;
    transition: all 0.2s;
}

.service-link:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ============================================
   BOTTOM TICKER (seamless: expects duplicated content)
   ============================================ */
.bottom-ticker {
    height: 40px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.ticker-label {
    background: var(--danger);
    color: white;
    padding: 0 15px;
    height: 100%;
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    z-index: 2;
}

.ticker-scroll {
    display: flex;
    gap: 30px;
    padding: 0 20px;
    width: max-content;
    animation: scroll 60s linear infinite;
    white-space: nowrap;
    will-change: transform;
}

.ticker-scroll:hover {
    animation-play-state: paused;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.ticker-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============================================
   GENERIC COMPONENTS (sub-pages)
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.page-header {
    padding: 28px 0 18px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
}

.page-header p,
.page-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 16px;
}

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

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Forms (dark) */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea,
input.form-control,
select.form-control,
textarea.form-control {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-family: var(--font-main);
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group textarea {
    min-height: 90px;
    resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Data tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.data-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 700;
    text-align: right;
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 12px;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.06);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.status-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-open {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-partial {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-closed {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.status-dangerous {
    background: var(--danger);
    color: #fff;
}

/* Service tabs */
.service-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.service-tab {
    padding: 6px 14px;
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: all 0.2s;
}

.service-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.service-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Vote buttons */
.vote-btns {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.vote-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-secondary);
    padding: 4px 10px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--font-main);
    transition: all 0.2s;
}

.vote-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.vote-btn.voted {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px 20px;
    box-shadow: var(--shadow);
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 9999;
    max-width: 90vw;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast.success {
    border-color: var(--success);
    color: var(--success);
}

.toast.error {
    border-color: var(--danger);
    color: var(--danger);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.6;
}

.alert-success {
    border-color: var(--success);
    color: var(--success);
}

.alert-error {
    border-color: var(--danger);
    color: var(--danger);
}

.alert-warning {
    border-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    border-color: var(--accent);
    color: var(--accent);
}

/* Stat cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    display: block;
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.2;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ============================================
   SITE FOOTER
   ============================================ */
.site-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
    padding: 30px 0 16px;
}

.footer-columns {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 24px;
}

.footer-col h4 {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 6px;
}

.footer-col a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: var(--accent);
}

.footer-about p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
    margin-top: 10px;
}

.footer-note {
    color: var(--text-muted) !important;
    font-size: 12px !important;
}

.footer-cities {
    column-count: 2;
    column-gap: 12px;
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
    padding-top: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        width: 320px;
    }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    /* top-bar wraps instead of overflowing */
    .top-bar {
        flex-wrap: wrap;
        height: auto;
        padding: 6px 12px;
        row-gap: 6px;
    }
    .status-indicators {
        gap: 12px;
        order: 3;
        width: 100%;
        justify-content: center;
    }

    /* app page becomes scrollable, sidebar under the map */
    body.app-page {
        display: block;
        height: auto;
        overflow: auto;
    }
    .main-container {
        flex-direction: column;
    }
    .map-section {
        height: 55vh;
        min-height: 320px;
    }
    .sidebar {
        width: 100%;
        height: auto;
        max-height: none;
    }
    .news-list {
        max-height: 55vh;
    }

    /* layer panel becomes a bottom sheet */
    .layer-panel {
        top: auto;
        bottom: 15px;
        left: 15px;
        right: 15px;
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        min-width: 0;
    }
    .layer-panel h4 {
        width: 100%;
        margin-bottom: 0;
    }
    .layer-panel hr {
        display: none;
    }

    .map-legend {
        display: none;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .footer-columns {
        grid-template-columns: 1fr;
    }

    .site-header-inner {
        gap: 10px;
        padding: 8px 12px;
    }

    .site-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .top-actions {
        margin-inline-start: auto;
    }

    .ad-slot {
        padding: 14px 8px 10px;
        margin: 10px 0;
    }

    .time-filter {
        max-width: calc(100vw - 20px);
        overflow-x: auto;
    }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
    .top-bar,
    .site-header,
    .bottom-ticker,
    .city-strip,
    .city-chips,
    .layer-panel,
    .time-filter,
    .site-footer,
    .btn-icon,
    .vote-btns,
    .toast,
    .quick-services {
        display: none !important;
    }

    body,
    body.app-page {
        overflow: visible;
        height: auto;
        display: block;
        background: #fff;
        color: #000;
    }

    .card,
    .news-card,
    .data-table {
        border-color: #ccc;
        box-shadow: none;
    }
}

/* ============================================
   LIVE WIDGETS (weather strip, quakes, officials)
   ============================================ */

/* Weather strip (index, under city chips) */
.weather-strip {
    display: flex;
    align-items: center;
    overflow-x: auto;
    padding: 4px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    flex-shrink: 0;
    scrollbar-width: thin;
    font-size: 12px;
}

.weather-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 12px;
    border-left: 1px solid var(--border-color);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.weather-item:first-child {
    border-left: none;
}

.weather-item .w-icon {
    font-size: 15px;
}

.weather-temp {
    font-weight: 700;
    color: var(--text-primary);
}

.weather-update {
    margin-inline-start: auto;
    color: var(--text-muted);
    font-size: 11px;
    padding: 3px 0;
    flex-shrink: 0;
}

/* Rate source pill (auto official vs manual) */
.src-badge {
    display: inline-block;
    padding: 0 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 700;
    background: #1abc9c;
    color: #07332a;
    vertical-align: middle;
}

/* Officials directory */
.officials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.official-card {
    display: block;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.official-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.official-card .official-name {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
}

.official-card .official-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Earthquake magnitude badge (bg color set inline by magnitude) */
.quake-badge {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

/* ============================================
   LIVE AUTO-REFRESH (live.js) + AD SLOT
   ============================================ */

/* Flash animation on newly prepended news cards: subtle accent glow that
   fades back to transparent over ~2s, then live.js removes the class. */
@keyframes sytNewFlash {
    0%   { background-color: var(--accent-glow); }
    100% { background-color: transparent; }
}

.news-card.new-flash {
    animation: sytNewFlash 2s ease-out;
}

/* Ad slot (rendered by renderAdSlot when the ads module is present).
   Reserves vertical space so the layout doesn't jump when the ad loads. */
.ad-slot {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 18px 12px 12px;
    position: relative;
    overflow: hidden;
    margin: 12px 0;
    border-radius: var(--radius);
}

/* Tiny muted "إعلان" label above the creative */
.ad-slot::before {
    content: 'إعلان';
    position: absolute;
    top: 3px;
    inset-inline-start: 10px;
    font-size: 9px;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.ad-slot ins {
    max-width: 100%;
}

/* ============================================
   Syria Guide (guide.php) + Modern History (history.php)
   ============================================ */

/* Hub: governorate cards grid (responsive 2-3 col) */
.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.gov-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.gov-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.gov-card h2 {
    font-size: 19px;
    margin: 0;
}

.gov-card h2 a {
    color: var(--text-primary);
    text-decoration: none;
}

.gov-card h2 a:hover {
    color: var(--accent);
}

.gov-tagline {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    flex: 1;
}

.gov-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gov-chips span {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 12px;
}

.gov-more {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
}

.gov-more:hover {
    text-decoration: underline;
}

.guide-history-cta {
    border-color: var(--accent);
}

/* Detail: tagline as styled lead paragraph */
.tagline-lead {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

/* Detail: landmarks grid */
.landmark-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.landmark-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px;
}

.landmark-card h3 {
    font-size: 15px;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.landmark-card p {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin: 0;
}

/* Detail: prev/next navigation */
.guide-prevnext {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.guide-prevnext a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
}

.guide-prevnext a:hover {
    text-decoration: underline;
}

/* Modern history: vertical RTL timeline */
.timeline {
    border-right: 2px solid var(--accent);
    padding-right: 22px;
    margin: 25px 6px 25px 0;
}

.timeline section {
    margin-bottom: 30px;
}

.era-header {
    position: sticky;
    top: 60px;
    z-index: 5;
    background: var(--bg-primary);
    background: color-mix(in srgb, var(--bg-primary) 82%, transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    font-size: 20px;
    color: var(--accent);
    padding: 10px 14px;
    margin: 0 0 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.event-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 15px 18px;
    margin-bottom: 14px;
}

.event-card::before {
    content: '';
    position: absolute;
    right: -30px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-primary);
    box-shadow: 0 0 0 2px var(--accent);
}

.date-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
    margin-bottom: 8px;
}

.event-card h3 {
    font-size: 16px;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.event-card p {
    font-size: 14px;
    line-height: 1.9;
    color: var(--text-secondary);
    margin: 0;
}

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

    .timeline {
        padding-right: 16px;
        margin-right: 2px;
    }

    .event-card::before {
        right: -24px;
    }

    .era-header {
        top: 50px;
        font-size: 17px;
    }
}

/* City page: cross-link into the Syria Guide */
.guide-crosslink {
    text-align: center;
}

.guide-crosslink a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
}

.guide-crosslink a:hover {
    text-decoration: underline;
}

/* ============================================
   On This Day (Syrian Memory) — widget + page
   ============================================ */
.otd-widget {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 15px;
}

.otd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.otd-header span:first-child {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.otd-more {
    font-size: 11px;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.otd-more:hover {
    text-decoration: underline;
}

.otd-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.otd-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    font-size: 13px;
}

.otd-item:last-child {
    border-bottom: none;
}

.otd-year {
    flex-shrink: 0;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
}

.otd-item-title {
    color: var(--text-secondary);
    line-height: 1.6;
}

.otd-empty {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* Page: year blocks and event rows */
.otd-year-block {
    margin-bottom: 18px;
}

.otd-year-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.otd-year-title .otd-year {
    font-size: 15px;
    padding: 3px 12px;
}

.otd-year-title small {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}

.otd-event {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.otd-event:last-child {
    border-bottom: none;
}

.otd-event-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.otd-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    align-self: center;
}

.otd-event-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.7;
    margin: 0;
}

.otd-event-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.otd-type-chip {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1px 9px;
    font-size: 11px;
}

.otd-geo {
    color: var(--text-muted);
    font-size: 12px;
}

.otd-source {
    margin-inline-start: auto;
    color: var(--accent);
    font-size: 12px;
    text-decoration: none;
}

.otd-source:hover {
    text-decoration: underline;
}

/* Date picker */
.otd-picker-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.otd-picker {
    display: flex;
    align-items: center;
    gap: 8px;
}

.otd-picker select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
}

.otd-picker button {
    padding: 8px 18px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.otd-picker button:hover {
    opacity: 0.9;
}

.otd-nav {
    color: var(--accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.otd-nav:hover {
    text-decoration: underline;
}

.otd-credit {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}
