/* CSS variables for consistent tech styling */
:root {
    --bg-main: #060814;
    --bg-card: rgba(13, 17, 38, 0.45);
    --bg-card-hover: rgba(18, 25, 54, 0.6);
    --border-glass: rgba(102, 252, 241, 0.15);
    --border-glass-hover: rgba(102, 252, 241, 0.35);
    --accent-primary: #66FCF1;
    --accent-primary-rgb: 102, 252, 241;
    --accent-secondary: #45A29E;
    --accent-success: #20E296;
    --accent-danger: #FE5F55;
    --text-primary: #F8F9FA;
    --text-muted: #8E9AAF;
    --text-glow: 0 0 10px rgba(102, 252, 241, 0.5);
    --glow-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), 0 0 15px rgba(102, 252, 241, 0.05);
    --transition-speed: 0.3s;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

/* Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(102, 252, 241, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 252, 241, 0.4);
}

/* Ambient Backdrop Glows */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.15;
}

.bg-glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    top: -10%;
    left: -10%;
}

.bg-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    bottom: -10%;
    right: -10%;
}

.bg-glow-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #8a2be2 0%, transparent 70%);
    top: 40%;
    left: 40%;
}

/* Layout Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 2rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 44px;
    height: 44px;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px rgba(102, 252, 241, 0.6));
    animation: rotateSlow 20s linear infinite;
}

@keyframes rotateSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #FFF 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(102, 252, 241, 0.1);
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

/* Navigation Tabs */
.tab-nav {
    display: flex;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-btn {
    font-family: var(--font-heading);
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
}

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

.nav-btn.active {
    color: var(--bg-main);
    background: var(--accent-primary);
    box-shadow: 0 0 15px rgba(102, 252, 241, 0.35);
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: var(--glow-shadow);
    transition: border-color var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.glass-card:hover {
    border-color: var(--border-glass-hover);
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: fadeIn var(--transition-speed) ease forwards;
}

.tab-panel.active-panel {
    display: block;
}

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

/* Card Header */
.card-header {
    margin-bottom: 1.5rem;
    position: relative;
}

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Image input controls / camera toggle */
.input-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 0.75rem;
    width: fit-content;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.toggle-btn.active {
    background: rgba(102, 252, 241, 0.15);
    color: var(--accent-primary);
    border: 1px solid rgba(102, 252, 241, 0.2);
}

/* Dropzone (Drag and drop) styling */
.dropzone {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    border: 2px dashed rgba(102, 252, 241, 0.15);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
    transition: border-color var(--transition-speed) ease, background-color var(--transition-speed) ease;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent-primary);
    background: rgba(102, 252, 241, 0.03);
}

.file-hidden {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    padding: 2rem;
    pointer-events: none;
}

.icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(102, 252, 241, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-primary);
    border: 1px solid rgba(102, 252, 241, 0.1);
    transition: transform var(--transition-speed) ease;
}

.dropzone:hover .icon-wrap {
    transform: translateY(-4px);
    box-shadow: 0 4px 15px rgba(102, 252, 241, 0.15);
}

.dropzone-text {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.dropzone-text .highlight {
    color: var(--accent-primary);
    font-weight: 600;
}

.file-info {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Image preview styles */
.preview-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    background: var(--bg-main);
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.face-crop-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(10, 14, 23, 0.72);
    backdrop-filter: blur(4px);
    border-radius: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

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

.face-crop-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(102, 252, 241, 0.15);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin-face 0.8s linear infinite;
}

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

.face-crop-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--accent-primary);
    text-transform: uppercase;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 1.2rem;
    line-height: 28px;
    cursor: pointer;
    z-index: 12;
    transition: all var(--transition-speed) ease;
}

.remove-btn:hover {
    background: var(--accent-danger);
    border-color: transparent;
}

.hidden {
    display: none !important;
}

/* Video Camera Panel */
.camera-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.video-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror camera for natural look */
}

.capture-btn {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 8;
    background: var(--accent-primary);
    color: var(--bg-main);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(102, 252, 241, 0.4);
    transition: all var(--transition-speed) ease;
}

.capture-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 252, 241, 0.6);
}

.btn-pulse-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 30px;
    border: 2px solid var(--accent-primary);
    animation: pulseGlow 1.5s infinite;
    pointer-events: none;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.2); opacity: 0; }
}

/* Verification Layout & Cards Grid */
.matcher-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* Actions Panel */
.actions-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.settings-row.tight {
    gap: 0.75rem;
}

.settings-row.tight .form-group {
    flex: 1;
}

.form-group {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-select, .custom-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: all var(--transition-speed) ease;
    outline: none;
    width: 100%;
}

.custom-select:focus, .custom-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(102, 252, 241, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

.custom-select option {
    background: var(--bg-main);
    color: var(--text-primary);
}

/* Generic Button styles */
.btn {
    font-family: var(--font-heading);
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-speed) ease;
    border: none;
}

.primary-btn {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: var(--bg-main);
    box-shadow: 0 4px 20px rgba(102, 252, 241, 0.25);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 252, 241, 0.45);
}

.primary-btn:active {
    transform: translateY(0);
}

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

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1rem;
    letter-spacing: 0.5px;
    width: 100%;
}

/* Verification Result Section */
.result-section {
    animation: slideUp var(--transition-speed) ease forwards;
}

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

.result-summary {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    flex-wrap: wrap;
}

/* Progress circular gauge */
.gauge-wrapper {
    position: relative;
    width: 160px;
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.6s ease;
    filter: drop-shadow(0 0 6px var(--accent-primary));
}

.gauge-text-box {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.gauge-value {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

.gauge-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Verdict Details */
.verdict-box {
    flex: 1;
    min-width: 280px;
}

.verdict-badge {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border-radius: 30px;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.verdict-badge.match {
    background: rgba(32, 226, 150, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(32, 226, 150, 0.25);
    box-shadow: 0 0 15px rgba(32, 226, 150, 0.1);
}

.verdict-badge.no-match {
    background: rgba(254, 95, 85, 0.15);
    color: var(--accent-danger);
    border: 1px solid rgba(254, 95, 85, 0.25);
    box-shadow: 0 0 15px rgba(254, 95, 85, 0.1);
}

.verdict-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.verdict-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.details-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.details-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.item-val {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================================
   TAB 2: Bus Boarding Mode (1-to-Many System)
   ============================================================ */
.bus-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.bus-left-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.onboard-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Multi-angle slots */
.angle-slots-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.angle-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.4rem;
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    background: rgba(255,255,255,0.02);
    transition: border-color 0.2s, background 0.2s;
}

.angle-slot:hover {
    border-color: var(--accent-primary);
    background: rgba(102, 252, 241, 0.04);
}

.angle-slot.selected {
    border-color: var(--accent-primary);
    box-shadow: 0 0 8px rgba(102, 252, 241, 0.2);
}

.angle-slot-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.angle-slot-preview {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px dashed var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.angle-slot-check {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--accent-success);
    color: #0b0c10;
    font-size: 0.65rem;
    font-weight: 900;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.angle-upload-btn {
    font-size: 0.68rem;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid var(--border-glass);
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.angle-upload-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.angle-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.angle-target-btn {
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.angle-target-btn.active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    background: rgba(102, 252, 241, 0.08);
}

.onboard-photo-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.onboard-dropzone {
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 250px;
    margin: 0 auto;
    border: 2px dashed rgba(102, 252, 241, 0.15);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
}

.onboard-dropzone:hover {
    border-color: var(--accent-primary);
}

.onboard-photo-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

/* Live Scanner viewport & overlay */
.live-scanner-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: var(--accent-danger);
    border-radius: 50%;
    animation: flashRed 1s infinite alternate;
}

@keyframes flashRed {
    from { opacity: 0.3; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1.15); box-shadow: 0 0 8px var(--accent-danger); }
}

.scanner-toggle-btn {
    background: rgba(254, 95, 85, 0.1);
    color: var(--accent-danger);
    border: 1px solid rgba(254, 95, 85, 0.2);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.scanner-toggle-btn:hover {
    background: var(--accent-danger);
    color: var(--bg-main);
}

.scanner-toggle-btn.active-scan {
    background: rgba(32, 226, 150, 0.15);
    color: var(--accent-success);
    border: 1px solid rgba(32, 226, 150, 0.25);
}

.scanner-toggle-btn.active-scan:hover {
    background: var(--accent-success);
    color: var(--bg-main);
}

.scanner-layout {
    display: grid;
    grid-template-columns: minmax(380px, 460px) 1fr;
    gap: 1.5rem;
    align-items: stretch;
}

.scanner-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-glass-hover);
    box-shadow: 0 0 25px rgba(102, 252, 241, 0.05);
}

.scanner-idle-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(8, 12, 20, 0.96);
    z-index: 8;
}

.scanner-idle-placeholder.hidden {
    display: none;
}

.scanner-idle-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(102, 252, 241, 0.06);
    border: 2px solid rgba(102, 252, 241, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.scanner-idle-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.04em;
}

.scanner-idle-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 200px;
    line-height: 1.5;
}

.scanner-ring {
    position: absolute;
    top: 15%;
    left: 15%;
    right: 15%;
    bottom: 15%;
    border: 2px dashed rgba(102, 252, 241, 0.2);
    border-radius: 50%;
    box-shadow: inset 0 0 20px rgba(102, 252, 241, 0.05), 0 0 20px rgba(102, 252, 241, 0.05);
    animation: rotateRing 20s linear infinite;
    pointer-events: none;
}

@keyframes rotateRing {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.activity-log-card {
    height: 100%;
}

/* Scanner Laser scan HUD effect */
.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

/* Reticle corners */
.corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid var(--accent-primary);
}

.top-left { top: 20px; left: 20px; border-right: none; border-bottom: none; }
.top-right { top: 20px; right: 20px; border-left: none; border-bottom: none; }
.bottom-left { bottom: 20px; left: 20px; border-right: none; border-top: none; }
.bottom-right { bottom: 20px; right: 20px; border-left: none; border-top: none; }

.scanner-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to right, rgba(102, 252, 241, 0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(102, 252, 241, 0.03) 1px, transparent 1px);
    background-size: 25px 25px;
}

.scan-laser-line {
    position: absolute;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, transparent, var(--accent-primary), transparent);
    box-shadow: 0 0 12px var(--accent-primary);
    top: 0;
    animation: moveLaser 3s infinite linear;
}

@keyframes moveLaser {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

.scanner-laser {
    position: absolute;
    width: 100%;
    height: 2px;
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary);
    top: 0;
    animation: moveLaser 2.5s infinite linear;
    z-index: 6;
}

.scanner-hud-status {
    position: absolute;
    top: 25px;
    left: 25px;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    border: 1px solid rgba(102, 252, 241, 0.2);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.hud-pulse {
    width: 6px;
    height: 6px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: flashBlue 0.8s infinite alternate;
}

@keyframes flashBlue {
    from { opacity: 0.4; }
    to { opacity: 1; box-shadow: 0 0 6px var(--accent-primary); }
}

.scanner-hud-status span {
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-primary);
    letter-spacing: 0.5px;
}

/* Match toast overlay notification */
.match-toast {
    position: absolute;
    bottom: 25px;
    left: 25px;
    right: 25px;
    z-index: 15;
    background: rgba(6, 8, 20, 0.95);
    border: 2px solid var(--accent-success);
    border-radius: 12px;
    padding: 0.85rem;
    box-shadow: 0 10px 25px rgba(32, 226, 150, 0.25);
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideInBottom var(--transition-speed) ease forwards;
}

.match-toast.danger-match {
    border-color: var(--accent-danger);
    box-shadow: 0 10px 25px rgba(254, 95, 85, 0.25);
}

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

.toast-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid var(--accent-success);
    background-color: var(--bg-main);
}

.match-toast.danger-match .toast-avatar {
    border-color: var(--accent-danger);
}

.toast-details {
    display: flex;
    flex-direction: column;
}

.toast-title {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toast-name {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 750;
    color: var(--text-primary);
}

.toast-confidence {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-success);
}

.match-toast.danger-match .toast-confidence {
    color: var(--accent-danger);
}

/* Boarding Activity Log Table */
.boarding-log-area {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.boarding-log-area h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.log-table-wrapper {
    flex: 1;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.1);
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}

.log-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 700;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-transform: uppercase;
    font-size: 0.65rem;
}

.log-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.log-table tr:last-child td {
    border-bottom: none;
}

.log-table tr.log-success td {
    border-left: 2px solid var(--accent-success);
}

.log-table tr.log-danger td {
    border-left: 2px solid var(--accent-danger);
}

.log-table .badge-table {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
}

.log-table .badge-table.ok {
    background: rgba(32, 226, 150, 0.15);
    color: var(--accent-success);
}

.log-table .badge-table.fail {
    background: rgba(254, 95, 85, 0.15);
    color: var(--accent-danger);
}

.empty-row {
    text-align: center;
    color: var(--text-muted);
}

/* Bottom Passenger Manifest Database list */
.passengers-list-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background: rgba(102, 252, 241, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(102, 252, 241, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
}

.passengers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.empty-manifest {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
    font-size: 0.9rem;
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.passenger-profile {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    transition: all var(--transition-speed) ease;
}

.passenger-profile:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(102, 252, 241, 0.2);
    transform: translateY(-2px);
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.2);
}

.profile-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.profile-title {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.delete-passenger-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-speed) ease;
}

.delete-passenger-btn:hover {
    color: var(--accent-danger);
}

/* ============================================================
   Toast Notification Area
   ============================================================ */
.notification-container {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 350px;
    width: 100%;
}

.toast {
    background: rgba(13, 17, 38, 0.95);
    backdrop-filter: blur(10px);
    border-left: 4px solid var(--accent-primary);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.85rem 1.2rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideInRight 0.3s ease forwards;
}

.toast.toast-success {
    border-left-color: var(--accent-success);
}

.toast.toast-error {
    border-left-color: var(--accent-danger);
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding-left: 10px;
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ============================================================
   Responsive Tweaks
   ============================================================ */
@media (max-width: 900px) {
    .bus-layout, .scanner-layout {
        grid-template-columns: 1fr;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .tab-nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .nav-btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 600px) {
    .app-container {
        padding: 1rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .tab-nav {
        flex-direction: column;
        width: 100%;
        gap: 0.35rem;
    }
    
    .nav-btn {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    
    .result-summary {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
        text-align: center;
    }
    
    .details-list {
        grid-template-columns: 1fr;
    }
    
    .settings-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .onboard-dropzone {
        max-width: 200px;
    }
}

#dropzone-groupscan {
    max-width: none !important;
    aspect-ratio: auto !important;
}

/* Onboarding Welcome Banner */
.banner-onboarding {
    background: rgba(102, 252, 241, 0.05) !important;
    border: 1px solid rgba(102, 252, 241, 0.2) !important;
    box-shadow: 0 0 20px rgba(102, 252, 241, 0.03) !important;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    animation: slideDown var(--transition-speed) ease forwards;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.banner-emoji {
    font-size: 2rem;
    animation: waveEmoji 2s infinite alternate;
    display: inline-block;
}

@keyframes waveEmoji {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(20deg); }
}

.banner-text h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 0.2rem;
}

.banner-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.btn-sm {
    padding: 0.5rem 1rem !important;
    font-size: 0.8rem !important;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .banner-onboarding {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .banner-onboarding .btn {
        width: 100%;
    }
}

/* Global Settings Bar */
.global-settings-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 0.85rem 1.5rem;
    background: rgba(13, 17, 38, 0.4);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    box-shadow: var(--glow-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex: 1;
}

.setting-item label {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    max-width: 350px;
}

.slider-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
}

.custom-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
    transition: background 0.3s;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(102, 252, 241, 0.5);
    transition: transform 0.1s, background-color 0.1s;
    border: 2px solid var(--bg-main);
}

.custom-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.setting-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    max-width: 450px;
    line-height: 1.3;
}

.setting-note span {
    font-weight: 500;
}

/* ============================================================
   Driver Behavior Monitor — Badges & Metrics
   ============================================================ */
.behavior-badges-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    margin-top: 0.85rem;
}

.behavior-badge {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.025);
    transition: all var(--transition-speed) ease;
    cursor: default;
}

.badge-icon-wrap {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition-speed) ease;
}

.badge-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.badge-name {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.behavior-badge .badge-status {
    flex-shrink: 0;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--accent-success);
    background: rgba(32, 226, 150, 0.12);
    border: 1px solid rgba(32, 226, 150, 0.2);
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    transition: all var(--transition-speed) ease;
}

/* Alert state */
.behavior-badge.alert {
    border-color: rgba(254, 95, 85, 0.4);
    background: rgba(254, 95, 85, 0.07);
    box-shadow: 0 0 14px rgba(254, 95, 85, 0.18);
    animation: pulseAlert 1s ease infinite alternate;
}

.behavior-badge.alert .badge-icon-wrap {
    background: rgba(254, 95, 85, 0.1);
    border-color: rgba(254, 95, 85, 0.3);
    color: var(--accent-danger);
}

.behavior-badge.alert .badge-name {
    color: var(--accent-danger);
}

.behavior-badge.alert .badge-status {
    color: var(--accent-danger);
    background: rgba(254, 95, 85, 0.15);
    border-color: rgba(254, 95, 85, 0.3);
}

@keyframes pulseAlert {
    from { box-shadow: 0 0 8px rgba(254, 95, 85, 0.15); }
    to   { box-shadow: 0 0 18px rgba(254, 95, 85, 0.35); }
}

/* Live metrics 2x2 grid */
.behavior-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
    flex-shrink: 0;
}

.metric-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.metric-label {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.calibration-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    flex-shrink: 0;
}

.calibration-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ---- Driver Monitor: compact overrides so everything fits without scrolling ---- */

/* Shorter camera for driver tab only */
#tab-driver .scanner-viewport {
    aspect-ratio: 16 / 9;
}

/* Left card fills height, content stacks without overflow */
#tab-driver .live-scanner-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 2-column compact badge grid */
#tab-driver .behavior-badges-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
    margin-top: 0.45rem;
}

#tab-driver .behavior-badge {
    padding: 0.45rem 0.6rem;
    gap: 0.55rem;
    border-radius: 10px;
}

#tab-driver .badge-icon-wrap {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex-shrink: 0;
}

#tab-driver .badge-icon-wrap svg {
    width: 18px;
    height: 18px;
}

#tab-driver .badge-name {
    font-size: 0.74rem;
}

#tab-driver .badge-desc {
    font-size: 0.61rem;
}

#tab-driver .badge-status {
    font-size: 0.6rem;
    padding: 2px 6px;
}

/* Sensitivity sliders section */
.sensitivity-section {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
}

.sensitivity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.55rem;
}

.sensitivity-title {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sensitivity-sliders {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sens-row {
    display: grid;
    grid-template-columns: 90px 42px 1fr 42px 28px;
    align-items: center;
    gap: 0.35rem;
}

.sens-label {
    font-size: 0.68rem;
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
}

.sens-hint {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-align: center;
}

.sens-val {
    font-family: var(--font-heading);
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--accent-primary);
    text-align: center;
}

.sens-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(to right, var(--accent-primary) 0%, rgba(255,255,255,0.12) 0%);
    outline: none;
    cursor: pointer;
}

.sens-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0, 217, 166, 0.4);
    transition: transform 0.15s ease;
}

.sens-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Detection count summary grid */
.behavior-count-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
}

.count-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.45rem 0.3rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    gap: 0.2rem;
}

.count-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}

.count-value {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
}

.count-item.has-count .count-value {
    color: var(--accent-danger);
}

.count-item.has-count {
    border-color: rgba(254, 95, 85, 0.25);
    background: rgba(254, 95, 85, 0.06);
}

@media (max-width: 600px) {
    .calibration-row {
        flex-direction: column;
        align-items: flex-start;
    }
    #tab-driver .behavior-badges-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .global-settings-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    .setting-item {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .slider-container {
        max-width: none;
        width: 100%;
    }
    .setting-note {
        max-width: none;
    }
}
