/* ============================================
   CITY NEWS WAR ROOM 2026 — Premium UI
   Theme: Red #D71920 | Blue #0B5ED7 | Dark #111827
   ============================================ */

:root {
    --primary: #D71920;
    --primary-dark: #B01419;
    --secondary: #0B5ED7;
    --dark: #111827;
    --dark-2: #1F2937;
    --dark-3: #374151;
    --grey: #6B7280;
    --light: #F3F4F6;
    --white: #FFFFFF;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans Devanagari', sans-serif;
    background: #F0F2F5;
    color: var(--dark);
    line-height: 1.5;
    font-size: 15px;
}

a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== LOGIN ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #111827 0%, #1F2937 50%, #D71920 100%);
    padding: 20px;
}
.login-box {
    width: 100%;
    max-width: 400px;
    padding: 40px 32px;
    border-radius: 20px;
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-header h1 { font-size: 22px; color: var(--dark); margin: 12px 0 4px; }
.tagline { color: var(--grey); font-size: 13px; }
.logo-circle {
    width: 64px; height: 64px;
    background: linear-gradient(135deg, var(--primary), #FF4D4D);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 22px;
    box-shadow: 0 8px 24px rgba(215,25,32,0.4);
}
.logo-circle.sm { width: 40px; height: 40px; font-size: 14px; }
.login-footer { text-align: center; margin-top: 20px; color: var(--grey); font-size: 12px; }

/* ===== GLASS ===== */
.glass {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: var(--shadow-lg);
}

/* ===== APP LAYOUT ===== */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 260px;
    background: var(--dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-header strong { display: block; font-size: 14px; }
.sidebar-header small { font-size: 11px; opacity: 0.6; }
.sidebar-close { display: none; background: none; border: none; color: white; font-size: 24px; cursor: pointer; margin-left: auto; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    color: rgba(255,255,255,0.7);
    font-size: 14px;
    transition: var(--transition);
    text-decoration: none;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(215,25,32,0.2);
    color: white;
    border-left: 3px solid var(--primary);
}
.sidebar-nav .icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user-info strong { display: block; font-size: 13px; }
.user-info small { font-size: 11px; opacity: 0.6; }

.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: white;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}
.menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--dark);
}
.search-box { flex: 1; max-width: 420px; position: relative; }
.search-box input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    font-size: 14px;
    background: var(--light);
}
.search-box input:focus { outline: none; border-color: var(--secondary); background: white; }
.search-results {
    display: none;
    position: absolute;
    top: 110%;
    left: 0; right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 360px;
    overflow-y: auto;
    z-index: 200;
}
.search-results.show { display: block; }
.search-results a {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid #F3F4F6;
    color: var(--dark);
    font-size: 13px;
}
.search-results a:hover { background: var(--light); }

.topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.user-badge {
    background: var(--light);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}
.notif-bell { font-size: 18px; cursor: pointer; }

.page-content {
    flex: 1;
    padding: 24px;
}

.app-footer {
    padding: 12px 24px;
    text-align: center;
    font-size: 12px;
    color: var(--grey);
    display: flex;
    justify-content: space-between;
    background: white;
    border-top: 1px solid #E5E7EB;
}

/* ===== CARDS & STATS ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 24px; font-weight: 700; }
.page-header p { color: var(--grey); font-size: 14px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card .number {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
}
.stat-card .label {
    font-size: 12px;
    color: var(--grey);
    margin-top: 4px;
    font-weight: 500;
}
.stat-card.blue .number { color: var(--secondary); }
.stat-card.green .number { color: var(--success); }
.stat-card.orange .number { color: var(--warning); }

/* ===== WARD GRID ===== */
.ward-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}
.ward-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid var(--grey);
    text-decoration: none;
    color: inherit;
    display: block;
}
.ward-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.ward-card.green { border-left-color: var(--success); }
.ward-card.yellow { border-left-color: var(--warning); }
.ward-card.blue { border-left-color: var(--secondary); }
.ward-card.grey { border-left-color: var(--grey); }
.ward-card .ward-no {
    font-size: 20px;
    font-weight: 800;
    color: var(--dark);
}
.ward-card .ward-meta {
    font-size: 12px;
    color: var(--grey);
    margin-top: 6px;
}
.ward-card .ward-meta span { display: block; }

/* ===== TABLES ===== */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.card-header h2 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

.table-responsive { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #F3F4F6;
}
th {
    background: #F9FAFB;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--grey);
}
tr:hover td { background: #F9FAFB; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--dark-2);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #D1D5DB;
    border-radius: 10px;
    font-size: 14px;
    transition: var(--transition);
    background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(11,94,215,0.15);
}
.form-group textarea { min-height: 90px; resize: vertical; }
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.2;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: #094bb0; }
.btn-success { background: var(--success); color: white; }
.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
}
.btn-outline-dark {
    background: white;
    border: 1px solid #D1D5DB;
    color: var(--dark);
}
.btn-outline-dark:hover { background: var(--light); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 16px; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    line-height: 1.4;
}
.badge-grey { background: var(--grey); }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #D1FAE5; color: #065F46; }
.alert-danger { background: #FEE2E2; color: #991B1B; }
.alert-warning { background: #FEF3C7; color: #92400E; }
.alert-info { background: #DBEAFE; color: #1E40AF; }

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #E5E7EB;
    margin-bottom: 20px;
    overflow-x: auto;
}
.tab {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--grey);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== PROGRESS ===== */
.progress-bar {
    height: 8px;
    background: #E5E7EB;
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ===== PHOTO ===== */
.avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--light);
}
.avatar-lg { width: 100px; height: 100px; }

/* ===== ACTION BUTTONS ===== */
.action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.action-btns .btn { padding: 6px 10px; font-size: 12px; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--grey);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .main-content { margin-left: 0; }
    .menu-btn { display: block; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .page-content { padding: 16px; }
    .topbar { padding: 10px 14px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card .number { font-size: 22px; }
    .ward-grid { grid-template-columns: 1fr 1fr; }
    .page-header h1 { font-size: 20px; }
}

/* ===== UTILS ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--grey); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.d-flex { display: flex; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

/* Candidate photo in table */
.cand-photo {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #E5E7EB;
}

/* Heat map legend */
.legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    font-size: 13px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.legend-dot {
    width: 12px; height: 12px;
    border-radius: 3px;
}

/* Print attendance */
@media print {
    .sidebar, .topbar, .app-footer, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
}
/* ===== SIDEBAR STRUCTURED ===== */
.sidebar { width: 268px; background: linear-gradient(180deg, #0B0F19 0%, #111827 100%); }
.sidebar-brand strong { letter-spacing: 0.02em; }
.nav-section { padding: 8px 0 4px; }
.nav-label {
    padding: 8px 18px 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
}
.sidebar-nav a {
    margin: 1px 8px;
    border-radius: 10px;
    border-left: none !important;
    padding: 10px 12px;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: rgba(215,25,32,0.22) !important;
    color: #fff !important;
    box-shadow: inset 3px 0 0 var(--primary);
}
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
}
.sidebar-overlay.show { display: block; }

.breadcrumb-mini {
    font-size: 13px;
    color: var(--grey);
    white-space: nowrap;
    margin-right: 8px;
}
.breadcrumb-mini a { color: var(--secondary); font-weight: 600; text-decoration: none; }
.breadcrumb-mini a:hover { text-decoration: underline; }
.bc-sep { margin: 0 6px; opacity: 0.5; }
.bc-current { color: var(--dark); font-weight: 600; }

.search-box { position: relative; flex: 1; max-width: 480px; }
.search-box .search-ico {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    font-size: 14px; pointer-events: none; opacity: 0.5;
}
.search-box input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    background: #F9FAFB;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(215,25,32,0.12);
    background: #fff;
}
.search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: #fff; border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    border: 1px solid #E5E7EB;
    max-height: 360px; overflow-y: auto;
    z-index: 200;
}
.search-results a {
    display: block; padding: 10px 14px;
    color: var(--dark); text-decoration: none;
    border-bottom: 1px solid #F3F4F6; font-size: 13px;
}
.search-results a:hover { background: #FEF2F2; }
.search-results .sr-type {
    font-size: 10px; font-weight: 700; color: var(--primary);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.topbar-chip {
    display: inline-flex; width: 36px; height: 36px;
    align-items: center; justify-content: center;
    border-radius: 10px; background: #F3F4F6; text-decoration: none;
}
.user-badge {
    font-size: 13px; font-weight: 600;
    padding: 6px 12px; background: #F3F4F6; border-radius: 999px;
}

/* Filter + Pagination */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
    padding: 14px 16px; background: #fff; border-radius: 14px;
    border: 1px solid #E5E7EB; margin-bottom: 14px;
}
.filter-bar .form-group { margin: 0; min-width: 140px; flex: 1; }
.filter-bar label { font-size: 11px; font-weight: 600; color: var(--grey); margin-bottom: 4px; display: block; }
.filter-bar input, .filter-bar select {
    width: 100%; padding: 9px 11px; border-radius: 10px;
    border: 1px solid #E5E7EB; font-size: 14px; background: #F9FAFB;
}
.filter-actions { display: flex; gap: 8px; align-items: center; padding-bottom: 2px; }
.pagination-bar {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
    gap: 10px; padding: 12px 4px; margin-top: 8px;
}
.page-info { font-size: 13px; color: var(--grey); }
.page-links { display: flex; gap: 4px; flex-wrap: wrap; }
.page-btn {
    min-width: 34px; height: 34px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; border: 1px solid #E5E7EB; background: #fff;
    color: var(--dark); font-size: 13px; font-weight: 600; text-decoration: none;
}
.page-btn:hover { background: #F3F4F6; text-decoration: none; }
.page-btn.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
}

.page-header {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start;
    gap: 12px; margin-bottom: 16px;
}
.page-header h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.page-header .text-muted, .page-header p { color: var(--grey); font-size: 13px; margin-top: 4px; }

@media (max-width: 900px) {
    .breadcrumb-mini { display: none; }
    .sidebar-overlay.show { display: block; }
}


/* —— Professional sidebar v2 —— */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #0B1220 0%, #0F172A 55%, #111827 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand strong {
  display: block;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #F8FAFC;
}
.sidebar-brand small {
  display: block;
  font-size: 11px;
  color: #94A3B8;
  margin-top: 2px;
  font-weight: 500;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}
.nav-section {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.nav-section:last-child,
.nav-section-end {
  border-bottom: none;
  margin-top: 4px;
}
.nav-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #64748B;
  padding: 10px 12px 6px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 0;
  border-radius: 10px;
  color: #CBD5E1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s, transform .1s;
}
.sidebar-nav a .icon {
  width: 22px;
  text-align: center;
  font-size: 15px;
  opacity: .9;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}
.sidebar-nav a.active {
  background: linear-gradient(135deg, rgba(37,99,235,.35), rgba(37,99,235,.18));
  color: #fff;
  box-shadow: inset 3px 0 0 #3B82F6;
}
.sidebar-footer {
  padding: 14px 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.2);
}
.sidebar-footer .user-info strong {
  display: block;
  font-size: 13px;
  color: #F1F5F9;
}
.sidebar-footer .user-info small {
  color: #94A3B8;
  font-size: 11px;
}

#syncBtn.spinning{animation:ems-spin .6s linear infinite}
@keyframes ems-spin{to{transform:rotate(360deg)}}
