/* ============================================
   RIBCore Secure Fare Validator - Enterprise UI
   Mobile-First, Edge-to-Edge Design
   ============================================ */

:root {
    --bg-dark: #0F172A;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --primary: #10B981; /* Emerald Green */
    --primary-hover: #059669;
    --accent: #3B82F6; /* Modern Blue */
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --danger: #EF4444;
    --warning: #F59E0B;
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    width: 100vw; height: 100vh;
}

/* --- SCREEN MANAGEMENT --- */
.screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: none; flex-direction: column;
}
.screen.active { display: flex; }

.tab-content {
    display: none; flex: 1; overflow-y: auto; padding: 20px;
    padding-bottom: 100px; /* Space for bottom nav */
}
.tab-content.active { display: flex; flex-direction: column; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* --- GLASSMORPHISM UTILITY --- */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

/* --- LOGIN SCREEN --- */
#loginScreen { justify-content: center; align-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 400px; padding: 32px 24px; text-align: center; }
.secure-icon { font-size: 48px; margin-bottom: 10px; }
.brand-header h1 { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.accent-text { color: var(--primary); }
.brand-header p { color: var(--text-muted); font-size: 14px; margin-bottom: 30px; }

.input-group { text-align: left; margin-bottom: 20px; }
.input-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; letter-spacing: 1px; }
.input-group input { 
    width: 100%; padding: 16px; border-radius: 12px; border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2); color: white; font-size: 18px; outline: none; transition: all 0.2s;
}
.input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); }

.btn-primary {
    width: 100%; padding: 16px; border-radius: 12px; border: none;
    background: var(--primary); color: white; font-size: 16px; font-weight: 700;
    margin-top: 10px; cursor: pointer; transition: background 0.2s;
}
.btn-primary:active { background: var(--primary-hover); transform: scale(0.98); }

/* --- TOP BAR --- */
.top-bar { padding: 16px 20px; border-radius: 0 0 20px 20px; margin-bottom: 10px; padding-top: max(16px, env(safe-area-inset-top)); }
.operator-info { display: flex; align-items: center; gap: 12px; }
.avatar { font-size: 24px; background: rgba(255,255,255,0.1); padding: 8px; border-radius: 50%; }
.operator-info h3 { font-size: 16px; margin-bottom: 2px; }
.badge { font-size: 10px; padding: 4px 8px; border-radius: 100px; font-weight: 600; }
.badge-online { background: rgba(16, 185, 129, 0.2); color: var(--primary); }

/* --- SCANNER TAB --- */
.category-pills { display: flex; gap: 10px; margin-bottom: 20px; }
.pill {
    flex: 1; padding: 12px; border-radius: 100px; border: 1px solid var(--glass-border);
    background: transparent; color: var(--text-muted); font-weight: 600; font-size: 14px;
    transition: all 0.2s;
}
.pill.active { background: var(--primary); color: white; border-color: var(--primary); }

.camera-wrapper {
    position: relative; width: 100%; aspect-ratio: 3/4; border-radius: 24px;
    overflow: hidden; background: #000; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
#cameraPreview { width: 100%; height: 100%; object-fit: cover; }
.camera-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.scan-frame { width: 85%; height: 60%; border: 2px solid rgba(255,255,255,0.8); border-radius: 16px; box-shadow: 0 0 0 9999px rgba(0,0,0,0.4); }
.scan-hint { margin-top: 20px; background: rgba(0,0,0,0.6); padding: 8px 16px; border-radius: 100px; font-size: 12px; }

.action-area { margin-top: 20px; display: flex; flex-direction: column; gap: 15px; align-items: center; }
.id-input { width: 100%; padding: 16px; border-radius: 12px; border: 1px solid var(--glass-border); background: var(--bg-panel); color: white; text-align: center; font-size: 16px; outline: none; }
.id-input:focus { border-color: var(--primary); }

.camera-controls { display: flex; width: 100%; justify-content: space-between; align-items: center; padding: 0 20px; }
.btn-capture { width: 70px; height: 70px; border-radius: 50%; border: 4px solid white; background: transparent; display: flex; align-items: center; justify-content: center; }
.capture-inner { width: 54px; height: 54px; background: white; border-radius: 50%; transition: all 0.1s; }
.btn-capture:active .capture-inner { transform: scale(0.9); background: #ddd; }

.btn-submit { padding: 16px 24px; border-radius: 100px; background: var(--primary); color: white; border: none; font-weight: bold; font-size: 16px; transition: 0.2s; }
.btn-submit:disabled { background: var(--glass-border); color: var(--text-muted); }

/* --- BOTTOM NAV --- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; width: 100%; display: flex; justify-content: space-around;
    padding: 12px 10px; border-radius: 24px 24px 0 0; border-bottom: none;
    padding-bottom: max(12px, env(safe-area-inset-bottom)); z-index: 100;
}
.nav-item { background: none; border: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; width: 60px; transition: 0.2s; }
.nav-item.active { color: var(--primary); transform: translateY(-2px); }
.nav-icon { font-size: 20px; }

/* --- OTHER TABS (History & Stats) --- */
.section-title { font-size: 20px; margin-bottom: 20px; color: white; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.stat-card { padding: 20px; text-align: center; }
.stat-card h3 { font-size: 32px; color: var(--primary); margin-bottom: 5px; }
.text-warning { color: var(--warning) !important; }
.setting-item { display: flex; justify-content: space-between; align-items: center; padding: 20px; margin-bottom: 12px; }
.btn-small { padding: 8px 16px; border-radius: 8px; background: var(--accent); border: none; color: white; font-weight: 600; }
.btn-danger { background: var(--danger); }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; }