@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Nastaliq+Urdu:wght@400;600;700&family=Noto+Sans+Arabic:wght@400;600;700&display=swap');

:root {
    --gb-navy-dark: #f8fafc;
    --gb-navy-card: #ffffff;
    --gb-navy-surface: #0f2942;
    --gb-navy-border: #cbd5e1;
    --gb-police-blue: #0f2942;
    --gb-police-blue-light: #1e40af;
    --gb-gold: #d97706;
    --gb-gold-bright: #b45309;
    --gb-green: #059669;
    --gb-green-light: #10b981;
    --gb-red: #dc2626;
    --gb-red-light: #ef4444;
    --gb-blue: #2563eb;
    --gb-text-main: #0f172a;
    --gb-text-muted: #475569;
    --font-en: 'Inter', system-ui, -apple-system, sans-serif;
    --font-ur: 'Noto Nastaliq Urdu', 'Noto Sans Arabic', 'Inter', serif;
}

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

body {
    font-family: var(--font-en);
    background-color: var(--gb-navy-dark);
    color: var(--gb-text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

html[dir="rtl"] body {
    font-family: var(--font-ur);
    line-height: 1.8;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gb-police-blue);
}

/* White Card Surface */
.police-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.police-card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 41, 66, 0.08);
    border-color: rgba(15, 41, 66, 0.2);
}

/* Ultra-Responsive Top Navigation Bar */
.navbar-police {
    background: linear-gradient(180deg, #0a1e36 0%, #0f2942 100%);
    border-bottom: 3.5px solid var(--gb-gold);
    padding: 0.65rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.25);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav-brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.nav-logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35));
}

.nav-brand-text {
    display: flex;
    flex-direction: column;
}

.nav-brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.nav-brand-sub {
    font-size: 0.725rem;
    color: #fbbf24;
    font-weight: 700;
    letter-spacing: 0.4px;
}

html[dir="rtl"] .nav-brand-title {
    font-size: 1.25rem;
}

.nav-controls-wrapper {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.nav-link-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    font-size: 0.825rem;
    white-space: nowrap;
}

.nav-link-btn:hover, .nav-link-btn.active {
    background: rgba(217, 119, 6, 0.2);
    color: #fbbf24;
    border-color: #d97706;
}

.mobile-menu-toggle {
    display: none;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid var(--gb-gold);
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 9px;
    font-size: 1.25rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: var(--gb-gold);
    color: #ffffff;
}

.nav-user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 0.85rem;
}

html[dir="rtl"] .nav-user-badge {
    border-left: none;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    padding-left: 0;
    padding-right: 0.85rem;
}

.user-name-span {
    font-size: 0.825rem;
    font-weight: 700;
    color: #e5e7eb;
}

/* Mobile Responsive Navigation Overlay Drawer */
@media (max-width: 900px) {
    .nav-container {
        flex-wrap: wrap;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav-logo-img {
        height: 40px;
    }

    .nav-brand-title {
        font-size: 0.95rem;
    }

    .nav-brand-sub {
        font-size: 0.65rem;
    }

    .nav-controls-wrapper {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        padding-top: 0.85rem;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        margin-top: 0.4rem;
        background: #071526;
        padding: 1rem;
        border-radius: 10px;
        box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    }

    .nav-controls-wrapper.active {
        display: flex;
    }

    .nav-link-btn, .lang-toggle-btn {
        width: 100%;
        justify-content: center;
        padding: 0.6rem;
    }

    .nav-user-badge {
        border-left: none;
        border-right: none;
        padding-left: 0;
        padding-right: 0;
        border-top: 1px solid rgba(255,255,255,0.15);
        padding-top: 0.75rem;
        margin-top: 0.35rem;
        justify-content: space-between;
    }
}

/* Buttons */
.btn-police-gold {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #ffffff;
    font-weight: 700;
    border: 1px solid #f59e0b;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    font-size: 0.8rem;
    white-space: nowrap;
}

.btn-police-gold:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3);
    transform: translateY(-1px);
}

.btn-police-navy {
    background: #ffffff;
    color: #0f2942;
    border: 1px solid #cbd5e1;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.btn-police-navy:hover {
    background: #0f2942;
    color: #ffffff;
    border-color: #0f2942;
}

.btn-police-red {
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: #ffffff;
    border: 1px solid #ef4444;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    white-space: nowrap;
}

.btn-police-red:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Badges & Pills */
.reg-pill {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
    font-size: 0.725rem;
    font-weight: 800;
    display: inline-block;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.cat-pill {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    font-weight: 800;
    font-size: 0.7rem;
    display: inline-block;
    white-space: nowrap;
}

/* Metric Cards */
.kpi-card {
    position: relative;
    overflow: hidden;
    padding: 1.1rem 1.25rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gb-gold);
}

html[dir="rtl"] .kpi-card::before {
    left: auto;
    right: 0;
}

.kpi-card.kpi-green::before { background: var(--gb-green); }
.kpi-card.kpi-red::before { background: var(--gb-red); }
.kpi-card.kpi-blue::before { background: var(--gb-blue); }

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.kpi-label {
    font-size: 0.8rem;
    color: #475569;
    font-weight: 600;
    margin-top: 0.2rem;
}

/* Status Clearance Badges */
.badge-clear {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.725rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.badge-medium {
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fde047;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.725rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.badge-high {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.725rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.badge-registered {
    background: #f0f9ff;
    color: #0369a1;
    border: 1px solid #bae6fd;
    padding: 0.18rem 0.5rem;
    border-radius: 6px;
    font-size: 0.725rem;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.coord-pill {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    padding: 0.12rem 0.4rem;
    border-radius: 4px;
    font-size: 0.675rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

/* Leaflet Map Customization */
#gb-police-map {
    width: 100%;
    height: 440px;
    border-radius: 10px;
    z-index: 1;
    border: 1px solid #cbd5e1;
}

.leaflet-popup-content-wrapper {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 2px solid var(--gb-police-blue);
    border-radius: 8px !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2) !important;
}

.leaflet-popup-tip {
    background: #ffffff !important;
}

/* Light Theme Desktop Table Header & Container */
.table-desktop-container {
    width: 100%;
}

.table-responsive-wrapper {
    width: 100%;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.03);
}

.table-police {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

/* Light Theme Header Row */
.table-police th {
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    color: #0f2942;
    font-weight: 800;
    font-size: 0.775rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.8rem 0.9rem;
    border-bottom: 3px solid var(--gb-gold);
    border-top: 1px solid #cbd5e1;
    text-align: left;
    white-space: nowrap;
}

html[dir="rtl"] .table-police th {
    text-align: right;
    font-size: 0.9rem;
}

.table-police td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.825rem;
    color: #1e293b;
    vertical-align: middle;
}

.table-police tbody tr {
    transition: all 0.15s ease;
}

.table-police tbody tr:nth-child(even) {
    background: #f8fafc;
}

.table-police tbody tr:hover {
    background: #f0f9ff;
}

/* Light District Section Header Row */
.district-section-header td {
    background: #e0f2fe !important;
    color: #0369a1 !important;
    font-weight: 800 !important;
    font-size: 0.85rem !important;
    padding: 0.65rem 0.9rem !important;
    border-top: 2px solid #7dd3fc !important;
    border-bottom: 2px solid #7dd3fc !important;
}

/* Mobile Responsive Cards Grid View */
.mobile-madrassa-grid {
    display: none;
    flex-direction: column;
    gap: 1rem;
}

.mobile-madrassa-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.1rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    position: relative;
    border-left: 4px solid var(--gb-police-blue);
}

.mobile-madrassa-card.high-risk {
    border-left-color: var(--gb-red);
}

.mobile-madrassa-card.medium-risk {
    border-left-color: var(--gb-gold);
}

/* Inputs & Form Controls */
.form-control-police {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    padding: 0.55rem 0.85rem;
    border-radius: 7px;
    width: 100%;
    font-size: 0.85rem;
    font-weight: 500;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control-police:focus {
    outline: none;
    border-color: #0f2942;
    box-shadow: 0 0 0 3px rgba(15, 41, 66, 0.12);
}

html[dir="rtl"] .form-control-police {
    font-family: var(--font-ur);
}

/* Modals */
.modal-police {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-police.active {
    display: flex;
}

.modal-police-content {
    background: #ffffff;
    border: 2px solid var(--gb-police-blue);
    border-radius: 12px;
    width: 100%;
    max-width: 880px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.3);
}

/* Language Toggle Switch */
.lang-toggle-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid #fbbf24;
    color: #ffffff;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    font-size: 0.825rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.lang-toggle-btn:hover {
    background: var(--gb-gold);
    color: #ffffff;
}

/* Responsive Media Queries */
@media (max-width: 992px) {
    .table-desktop-container {
        display: none;
    }
    .mobile-madrassa-grid {
        display: flex;
    }
}

@media (max-width: 768px) {
    .navbar-police {
        padding: 0.5rem 1rem;
    }
    .kpi-value {
        font-size: 1.4rem;
    }
    #gb-police-map {
        height: 340px;
    }
}
