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

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --bg-color: #f3f4f6;
    --text-color: #1f2937;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-color);
}

.container {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    margin: 1rem;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    padding: 2.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2);
}

h1, h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #111827;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.9);
}

input[type="text"]:focus, input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.camera-container {
    position: relative;
    width: 100%;
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: #000;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

canvas {
    display: none;
}

.captured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-sizing: border-box;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-success {
    background-color: var(--success);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

.btn-danger:hover {
    background-color: var(--danger-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background-color: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background-color: #d1d5db;
}

.btn-group {
    display: flex;
    gap: 1rem;
}

.btn-group .btn {
    flex: 1;
}

.nav-links {
    text-align: center;
    margin-top: 1.5rem;
}

.nav-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Loader */
.loader {
    display: none;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto;
}

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

/* Toast Notification */
#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 10px;
    padding: 16px;
    position: fixed;
    z-index: 1000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 0.95rem;
    transition: opacity 0.3s, bottom 0.3s;
    opacity: 0;
}

#toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

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

#toast.success {
    background-color: var(--success);
}

/* History List */
.history-list {
    margin-top: 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid rgba(255,255,255,0.4);
}

.history-item img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.history-details {
    flex: 1;
}

.history-action {
    font-weight: 700;
    font-size: 1.1rem;
}

.history-action.in {
    color: var(--success);
}

.history-action.out {
    color: var(--danger);
}

.history-time {
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Admin Dashboard */
.admin-container {
    max-width: 1000px;
}

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

.table-wrapper {
    overflow-x: auto;
    background: rgba(255,255,255,0.7);
    border-radius: 12px;
}

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

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

th {
    font-weight: 600;
    color: #374151;
    background: rgba(255,255,255,0.8);
}

td img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

td img:hover {
    transform: scale(1.5);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-in {
    background: #d1fae5;
    color: #065f46;
}

.badge-out {
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 600px) {
    .glass-panel {
        padding: 1.5rem;
    }
}
