@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    --primary: #00adee;
    --primary-dark: #0090c8;
    --primary-light: #e0f5fd;
    --secondary: #f8f9fa;
    --accent: #ff6b6b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --shadow-primary: 0 4px 20px rgba(0,173,238,0.25);
    --radius: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--white);
    color: var(--gray-700);
    min-height: 100vh;
}

h1, h2, h3, h4, h5 { font-family: 'Outfit', sans-serif; color: var(--gray-800); }

/* Navbar */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.brand-icon {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 18px;
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: var(--gray-800);
}

.brand-name span { color: var(--primary); }

.nav-links { display: flex; align-items: center; gap: 6px; }

.nav-link {
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}

.nav-link:hover { background: var(--primary-light); color: var(--primary); }
.nav-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }

.nav-right { display: flex; align-items: center; gap: 10px; }

.user-badge {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px;
    background: var(--gray-50);
    border-radius: 20px;
    font-size: 13px; font-weight: 500;
    color: var(--gray-700);
}

.user-avatar {
    width: 28px; height: 28px;
    background: linear-gradient(135deg, var(--primary), #0090c8);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 12px; font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-primary);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }

.btn-secondary { background: var(--secondary); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-100); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

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

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px; font-weight: 700;
    color: var(--gray-800);
}

.card-body { padding: 24px; }

/* Form */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    background: var(--white);
    color: var(--gray-800);
}

.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,173,238,0.12); }

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px;
}

.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: var(--primary-light); color: #0369a1; border: 1px solid #bae6fd; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* Page layout */
.page-container { max-width: 1200px; margin: 0 auto; padding: 32px 24px; }

.page-header { margin-bottom: 32px; }
.page-title { font-size: 28px; font-weight: 800; margin-bottom: 6px; }
.page-subtitle { color: var(--gray-500); font-size: 15px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary);
}

.stat-number { font-family: 'Outfit', sans-serif; font-size: 36px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--gray-500); font-weight: 500; margin-top: 4px; }
.stat-icon { position: absolute; right: 20px; top: 20px; font-size: 28px; opacity: 0.15; }

/* Badge */
.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px; font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #f0fdf4; color: var(--success); }
.badge-warning { background: #fffbeb; color: var(--warning); }
.badge-danger { background: #fef2f2; color: var(--danger); }

/* Camera / Video */
.camera-container {
    position: relative;
    background: var(--gray-800);
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4/3;
    max-width: 600px;
    margin: 0 auto;
}

.camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

.camera-overlay {
    position: absolute;
    top: 12px; left: 12px;
    display: flex; gap: 8px;
}

.camera-badge {
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px; font-weight: 600;
    backdrop-filter: blur(4px);
}

.camera-badge.live { background: rgba(239,68,68,0.85); }

/* Progress */
.progress { background: var(--gray-100); border-radius: 20px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 20px; transition: width 0.3s; }

/* Sample grid */
.samples-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 16px; }

.sample-thumb {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-100);
    border: 2px solid var(--gray-200);
    position: relative;
}

.sample-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sample-thumb.captured { border-color: var(--primary); }
.sample-thumb.captured::after {
    content: '✓';
    position: absolute; bottom: 4px; right: 4px;
    background: var(--primary);
    color: white;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
}

/* Recognition info panel */
.info-panel {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--gray-200);
}

.recognized-person {
    display: flex; align-items: center; gap: 16px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
    margin-bottom: 12px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    animation: slideIn 0.3s ease;
}

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

.person-avatar-big {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 22px; font-weight: 800;
    font-family: 'Outfit', sans-serif;
    flex-shrink: 0;
}

.person-info .person-name { font-family: 'Outfit', sans-serif; font-size: 18px; font-weight: 700; }
.person-detail { font-size: 13px; color: var(--gray-500); margin-top: 3px; }
.person-detail span { color: var(--gray-700); font-weight: 500; }

/* Tabs */
.tabs { display: flex; gap: 4px; background: var(--gray-100); padding: 4px; border-radius: 12px; margin-bottom: 24px; }
.tab-btn {
    flex: 1; padding: 10px; border: none; background: none;
    border-radius: 9px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; color: var(--gray-500);
    font-family: 'Inter', sans-serif;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.tab-btn.active { background: var(--white); color: var(--primary); box-shadow: var(--shadow-sm); }

/* Table */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); border-bottom: 1px solid var(--gray-200); }
td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* Loading spinner */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 90%; max-width: 480px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.2s;
}
.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
    padding: 24px 24px 0;
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 22px; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px; border: none; background: var(--gray-100);
    border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-500); transition: all 0.2s;
}
.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }
.modal-body { padding: 24px; }

/* Upload area */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.upload-area:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-area.dragover { border-color: var(--primary); background: var(--primary-light); }

/* Utility */
.text-center { text-align: center; }
.text-muted { color: var(--gray-400); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
    .three-col { grid-template-columns: 1fr; }
    .nav-links { display: none; }
    .page-container { padding: 20px 16px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
