/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #1a2732;
    min-height: 100vh;
}

a { color: #1e88e5; text-decoration: none; }
a:hover { color: #1565c0; }

/* === Navbar === */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    padding: 0 24px;
    height: 56px;
    border-bottom: 1px solid #e0e4ea;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.navbar-brand {
    font-size: 18px;
    font-weight: 700;
    color: #1a2732;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo { font-size: 24px; }

.navbar-menu { display: flex; gap: 4px; }

.nav-link {
    padding: 8px 16px;
    border-radius: 6px;
    color: #4a5568;
    font-size: 14px;
    transition: all 0.2s;
}
.nav-link:hover { background: #f0f2f5; color: #1a2732; }
.nav-link.active { background: #1e88e5; color: #fff; }

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #4a5568;
    font-size: 14px;
}

/* === Language Switcher === */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f0f2f5;
    border-radius: 8px;
    padding: 3px;
}
.lang-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: #4a5568;
    transition: all 0.2s;
    letter-spacing: 0.3px;
}
.lang-btn:hover { background: #e0e4ea; color: #1a2732; }
.lang-btn.active { background: #ffffff; color: #1e88e5; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* === Container === */
.container { padding: 20px 24px; max-width: 1600px; margin: 0 auto; }

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-primary { background: #1e88e5; color: #fff; }
.btn-primary:hover { background: #1565c0; color: #fff; }
.btn-danger { background: #e53935; color: #fff; }
.btn-danger:hover { background: #c62828; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #d0d5dd; color: #4a5568; }
.btn-outline:hover { background: #f0f2f5; color: #1a2732; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Cards === */
.card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e0e4ea;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #e0e4ea;
    background: #fafbfc;
}
.card-header h2 { font-size: 16px; font-weight: 600; color: #1a2732; }
.card-body { padding: 18px; }

/* === Badge === */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-warning { background: #fff3e0; color: #e65100; }
.badge-danger { background: #ffebee; color: #c62828; }

/* === Forms === */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    color: #1a2732;
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-control:focus {
    outline: none;
    border-color: #1e88e5;
    box-shadow: 0 0 0 3px rgba(30,136,229,0.1);
}
select.form-control { cursor: pointer; }
.field-error { color: #e53935; font-size: 12px; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* === Table === */
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th, .table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e0e4ea;
    font-size: 14px;
}
.table th {
    background: #f8fafc;
    color: #4a5568;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.table tbody tr:hover { background: #f5f7fa; }
.row-danger { background: rgba(229, 57, 53, 0.06); }
.row-warning { background: rgba(255, 152, 0, 0.06); }

code {
    background: #f0f2f5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    color: #1565c0;
}

/* === Avatar === */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0e4ea;
    color: #6b7280;
    font-size: 18px;
}

/* === Page Header === */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.page-header h1 { font-size: 24px; font-weight: 600; }

/* === Messages/Alerts === */
.messages { padding: 10px 24px; }
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
}
.alert-error, .alert-danger { background: #fff5f5; border: 1px solid #fca5a5; color: #c62828; }
.alert-success, .alert-info { background: #eff6ff; border: 1px solid #93c5fd; color: #1565c0; }
.alert-warning { background: #fffbeb; border: 1px solid #fcd34d; color: #b45309; }

/* === Dashboard Layout === */
.dashboard {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
    min-height: calc(100vh - 96px);
}

.dashboard-main { display: flex; flex-direction: column; gap: 20px; }
.dashboard-sidebar { display: flex; flex-direction: column; gap: 20px; }

/* === Video === */
.video-card .card-header { flex-wrap: wrap; gap: 8px; }
.camera-controls { display: flex; align-items: center; gap: 8px; }

.video-container {
    position: relative;
    background: #1a2732;
    aspect-ratio: 4/3;
}
.video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* === Alerts Sidebar === */
.alerts-card { flex: 1; }
.alerts-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}
.alert-item {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 13px;
    transition: background 0.2s;
}
.alert-item:hover { background: #f5f7fa; }
.alert-item.alert-danger { border-left: 3px solid #e53935; }
.alert-item.alert-warning { border-left: 3px solid #ff9800; }
.alert-item.alert-info { border-left: 3px solid #1e88e5; }
.alert-icon { font-size: 16px; flex-shrink: 0; }
.alert-content { flex: 1; }
.alert-message { margin-bottom: 2px; color: #1a2732; }
.alert-time { color: #9ca3af; font-size: 11px; }

/* === Stats === */
.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #e0e4ea;
}
.stat-item:last-child { border-bottom: none; }
.stat-label { color: #4a5568; font-size: 14px; }
.stat-value { font-size: 20px; font-weight: 700; color: #1e88e5; }

/* === Turnstile === */
.turnstile-card .card-body { padding: 18px; }
.turnstile-result {
    margin-top: 16px;
    padding: 14px;
    border-radius: 6px;
    font-size: 14px;
}
.turnstile-granted { background: #f0fdf4; border: 1px solid #86efac; color: #15803d; }
.turnstile-denied { background: #fffbeb; border: 1px solid #fcd34d; color: #b45309; }
.turnstile-tailgating { background: #fff5f5; border: 2px solid #fca5a5; color: #c62828; }

/* === Login Page === */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #e8f0fe 0%, #f0f2f5 100%);
}
.login-container {
    width: 400px;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e0e4ea;
    padding: 40px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.login-header {
    text-align: center;
    margin-bottom: 30px;
}
.login-logo { font-size: 48px; display: block; margin-bottom: 12px; }
.login-header h1 { font-size: 24px; margin-bottom: 6px; color: #1a2732; }
.login-header p { color: #6b7280; font-size: 14px; }
.login-form .form-group { margin-bottom: 20px; }

/* === Login lang switcher === */
.login-lang {
    text-align: center;
    margin-bottom: 20px;
}

/* === Photos Grid === */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.photo-card {
    background: #f8fafc;
    border: 1px solid #e0e4ea;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
}
.photo-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
}
.photo-info { padding: 6px; }
.photo-delete-form { padding: 0 6px 6px; }
.field-hint { color: #9ca3af; font-size: 12px; margin-top: 4px; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f0f2f5; }
::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a0b0c0; }

/* === Stat Cards Grid === */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e0e4ea;
    padding: 20px 20px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.stat-card-icon { font-size: 22px; }
.stat-card-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    color: #1e88e5;
}
.stat-card-value.value-success { color: #16a34a; }
.stat-card-value.value-danger  { color: #dc2626; }
.stat-card-value.value-warning { color: #d97706; }
.stat-card-value.value-dark    { color: #1a2732; }
.stat-card-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}
.stat-card-sub {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

/* === Breadcrumbs === */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 14px;
}
.breadcrumbs a { color: #6b7280; }
.breadcrumbs a:hover { color: #1e88e5; }
.breadcrumb-sep { color: #d0d5dd; font-size: 11px; }
.breadcrumbs span { color: #1a2732; font-weight: 500; }

/* === Dropdown Nav === */
.nav-dropdown { position: relative; }
.nav-dropdown-label {
    padding: 8px 16px;
    border-radius: 6px;
    color: #4a5568;
    font-size: 14px;
    transition: all 0.2s;
    cursor: default;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}
.nav-dropdown-label:hover { background: #f0f2f5; color: #1a2732; }
.nav-dropdown-label.active { background: #1e88e5; color: #fff; }
.nav-dropdown-arrow { font-size: 10px; opacity: 0.6; }
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    background: #ffffff;
    border: 1px solid #e0e4ea;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 180px;
    z-index: 200;
    padding: 6px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease, visibility 0.12s ease;
    transition-delay: 0.2s;
}
.nav-dropdown:hover .nav-dropdown-menu {
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}
.nav-dropdown-menu .nav-link {
    display: block;
    white-space: nowrap;
    border-radius: 5px;
}
.nav-dropdown-menu .nav-link + .nav-link { margin-top: 2px; }

/* === Status Badges === */
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-granted  { background: #dcfce7; color: #15803d; }
.badge-denied   { background: #fef2f2; color: #dc2626; }
.badge-tailgating { background: #fff7ed; color: #c2410c; }
.badge-vip      { background: #f3e8ff; color: #7c3aed; }
.badge-visitor  { background: #fef9c3; color: #92400e; }
.badge-employee { background: #eff6ff; color: #1d4ed8; }

/* === Employee Profile === */
.profile-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    align-items: start;
}
.profile-photo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e0e4ea;
}
.profile-photo-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: #e0e4ea;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    color: #9ca3af;
}
.profile-name {
    font-size: 22px;
    font-weight: 700;
    color: #1a2732;
    margin-bottom: 6px;
}
.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
}
.info-item-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 3px;
}
.info-item-value {
    font-size: 14px;
    color: #1a2732;
    font-weight: 500;
}

/* === Section Title === */
.section-title {
    font-size: 15px;
    font-weight: 600;
    color: #1a2732;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e4ea;
}

/* === Stats Page === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}
.stats-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    margin-bottom: 12px;
}
.progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.progress-bar-label { font-size: 13px; color: #4a5568; min-width: 120px; }
.progress-bar-track {
    flex: 1;
    height: 8px;
    background: #f0f2f5;
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: #1e88e5;
    transition: width 0.5s ease;
}
.progress-bar-fill.fill-success { background: #16a34a; }
.progress-bar-fill.fill-danger  { background: #dc2626; }
.progress-bar-fill.fill-warning { background: #d97706; }
.progress-bar-count { font-size: 13px; font-weight: 600; color: #1a2732; min-width: 32px; text-align: right; }

/* === Filter Bar === */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-bar .btn.active-filter { background: #1e88e5; color: #fff; border-color: #1e88e5; }

/* === Responsive === */
@media (max-width: 1024px) {
    .dashboard { grid-template-columns: 1fr; }
    .profile-layout { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: 1fr; }
}
