:root {
    --bg-color: #1a1a2e;
    --panel-color: #16213e;
    --accent-color: #00d4ff;
    --accent-hover: #00a3cc;
    --success-color: #00ff88;
    --error-color: #ff4444;
    --warning-color: #ffaa00;
    --text-primary: #ffffff;
    --text-muted: #a0a0b0;
    --glass-bg: rgba(22, 33, 62, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', 'Roboto', sans-serif;
    line-height: 1.6;
}

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

/* Login */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at top right, #1a1a2e, #0f1322);
}

.login-container {
    padding: 20px;
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.5s ease-out;
    text-align: center;
}

.logo {
    background: linear-gradient(135deg, var(--accent-color), var(--success-color));
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

.icon-logo {
    color: #fff;
    stroke-width: 2.5;
}

.login-card h2 {
    font-size: 24px;
    margin-bottom: 5px;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 25px;
    font-size: 14px;
}

.input-group {
    text-align: left;
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-muted);
}

.input-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    width: 18px;
}

.input-group input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--accent-color), #0099ff);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert.error {
    background: rgba(255, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(255, 68, 68, 0.2);
}

/* Demo buttons */
.demo-mode {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.demo-mode p {
    margin-bottom: 15px;
}

.demo-buttons {
    display: flex;
    gap: 10px;
}

.btn-outline {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.btn-outline:hover {
    background: rgba(0, 212, 255, 0.1);
}

/* Dashboard Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--panel-color);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
}

.sidebar-header {
    padding: 0 20px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.nav-links {
    list-style: none;
    margin-top: 20px;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-links li a:hover, .nav-links li a.active {
    color: var(--accent-color);
    background: rgba(0, 212, 255, 0.1);
    border-left: 3px solid var(--accent-color);
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 30px;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--glass-bg);
    padding: 15px 25px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: #1a1a2e;
}

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

.stat-card {
    background: var(--panel-color);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
}

.icon-blue { background: rgba(0, 212, 255, 0.1); color: var(--accent-color); }
.icon-green { background: rgba(0, 255, 136, 0.1); color: var(--success-color); }
.icon-red { background: rgba(255, 68, 68, 0.1); color: var(--error-color); }
.icon-orange { background: rgba(255, 170, 0, 0.1); color: var(--warning-color); }

.stat-info h3 {
    font-size: 22px;
    margin-top: 5px;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table-container {
    background: var(--panel-color);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.table-container h3 {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

th {
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 13px;
}

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: rgba(0, 255, 136, 0.2); color: var(--success-color); }
.badge-warning { background: rgba(255, 170, 0, 0.2); color: var(--warning-color); }
.badge-error { background: rgba(255, 68, 68, 0.2); color: var(--error-color); }

/* Chatbot & Camera overlay */
#chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 350px;
    background: var(--panel-color);
    border-radius: 16px;
    border: 1px solid var(--accent-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none; /* hidden by default */
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, var(--accent-color), #0099ff);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-body {
    height: 300px;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid var(--glass-border);
}

.chat-input input {
    flex: 1;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 10px 15px;
    color: #fff;
    margin-right: 10px;
}

.chat-input button {
    background: var(--accent-color);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-color);
    color: #000;
    border: none;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    transition: transform 0.3s;
}

.chat-toggle:hover {
    transform: scale(1.1);
}

/* Face Recognition UI */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
}

#video-el {
    width: 100%;
    display: block;
    transform: scaleX(-1);
}

canvas.face-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
    animation: scanLine 2s infinite linear alternate;
    pointer-events: none;
}

@keyframes scanLine {
    0% { top: 10%; }
    100% { top: 90%; }
}

.face-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 280px;
    border: 2px dashed rgba(0, 255, 136, 0.7);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    transition: all 0.5s;
}

.instruction-text {
    position: absolute;
    top: 20px;
    width: 100%;
    text-align: center;
    color: #00ff88;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 10;
}
