/* ===========================
   Sinop Şehitleri Bilgi Sistemi
   Corporate Design System
   =========================== */

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

:root {
    /* Corporate Colors - Turkish Flag & Government */
    --primary: #8B1A1A;
    --primary-dark: #6B0F0F;
    --primary-light: #A52A2A;
    --secondary: #C9A84C;
    --secondary-light: #D4B96A;
    --accent: #1A3A5C;
    --accent-light: #2A5A8C;

    /* Neutrals */
    --bg-dark: #0F1419;
    --bg-card: #1A1F2E;
    --bg-card-hover: #242A3D;
    --bg-glass: rgba(26, 31, 46, 0.85);
    --bg-glass-light: rgba(255, 255, 255, 0.05);
    --surface: #1E2433;
    --surface-hover: #2A3142;

    /* Text */
    --text-primary: #F0F0F0;
    --text-secondary: #A0A8B8;
    --text-muted: #6B7280;

    /* Status */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(139, 26, 26, 0.3);

    /* Border opacity tokens */
    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-light: rgba(255, 255, 255, 0.04);
    --border-input: rgba(255, 255, 255, 0.1);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-hover: rgba(255, 255, 255, 0.03);
    --bg-hover-medium: rgba(255, 255, 255, 0.05);
    --bg-hover-strong: rgba(255, 255, 255, 0.08);
    --bg-hover-extra: rgba(255, 255, 255, 0.12);
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
    --bg-dark: #F5F6FA;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F0F1F5;
    --bg-glass: rgba(255, 255, 255, 0.92);
    --bg-glass-light: rgba(0, 0, 0, 0.03);
    --surface: #F8F9FC;
    --surface-hover: #EEF0F5;

    --text-primary: #1A1F2E;
    --text-secondary: #555D6E;
    --text-muted: #8B92A0;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(139, 26, 26, 0.1);

    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-light: rgba(0, 0, 0, 0.05);
    --border-input: rgba(0, 0, 0, 0.12);
    --bg-input: rgba(0, 0, 0, 0.03);
    --bg-hover: rgba(0, 0, 0, 0.02);
    --bg-hover-medium: rgba(0, 0, 0, 0.04);
    --bg-hover-strong: rgba(0, 0, 0, 0.05);
    --bg-hover-extra: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] body {
    background: linear-gradient(135deg, #e8ecf4 0%, #f0f2f8 30%, #f5f6fa 60%, #fafbfd 100%);
}

[data-theme="light"] .login-card {
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar {
    border-right-color: rgba(0, 0, 0, 0.08);
    background: #FFFFFF;
}

[data-theme="light"] .sidebar-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .sidebar-footer {
    border-top-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .nav-item.active {
    background: rgba(139, 26, 26, 0.08);
}

[data-theme="light"] .form-control {
    background: var(--bg-input);
    border-color: var(--border-input);
    color: var(--text-primary);
}

[data-theme="light"] .form-control:focus {
    background: rgba(0, 0, 0, 0.02);
    box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.12);
}

[data-theme="light"] .btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .card {
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .card-header {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .stat-card {
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] thead th {
    background: rgba(0, 0, 0, 0.02);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] tbody td {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="light"] .search-box input {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

[data-theme="light"] .filter-select {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
}

[data-theme="light"] .modal {
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .modal-close {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .toast {
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .tabs {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .tab:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .chip {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .info-item {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .mobile-toggle {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .loading-spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary);
}

[data-theme="light"] .dropdown-content {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .dropdown-content div {
    border-bottom-color: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .dropdown-content div:hover {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .map-container {
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .profile-photo-placeholder {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Background effects: dim in light mode */
[data-theme="light"] .bg-ring {
    border-color: rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .bg-orb {
    opacity: 0.3;
}

[data-theme="light"] .bg-mesh {
    opacity: 0.15;
}

[data-theme="light"] .login-divider {
    background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), var(--primary), transparent);
}

/* ===== THEME SWITCHER ===== */
.theme-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    background: var(--bg-hover-medium);
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

.theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

.theme-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 4px rgba(139, 26, 26, 0.3);
}

.theme-btn .theme-icon {
    font-size: 0.85rem;
    line-height: 1;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #0a1a2e 0%, #081428 30%, #050e1a 60%, #030812 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== LOGIN PAGE ===== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* ===== LOGIN BACKGROUND EFFECTS ===== */
.login-bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* --- Gray Ring Outlines (yuvarlak hatlı gri çizgiler) --- */
.bg-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.bg-ring:nth-child(1) {
    width: 700px;
    height: 700px;
    top: -15%;
    right: -10%;
    border-width: 1.5px;
    border-color: rgba(255, 255, 255, 0.05);
    animation: ringDrift1 35s ease-in-out infinite;
}

.bg-ring:nth-child(2) {
    width: 500px;
    height: 500px;
    bottom: -10%;
    left: -8%;
    border-width: 1px;
    border-color: rgba(255, 255, 255, 0.04);
    animation: ringDrift2 40s ease-in-out infinite;
}

.bg-ring:nth-child(3) {
    width: 900px;
    height: 900px;
    top: 20%;
    left: 30%;
    transform: translate(-50%, -50%);
    border-width: 1px;
    border-color: rgba(255, 255, 255, 0.03);
    animation: ringDrift3 50s ease-in-out infinite;
}

.bg-ring:nth-child(4) {
    width: 350px;
    height: 350px;
    top: 60%;
    right: 5%;
    border-width: 1px;
    border-color: rgba(255, 255, 255, 0.05);
    animation: ringDrift1 28s ease-in-out infinite reverse;
}

.bg-ring:nth-child(5) {
    width: 600px;
    height: 600px;
    top: -5%;
    left: 15%;
    border-width: 1px;
    border-color: rgba(255, 255, 255, 0.03);
    animation: ringDrift2 45s ease-in-out infinite reverse;
}

/* Ring drift animations */
@keyframes ringDrift1 {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    25% {
        transform: translate(20px, -15px) rotate(8deg);
    }

    50% {
        transform: translate(-10px, 25px) rotate(-5deg);
    }

    75% {
        transform: translate(15px, 10px) rotate(3deg);
    }
}

@keyframes ringDrift2 {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(-25px, 20px) rotate(-6deg);
    }

    66% {
        transform: translate(15px, -20px) rotate(4deg);
    }
}

@keyframes ringDrift3 {

    0%,
    100% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    25% {
        transform: translate(calc(-50% + 30px), calc(-50% - 20px)) rotate(5deg);
    }

    50% {
        transform: translate(calc(-50% - 20px), calc(-50% + 15px)) rotate(-3deg);
    }

    75% {
        transform: translate(calc(-50% + 10px), calc(-50% + 25px)) rotate(2deg);
    }
}

/* --- Glowing Orbs (mavi-mor ışık efektleri) --- */
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
}

.bg-orb:nth-child(6) {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(30, 64, 175, 0.18) 0%, transparent 70%);
    top: -5%;
    right: 10%;
    animation: orbFloat1 20s ease-in-out infinite;
}

.bg-orb:nth-child(7) {
    width: 280px;
    height: 280px;
    background: radial-gradient(circle, rgba(88, 28, 135, 0.14) 0%, transparent 70%);
    bottom: 10%;
    left: 5%;
    animation: orbFloat2 25s ease-in-out infinite;
}

.bg-orb:nth-child(8) {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.12) 0%, transparent 70%);
    top: 45%;
    left: 55%;
    animation: orbFloat1 30s ease-in-out infinite reverse;
}

/* Orb float animations */
@keyframes orbFloat1 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    25% {
        transform: translate(30px, -25px) scale(1.08);
    }

    50% {
        transform: translate(-15px, 20px) scale(0.95);
    }

    75% {
        transform: translate(20px, 10px) scale(1.03);
    }
}

@keyframes orbFloat2 {

    0%,
    100% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-20px, 15px) scale(1.05);
    }

    66% {
        transform: translate(25px, -10px) scale(0.97);
    }
}

/* --- Mesh Gradient Overlay --- */
.bg-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(15, 40, 80, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(20, 50, 100, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(10, 20, 50, 0.15) 0%, transparent 60%);
    animation: meshShift 30s ease-in-out infinite;
}

@keyframes meshShift {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.login-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    height: 80px;
    width: auto;
    margin-bottom: 16px;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.login-logo h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
}

.login-logo h1 span {
    color: var(--secondary);
}

.login-logo p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), var(--primary), transparent);
    margin: 24px 0;
    border: none;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

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

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23A0A8B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(139, 26, 26, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(139, 26, 26, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #DC2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-gold {
    background: linear-gradient(135deg, var(--secondary), #B8922D);
    color: #1A1F2E;
    font-weight: 700;
}

.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(201, 168, 76, 0.4);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ===== LAYOUT ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header img {
    height: 42px;
    width: auto;
}

.sidebar-header .brand {
    flex: 1;
}

.sidebar-header .brand h2 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.sidebar-header .brand p {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(139, 26, 26, 0.2);
    color: var(--secondary);
    border-left: 3px solid var(--secondary);
}

.nav-item .icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.nav-section {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 16px 16px 8px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-details h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-details p {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 24px;
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    overflow: hidden;
}

.stat-icon img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.stat-icon.red {
    background: rgba(139, 26, 26, 0.2);
}

.stat-icon.gold {
    background: rgba(201, 168, 76, 0.2);
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.2);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.2);
}

.stat-info h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Stats grid default: wrap on desktop */
#statsGrid {
    flex-wrap: wrap;
}

/* District grid */
.district-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    width: 100%;
}

/* Prevent horizontal overflow */
.main-content {
    overflow-x: hidden;
}

/* ===== TABLE ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 14px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

tbody td {
    padding: 14px 16px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* ===== TOOLBAR ===== */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 26, 26, 0.15);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
}

.filter-select {
    padding: 10px 36px 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A0A8B8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* ===== MAP ===== */
.map-container {
    height: 400px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 24px;
}

#map {
    width: 100%;
    height: 100%;
}

/* ===== PROFILE ===== */
.profile-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
}

.profile-photo-card {
    text-align: center;
}

.profile-photo {
    width: 220px;
    height: 280px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    border: 3px solid rgba(201, 168, 76, 0.3);
    margin-bottom: 16px;
}

.profile-photo-placeholder {
    width: 220px;
    height: 280px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 auto 16px;
}

.profile-photo-placeholder .icon {
    font-size: 3rem;
    opacity: 0.5;
}

.profile-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.info-item {
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.info-item label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 6px;
}

.info-item span {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ===== BULK ENTRY ===== */
.bulk-entry-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bulk-entry-item {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 16px;
    align-items: center;
    transition: all 0.2s ease;
}

.bulk-entry-item:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.bulk-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.5rem;
    overflow: hidden;
}

.bulk-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bulk-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.bulk-info .meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.bulk-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 140px;
}

.upload-area {
    position: relative;
    overflow: hidden;
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 90%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    min-width: 300px;
    max-width: 450px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
    font-size: 0.9rem;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.info {
    border-left: 4px solid var(--info);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

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

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

.badge-admin {
    background: rgba(201, 168, 76, 0.15);
    color: var(--secondary);
}

.badge-user {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.tab.active {
    background: var(--primary);
    color: white;
}

/* ===== PERMISSION CHIPS ===== */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chip .remove {
    cursor: pointer;
    color: var(--danger);
    font-weight: 700;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

/* ===== MOBILE HAMBURGER ===== */
.mobile-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* ===== LOADING ===== */
.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .profile-container {
        grid-template-columns: 1fr;
    }

    .profile-photo-card {
        display: flex;
        align-items: center;
        gap: 20px;
        text-align: left;
    }

    .profile-photo,
    .profile-photo-placeholder {
        width: 120px;
        height: 150px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 12px;
        padding-top: 64px;
    }

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

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header h1 {
        font-size: 1.2rem;
    }

    .toolbar {
        flex-direction: column;
        gap: 8px;
    }

    .search-box {
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .toolbar .btn {
        width: 100%;
        justify-content: center;
    }

    .toolbar .dropdown {
        width: 100%;
    }

    .toolbar .dropdown .btn {
        width: 100%;
    }

    /* Table horizontal scroll */
    .card .table-wrapper,
    .card>div:has(> table) {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    thead th,
    tbody td {
        padding: 10px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .profile-info {
        grid-template-columns: 1fr;
    }

    .bulk-entry-item {
        grid-template-columns: 60px 1fr;
    }

    .bulk-actions {
        grid-column: 1 / -1;
        flex-direction: row;
    }

    .login-card {
        padding: 28px 20px;
        margin: 0 12px;
    }

    .map-container {
        height: 250px;
    }

    .modal {
        width: 95%;
        padding: 20px;
        max-height: 85vh;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .card-header h3 {
        font-size: 0.95rem;
    }

    /* Stat cards: horizontal scroll on mobile */
    #statsGrid {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        gap: 10px !important;
        padding-bottom: 6px;
        margin-bottom: 16px !important;
    }

    #statsGrid>.stat-card {
        min-width: 130px !important;
        flex: 0 0 auto !important;
        padding: 12px !important;
    }

    #statsGrid>.stat-card:last-child {
        min-width: 280px !important;
    }

    #statsGrid .stat-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
    }

    #statsGrid .stat-info h4 {
        font-size: 1.1rem !important;
    }

    #statsGrid .stat-info p {
        font-size: 0.65rem !important;
    }

    /* District list: wrap on mobile */
    #districtList {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
    }

    #districtList>div {
        font-size: 0.65rem !important;
        padding: 4px 6px !important;
        white-space: nowrap;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
    }

    .pagination button {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    /* Card grid view */
    .cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* Form groups in modals */
    .form-row {
        flex-direction: column;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-control {
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }

    /* Toast on mobile */
    .toast-container {
        left: 12px;
        right: 12px;
        top: 12px;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    /* Tabs on mobile */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 10px;
        padding-top: 60px;
    }

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

    .profile-photo-card {
        flex-direction: column;
        text-align: center;
    }

    #districtList {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .cards-grid {
        grid-template-columns: 1fr !important;
    }

    .login-card {
        padding: 24px 16px;
    }

    .login-card h1 {
        font-size: 1.2rem;
    }

    .modal {
        padding: 16px;
        border-radius: var(--radius-lg);
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== ANIMATIONS ===== */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.slide-in-up {
    animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    body {
        background-color: white !important;
        color: black !important;
    }

    body::before {
        display: none !important;
    }

    .sidebar,
    .page-header button,
    .page-header a,
    .admin-only,
    .btn,
    .modal-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .profile-container {
        display: block !important;
    }

    .profile-photo-card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        margin-bottom: 20px !important;
        padding: 0 !important;
        page-break-inside: avoid;
    }

    .profile-photo {
        width: 150px !important;
        height: 200px !important;
        border: 2px solid #ccc !important;
        border-radius: 4px !important;
    }

    .info-item {
        background: transparent !important;
        border: 1px solid #ccc !important;
        color: black !important;
        page-break-inside: avoid;
    }

    .info-item label {
        color: #555 !important;
    }

    .info-item p {
        color: black !important;
    }

    .card {
        background: transparent !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        margin-bottom: 20px !important;
        color: black !important;
        page-break-inside: avoid;
    }

    .card-header h3 {
        color: black !important;
    }

    table {
        border: 1px solid #ccc !important;
    }

    thead th,
    tbody td {
        border-bottom: 1px solid #ccc !important;
        color: black !important;
    }

    #profileName {
        color: black !important;
        text-align: center;
        margin-bottom: 20px;
        font-size: 24pt;
    }
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-card);
    min-width: 180px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 8px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.dropdown-content div {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.dropdown-content div:last-child {
    border-bottom: none;
}

.dropdown-content div:hover {
    background: var(--bg-card-hover);
    color: var(--secondary);
}

.dropdown.active .dropdown-content {
    display: block;
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Force Uppercase on Specific Fields */
#newFullName,
#edFullName,
#fmName,
#newDistrict,
#edDistrict {
    text-transform: uppercase;
}