/* ================================================================
   TACTICAL SECURITY PANEL — Custom CSS
   Theme: Professional, Modern, Private Security (Dark/Tactical)
   ================================================================ */

:root {
    /* Tactical Palette */
    --brand-primary:   #fbbf24; /* Amber / Gold for Security Badges */
    --brand-secondary: #f59e0b;
    --bg-base:         #020617; /* Very Dark Slate */
    --bg-surface:      #0f172a; /* Dark Slate */
    --bg-surface-elevated: #1e293b;
    --border:          rgba(255, 255, 255, 0.08);
    --border-strong:   rgba(255, 255, 255, 0.15);
    
    --text-primary:    #f8fafc;
    --text-secondary:  #94a3b8;
    --text-tertiary:   #64748b;
    
    /* Semantic Status Colors */
    --status-active:   #22c55e; /* Green */
    --status-alert:    #eab308; /* Yellow */
    --status-danger:   #ef4444; /* Red */
    --status-info:     #3b82f6; /* Blue */
    
    --sidebar-w:       280px;
    --topbar-h:        70px;
    --radius-xl:       24px;
    --radius-lg:       16px;
    --radius-md:       12px;
    --radius-sm:       8px;
    --font-main:       'Inter', system-ui, sans-serif;
    --font-mono:       'JetBrains Mono', 'Courier New', monospace;
    
    --transition:      0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    margin: 0;
    /* Native App Behaviors */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Hide Scrollbar for Native Look */
::-webkit-scrollbar {
    display: none;
}
html {
    scrollbar-width: none; /* Firefox */
}

/* ── Typography & Utils ────────────────────────────────────────── */
.tactical-font { font-family: var(--font-mono); letter-spacing: 0.5px; }
.text-brand { color: var(--brand-primary); }
.text-danger { color: var(--status-danger); }
.text-active { color: var(--status-active); }

/* ── Layout ──────────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; position: relative; overflow-x: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; bottom: 0; left: 0;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    height: var(--topbar-h);
    display: flex; align-items: center; padding: 0 24px;
    border-bottom: 1px solid var(--border);
    justify-content: space-between;
}

.brand-logo-wrap { display: flex; align-items: center; text-decoration: none; }

.brand-logo {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    border-radius: var(--radius-sm);
    color: #000; font-size: 18px; font-weight: 900;
    margin-right: 12px;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.brand-text {
    font-size: 16px; font-weight: 800; letter-spacing: 1px;
    text-transform: uppercase; color: var(--text-primary);
}

.sidebar-close-btn { display: none; background: none; border: none; color: var(--text-primary); font-size: 24px; cursor: pointer; }

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

.nav-label {
    font-size: 11px; font-weight: 700; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 1.5px;
    margin: 16px 0 8px 12px;
}

.nav-item {
    display: flex; align-items: center; padding: 12px 14px;
    color: var(--text-secondary); text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600;
    transition: var(--transition);
    margin-bottom: 4px;
}

.nav-item i { font-size: 18px; margin-right: 14px; opacity: 0.7; }
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.nav-item:hover i { opacity: 1; color: var(--brand-primary); }

.nav-item.active {
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.1), transparent);
    color: var(--brand-primary);
    border-left: 3px solid var(--brand-primary);
}
.nav-item.active i { opacity: 1; color: var(--brand-primary); }

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    z-index: 999; display: none; opacity: 0; transition: var(--transition);
}

/* ── Main Content ────────────────────────────────────────────────── */
.main-wrapper {
    flex: 1; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    width: calc(100% - var(--sidebar-w));
    transition: var(--transition);
    padding-bottom: 0; /* Updated on mobile */
}

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px;
    position: sticky; top: 0; z-index: 40;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle-btn {
    display: none; background: none; border: none; color: var(--text-primary);
    font-size: 24px; cursor: pointer; padding: 0;
}
.page-title { font-size: 18px; font-weight: 700; margin: 0; }

.topbar-right { display: flex; align-items: center; gap: 20px; }

.live-clock {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border);
    padding: 6px 16px; border-radius: 50px;
    display: flex; align-items: center; gap: 8px;
    color: var(--brand-primary); font-weight: 700; font-size: 14px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}

.user-profile { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.user-profile-text { text-align: right; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--bg-surface-elevated); border: 1px solid var(--border-strong);
    display: flex; align-items: center; justify-content: center;
    color: var(--brand-primary); font-weight: bold;
}

/* ── Content ─────────────────────────────────────────────────────── */
.content-area { padding: 32px; }

/* ── Cards & Panels ──────────────────────────────────────────────── */
.tactical-card {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.9));
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    position: relative; overflow: hidden;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.tactical-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
    background: var(--border);
}
.tactical-card.border-brand::before { background: linear-gradient(90deg, var(--brand-primary), var(--brand-secondary)); }
.tactical-card.border-danger::before { background: var(--status-danger); }
.tactical-card.border-active::before { background: var(--status-active); }

.card-title {
    font-size: 15px; font-weight: 800; color: var(--text-primary);
    letter-spacing: 0.5px;
    margin-bottom: 24px; display: flex; align-items: center; gap: 10px;
}
.card-title i { color: var(--brand-primary); font-size: 18px; }

/* ── Stat Widgets ────────────────────────────────────────────────── */
.stat-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin-bottom: 32px;
}

.stat-widget {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex; align-items: flex-start; justify-content: space-between;
    transition: var(--transition);
}
.stat-widget:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.stat-info .label {
    font-size: 11px; font-weight: 700; color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px;
}
.stat-info .value { font-size: 32px; font-weight: 900; color: var(--text-primary); line-height: 1; letter-spacing: -1px; }
.stat-icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-icon.brand { background: rgba(251,191,36,0.1); color: var(--brand-primary); }
.stat-icon.danger { background: rgba(239,68,68,0.1); color: var(--status-danger); }
.stat-icon.active { background: rgba(34,197,94,0.1); color: var(--status-active); }
.stat-icon.info { background: rgba(59,130,246,0.1); color: var(--status-info); }

/* ── Active Shift Banner ─────────────────────────────────────────── */
.shift-banner {
    background: linear-gradient(135deg, rgba(34,197,94,0.2) 0%, rgba(2,6,23,0.95) 100%);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(34,197,94,0.4);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 20px;
    box-shadow: 0 10px 40px rgba(34,197,94,0.15);
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.shift-status-dot {
    width: 16px; height: 16px; background: var(--status-active); border-radius: 50%;
    box-shadow: 0 0 12px var(--status-active);
    animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }

/* ── Data & Charts Grid ──────────────────────────────────────────── */
.data-grid {
    display: grid; grid-template-columns: 2fr 1fr; gap: 24px; margin-bottom: 32px;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-tactical {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 12px 24px; border-radius: var(--radius-md);
    font-family: var(--font-main); font-weight: 600; font-size: 14px;
    cursor: pointer; transition: var(--transition);
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    text-decoration: none; text-transform: uppercase; letter-spacing: 0.5px;
    min-height: 48px; /* Touch target minimum size */
}
.btn-tactical:hover { background: rgba(255,255,255,0.08); }

.btn-tactical-primary { background: var(--brand-primary); color: #000; border-color: var(--brand-primary); }
.btn-tactical-primary:hover { background: var(--brand-secondary); box-shadow: 0 0 20px rgba(251,191,36,0.4); }

.btn-tactical-danger { background: var(--status-danger); color: #fff; border-color: var(--status-danger); }
.btn-tactical-danger:hover { background: #dc2626; box-shadow: 0 0 20px rgba(239,68,68,0.4); }

.btn-tactical-success { background: var(--status-active); color: #fff; border-color: var(--status-active); }
.btn-tactical-success:hover { background: #16a34a; box-shadow: 0 0 20px rgba(34,197,94,0.4); }

/* ── Forms ───────────────────────────────────────────────────────── */
.tactical-input {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 14px 16px; border-radius: var(--radius-md);
    font-family: var(--font-main); font-size: 14px; width: 100%;
    transition: var(--transition);
    min-height: 48px; /* Touch target minimum size */
}
.tactical-input:focus { outline: none; border-color: var(--brand-primary); box-shadow: inset 0 0 0 1px var(--brand-primary); }
.tactical-label {
    display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px;
}

/* ── Tables ──────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tactical-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.tactical-table th {
    text-align: left; padding: 16px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px; color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-strong); background: rgba(0,0,0,0.2);
}
.tactical-table td {
    padding: 16px; border-bottom: 1px solid var(--border);
    font-size: 14px; font-weight: 500;
}
.tactical-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
    padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-danger { background: rgba(239,68,68,0.15); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-warning { background: rgba(234,179,8,0.15); color: #fde047; border: 1px solid rgba(234,179,8,0.3); }
.badge-success { background: rgba(34,197,94,0.15); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.badge-info { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }

/* ==================================================================
   MOBILE BOTTOM NAVIGATION
   ================================================================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.05);
    z-index: 1000;
    padding: 0 12px;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 11px;
    font-weight: 700;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    gap: 6px;
    border-radius: 20px;
    margin: 8px 4px;
}

.bottom-nav-item i {
    font-size: 26px;
    transition: transform 0.3s ease;
}

.bottom-nav-item:active {
    transform: scale(0.92);
    background: rgba(255,255,255,0.05);
}

.bottom-nav-item.active {
    color: var(--brand-primary);
    background: linear-gradient(to top, rgba(251, 191, 36, 0.1), transparent);
}
.bottom-nav-item.active i {
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
    transform: translateY(-2px);
}

/* ==================================================================
   RESPONSIVE (MOBILE OPTIMIZATION)
   ================================================================== */

@media (max-width: 992px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .data-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* Main Layout */
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 5px 0 25px rgba(0,0,0,0.5); }
    .sidebar-overlay.open { display: block; opacity: 1; }
    
    .sidebar-close-btn { display: block; }
    .mobile-hidden { display: none !important; }
    
    .main-wrapper { margin-left: 0; width: 100%; padding-bottom: 85px; } /* Space for bottom nav */
    
    /* Topbar */
    .topbar { padding: 0 16px; justify-content: center; height: calc(60px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); } /* Center title on mobile */
    .user-profile-text { display: none; }
    .live-clock { display: none; }
    .topbar-right { position: absolute; right: 16px; top: calc(50% + (env(safe-area-inset-top) / 2)); transform: translateY(-50%); }
    .page-title { font-size: 16px; }
    
    /* Content */
    .content-area { padding: 16px; padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
    .tactical-card { padding: 16px; }
    
    /* Grids */
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } /* 2x2 grid for mobile */
    .stat-widget { padding: 16px; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
    .stat-info .label { font-size: 10px; margin-bottom: 4px; }
    .stat-info .value { font-size: 20px; }
    .stat-icon { width: 36px; height: 36px; font-size: 18px; }
    
    /* Mobile Navigation Bar */
    .mobile-bottom-nav { display: flex; }
    
    /* Tables */
    .tactical-table th, .tactical-table td { padding: 12px 8px; font-size: 13px; }
    
    /* Shift Banner */
    .shift-banner { padding: 16px; flex-direction: column; align-items: flex-start; }
    .shift-banner > div:last-child { width: 100%; display: flex; flex-direction: column; gap: 12px; }
    .shift-banner > div:last-child > * { width: 100%; text-align: center; }
}
