/* ============================================================
   GRIKARE ANPR CLOUD - DARK INDUSTRIAL THEME
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;600&family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2235;
    --bg-card-hover: #1f2a40;
    --bg-input: #0f1726;
    --border: #2a3550;
    --border-focus: #3b82f6;
    --text-primary: #e8edf5;
    --text-secondary: #8896b0;
    --text-muted: #5a6a85;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.1);
    --white-list: #10b981;
    --black-list: #ef4444;
    --sidebar-w: 260px;
    --header-h: 64px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
    --font: 'Nunito', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Gizli scrollbar - kaydırınca görünsün */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.08) transparent; }

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============ LOGIN ============ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0e17 0%, #111827 50%, #0f172a 100%);
    position: relative;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(59,130,246,0.08), transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(16,185,129,0.06), transparent 50%);
}
.login-box {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    width: 420px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}
.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 6px;
}
.login-error {
    background: var(--danger-bg);
    border: 1px solid rgba(239,68,68,0.3);
    color: var(--danger);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    display: none;
}
.login-dealer-info {
    background: var(--warning-bg);
    border: 1px solid rgba(245,158,11,0.3);
    color: var(--warning);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    display: none;
}

/* ============ FORM ELEMENTS ============ */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder {
    color: var(--text-muted);
}
select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238896b0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px rgba(59,130,246,0.3);
}
.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover {
    background: #059669;
}
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-warning {
    background: var(--warning);
    color: #000;
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}
.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}
.btn-block {
    width: 100%;
    justify-content: center;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 101;
    transition: transform 0.3s ease;
}
.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand h2 {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar-brand small {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
}
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}
.nav-section {
    margin-bottom: 24px;
}
.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    user-select: none;
}
.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
}
.nav-item .icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.7;
}
.nav-item.active .icon {
    opacity: 1;
}
.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}
.sidebar-user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user-info .name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-info .role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}
.content-header {
    padding: 24px 32px 0;
}
.content-header h1 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
}
.content-header p {
    color: var(--text-secondary);
    font-size: 14px;
}
.content-body {
    padding: 24px 32px 32px;
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-header h3 {
    font-size: 15px;
    font-weight: 700;
}
.card-body {
    padding: 20px;
}
.card-body.no-pad {
    padding: 0;
}

/* 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 var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
}
.stat-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}
.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 12px;
}
.stat-card .stat-icon.blue { background: var(--accent-glow); color: var(--accent); }
.stat-card .stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-card .stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-card .stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--mono);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

/* ============ TABLE ============ */
.table-wrapper {
    overflow-x: auto;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid rgba(42,53,80,0.5);
    vertical-align: middle;
}
.data-table tr:hover td {
    background: var(--bg-card-hover);
}
.data-table .plate-cell {
    font-family: var(--mono);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
}
.data-table a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
}
.data-table a:hover {
    color: var(--info);
    text-decoration: none;
}

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16,185,129,0.2); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.badge-info { background: var(--info-bg); color: var(--info); border: 1px solid rgba(6,182,212,0.2); }
.badge-white { background: var(--success-bg); color: var(--success); }
.badge-black { background: var(--danger-bg); color: var(--danger); }

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transform: scale(0.95) translateY(10px);
    transition: var(--transition);
}
.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text-primary);
}
.modal-body {
    padding: 24px;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============ TOOLBAR ============ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.toolbar .search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.toolbar .search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}
.toolbar .search-box input:focus {
    border-color: var(--border-focus);
}
.toolbar .search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* ============ LIVE VIEW GRID ============ */
.live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 14px;
}
.live-cam-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.live-cam-card .cam-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.live-cam-card .cam-header h4 {
    font-size: 13px;
    font-weight: 700;
}
.live-cam-card .cam-image {
    aspect-ratio: 16/9;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.live-cam-card .cam-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.live-cam-card .cam-image .placeholder {
    color: var(--text-muted);
    font-size: 13px;
}
.live-cam-card .cam-footer {
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============ TRANSIT LOG PHOTO ============ */
.log-photo-thumb {
    width: 80px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: var(--transition);
}
.log-photo-thumb:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

/* ============ PAGINATION ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}
.pagination .page-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.pagination .page-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.pagination .page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.pagination .page-info {
    color: var(--text-muted);
    font-size: 13px;
    padding: 0 12px;
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    animation: slideIn 0.3s ease;
    min-width: 280px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.toast-success { background: #065f46; color: #a7f3d0; border-left: 4px solid var(--success); }
.toast-error { background: #7f1d1d; color: #fca5a5; border-left: 4px solid var(--danger); }
.toast-warning { background: #78350f; color: #fcd34d; border-left: 4px solid var(--warning); }
.toast-info { background: #164e63; color: #a5f3fc; border-left: 4px solid var(--info); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============ LOADING ============ */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10,14,23,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    z-index: 10;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}
.empty-state h4 {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ============ DIRECTION BADGE ============ */
.dir-entry { color: var(--success); }
.dir-exit { color: var(--danger); }

/* ============ GRID HELPERS ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ============ PHOTO MODAL ============ */
.photo-modal-img {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-sm);
}

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

@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(-100%); width: 260px; }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,0.5); }
    .sidebar.open ~ .sidebar-overlay { display: block; }
    .main-content { margin-left: 0; padding-top: 60px; }
    .content-header, .content-body { padding-left: 16px; padding-right: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card .stat-value { font-size: 22px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .live-grid { grid-template-columns: 1fr; }
    .toolbar { flex-direction: column; gap: 8px; }
    .toolbar .search-box { min-width: 100%; }
    .modal { width: 95vw; margin: 10px auto; max-height: 90vh; overflow-y: auto; }
    .mobile-menu-btn { display: flex !important; }
    .data-table th, .data-table td { padding: 10px 8px; font-size: 12px; }
    .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .content-header { padding-top: 8px; }
    .content-header h1 { font-size: 22px; }
    .tab-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
    .tab-nav .tab-btn { white-space: nowrap; flex-shrink: 0; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card .stat-value { font-size: 20px; }
    .stat-card .stat-icon { width: 32px; height: 32px; font-size: 16px; margin-bottom: 8px; }
    .content-header h1 { font-size: 18px; }
    .btn { padding: 10px 16px; font-size: 13px; min-height: 44px; }
    .form-control, .form-select { min-height: 44px; font-size: 16px; }
    .login-box { padding: 24px 20px; margin: 16px; }
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 22px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    -webkit-tap-highlight-color: transparent;
}
.mobile-menu-btn:active { background: var(--border); }
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    -webkit-tap-highlight-color: transparent;
}
