/* Face Access Control System - Dark Theme Styles */

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

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-tertiary: #0f3460;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --success: #4ecca3;
    --error: #e74c3c;
    --warning: #f39c12;
    --border: rgba(255, 255, 255, 0.1);
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    padding-bottom: 70px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 20px;
    font-weight: 600;
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.card h2 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.card h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

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

.stat-card {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card.online .stat-value { color: var(--success); }
.stat-card.offline .stat-value { color: var(--error); }
.stat-card.warning .stat-value { color: var(--warning); }

/* Video Stream */
.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.video-container img {
    width: 100%;
    height: auto;
    display: block;
}

.video-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--error); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--success);
    color: #000;
}

.btn-primary:hover {
    background: #3db88a;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #1a4d7a;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: var(--success);
}

/* Employee Cards */
.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.employee-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    text-align: center;
}

.employee-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px;
    border: 3px solid var(--border);
}

.employee-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
}

.employee-position {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.employee-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 15px;
}

.employee-status.active {
    background: rgba(78, 204, 163, 0.2);
    color: var(--success);
}

.employee-status.inactive {
    background: rgba(231, 76, 60, 0.2);
    color: var(--error);
}

.employee-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.employee-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
}

/* Access Log */
.log-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.log-filters select {
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.log-entry {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--border);
    display: flex;
    gap: 15px;
    align-items: center;
}

.log-photo {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s;
}

.log-photo:hover {
    transform: scale(1.05);
}

.log-details {
    flex: 1;
}

.log-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
}

.log-time {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.log-similarity {
    font-size: 14px;
    color: var(--text-secondary);
}

.log-status {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}

.log-status.granted {
    background: rgba(78, 204, 163, 0.2);
    color: var(--success);
}

.log-status.denied {
    background: rgba(231, 76, 60, 0.2);
    color: var(--error);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--success);
    color: #000;
}

/* Navigation */
nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 1000;
}

nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    padding: 5px 15px;
    transition: color 0.3s;
}

nav a.active,
nav a:hover {
    color: var(--success);
}

nav a .icon {
    font-size: 22px;
    margin-bottom: 3px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 32px;
    color: #fff;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: rgba(78, 204, 163, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-error {
    background: rgba(231, 76, 60, 0.2);
    color: var(--error);
    border: 1px solid var(--error);
}

.alert-warning {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--success);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .employees-grid {
        grid-template-columns: 1fr;
    }

    .log-entry {
        flex-direction: column;
        text-align: center;
    }
}

/* Face Detection Border */
.face-detected {
    border: 3px solid var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { border-color: var(--success); }
    50% { border-color: rgba(78, 204, 163, 0.5); }
}
