/* ==========================================================================
   AutoScore Admin Dashboard — Design System & Stylesheet
   Theme: Futuristic Dark Glassmorphism with Neon Accents
   ========================================================================== */

:root {
    --bg-main: #090d16;
    --bg-card: rgba(18, 26, 43, 0.7);
    --bg-card-hover: rgba(28, 40, 65, 0.85);
    --bg-input: #0f172a;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(0, 242, 254, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Neon Accent Colors */
    --accent-cyan: #00f2fe;
    --accent-violet: #7928ca;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #ef4444;
    
    --shadow-glow-cyan: 0 0 20px rgba(0, 242, 254, 0.25);
    --shadow-glow-violet: 0 0 20px rgba(121, 40, 202, 0.25);
    
    --font-family-heading: 'Outfit', sans-serif;
    --font-family-body: 'Inter', sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0, 242, 254, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(121, 40, 202, 0.05) 0%, transparent 40%);
}

/* Header Navbar */
.admin-header {
    height: 72px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.5));
}

.logo-title {
    font-family: var(--font-family-heading);
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.system-status-pill {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 6px 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--accent-emerald);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-emerald);
}

.status-dot.pulsing {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* User profile widget */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 16px;
    border-left: 1px solid var(--border-color);
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    box-shadow: var(--shadow-glow-cyan);
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    display: block;
}

.user-role {
    font-size: 11px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #00f2fe 0%, #00c6ff 100%);
    color: #04111d;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 50%;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-cyan);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Layout container */
.dashboard-container {
    display: flex;
    min-height: calc(100vh - 72px);
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: rgba(15, 23, 42, 0.6);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-item:hover, .nav-item.active {
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
}

.nav-item.active {
    border-left: 3px solid var(--accent-cyan);
}

.badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    margin-left: auto;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
}

.sidebar-footer {
    padding: 12px;
}

.quick-stats-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: var(--radius-sm);
}

.quick-stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

.quick-stat-val {
    font-family: var(--font-family-heading);
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin: 4px 0 8px 0;
}

.progress-bar-sm {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-sm .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-emerald));
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 28px;
    max-width: 1440px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9) 0%, rgba(30, 41, 59, 0.7) 100%);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-md);
    padding: 24px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.welcome-banner h2 {
    font-family: var(--font-family-heading);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.welcome-banner p {
    color: var(--text-secondary);
    font-size: 13px;
}

.live-clock {
    font-family: monospace;
    font-size: 18px;
    color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.1);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(0, 242, 254, 0.2);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.25s ease;
}

.kpi-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.4);
}

.kpi-card.accent-cyan { border-top: 3px solid var(--accent-cyan); }
.kpi-card.accent-violet { border-top: 3px solid var(--accent-violet); }
.kpi-card.accent-amber { border-top: 3px solid var(--accent-amber); }
.kpi-card.accent-emerald { border-top: 3px solid var(--accent-emerald); }

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

.kpi-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-icon {
    font-size: 18px;
    color: var(--text-muted);
}

.kpi-value {
    font-family: var(--font-family-heading);
    font-size: 36px;
    font-weight: 800;
    margin: 12px 0 6px 0;
    letter-spacing: -1px;
}

.kpi-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

.kpi-subtext.warning-text { color: var(--accent-amber); }
.kpi-subtext.success-text { color: var(--accent-emerald); }

/* Glass Panel */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-header h3 {
    font-family: var(--font-family-heading);
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.refresh-indicator {
    font-size: 12px;
    color: var(--text-muted);
}

/* Pipeline Flow visualizer */
.pipeline-flow-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
}

.flow-step {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s ease;
}

.flow-step.warning {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.05);
}

.flow-step.success {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.step-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.flow-step.warning .step-badge { background: var(--accent-amber); color: #000; }
.flow-step.success .step-badge { background: var(--accent-emerald); color: #fff; }

.step-name {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
}

.step-count {
    font-family: var(--font-family-heading);
    font-size: 22px;
    font-weight: 700;
}

.flow-arrow {
    color: var(--text-muted);
    font-size: 14px;
}

/* Grid 2 Column */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Data Table */
.table-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
}

.filter-group select, .form-input {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Status Badges */
.status-pill {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-pill.created { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.status-pill.analyzing { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.status-pill.manual_review { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.status-pill.completed { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.status-pill.failed { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background: #0f172a;
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-sm {
    max-width: 480px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.photo-viewport {
    width: 100%;
    height: 280px;
    background: #000;
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
}

.photo-viewport img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-box-overlay {
    position: absolute;
    top: 25%;
    left: 20%;
    width: 50%;
    height: 45%;
    border: 2px dashed #00f2fe;
    background: rgba(0, 242, 254, 0.15);
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.photo-thumbnails {
    display: flex;
    gap: 8px;
}

.thumb-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    cursor: pointer;
    border: 2px solid transparent;
}

.thumb-img.active {
    border-color: var(--accent-cyan);
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.mini-table th, .mini-table td {
    padding: 8px 10px;
    font-size: 12px;
    border-bottom: 1px solid var(--border-color);
}

.total-estimation-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: var(--radius-sm);
    margin: 16px 0;
}

.t-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    margin-bottom: 8px;
}

.t-row.highlight strong {
    font-size: 18px;
    color: var(--accent-emerald);
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Worker & Parts Cards */
.pipeline-workers-grid, .parts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.worker-card, .part-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 18px;
}

.worker-header {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 14px;
}

.worker-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.w-stat {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
}

.log-stream {
    background: #050811;
    font-family: monospace;
    font-size: 12px;
    padding: 16px;
    border-radius: var(--radius-sm);
    max-height: 400px;
    overflow-y: auto;
    color: #a7f3d0;
}

.log-entry {
    margin-bottom: 6px;
    line-height: 1.4;
}

.log-time { color: var(--text-muted); }
.log-event { color: var(--accent-cyan); }
