/* Statistics Section Styles */
.statistics-section {
    margin-bottom: 2rem;
}

.stats-card {
    background: var(--surface-strong);
    backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-light);
    animation: slideUp 0.6s ease-out both;
}

.stats-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-default);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--surface-border);
    transition: var(--transition);
}

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

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-gradient-start), var(--accent-gradient-end));
    border-radius: var(--radius-full);
    color: white;
    font-size: 1rem;
}

.stat-info {
    flex: 1;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-default);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Auto-Scan Status Styles */
.auto-scan-status {
    text-align: center;
    padding: 1.5rem;
    background: var(--surface-strong);
    backdrop-filter: blur(20px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
    animation: slideUp 0.6s ease-out both;
}

.status-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.status-indicator.active {
    color: var(--success-green);
}

.status-indicator.active i {
    animation: pulse 2s infinite;
}

.scan-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.25rem 0;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Main Content Area */
.main-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--bg-start);
    min-height: 100vh;
}

/* Main Header */
.main-header {
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.page-title .title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-default);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.datetime-section {
    text-align: right;
}

.time {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e40af;
    font-variant-numeric: tabular-nums;
}

.date {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Workspace Area */
.workspace {
    flex: 1;
    padding: 2rem;
    background: var(--bg-start);
}

.workspace-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Camera Section */
.camera-section {
    display: flex;
    flex-direction: column;
}

.camera-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.camera-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-default);
    margin: 0;
}

.fullscreen-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-default);
}

.camera-container {
    position: relative;
    flex: 1;
    aspect-ratio: 4/3;
    background: #000;
}

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

/* Table Section */
.table-section {
    display: flex;
    flex-direction: column;
}

.table-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.table-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-default);
    margin: 0;
}

.btn-refresh {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-refresh:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-default);
}

.table-container {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
}

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

.attendance-table th {
    background: #1e293b;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.attendance-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 0.9rem;
}

.attendance-table tr:hover {
    background: #f8fafc;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.success {
    background: #dcfce7;
    color: #16a34a;
}

.status-badge.warning {
    background: #fef3c7;
    color: #d97706;
}

/* Action Section */
.action-section {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #4f68f2, #9b5cf7);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 110, 253, 0.3);
}

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

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Result Section */
.result-section {
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

.result-section.show {
    opacity: 1;
    transform: translateY(0);
    max-height: 200px;
}

.result-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-default);
    margin-bottom: 0.25rem;
}

.user-status {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.check-time {
    font-size: 0.8rem;
    color: #4f68f2;
    font-weight: 600;
}

.result-card .status-badge {
    background: #dcfce7;
    color: #16a34a;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1200;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast-icon {
    font-size: 1.25rem;
    color: #16a34a;
}

.toast-message {
    font-size: 0.9rem;
    color: var(--text-default);
    font-weight: 500;
}

/* Scanning Overlay */
.scanning-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.scanning-overlay .scan-line {
    position: absolute;
    left: 9%;
    right: 9%;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #f59e0b, transparent);
    opacity: 0;
    transform: translateY(-10px);
    animation: scan 2s ease-in-out infinite;
}

.scanning-overlay.active .scan-line {
    opacity: 1;
    transform: translateY(0);
}

.scanning-overlay .scan-corners {
    position: absolute;
    inset: 1.5rem;
}

.corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 2px solid rgba(245, 158, 11, 0.85);
    border-radius: 12px;
    opacity: 0.95;
    filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.25));
    transform: scale(0.98);
}

.corner.top-left { top: 0; left: 0; border-right: none; border-bottom: none; }
.corner.top-right { top: 0; right: 0; border-left: none; border-bottom: none; }
.corner.bottom-left { bottom: 0; left: 0; border-right: none; border-top: none; }
.corner.bottom-right { bottom: 0; right: 0; border-left: none; border-top: none; }

body.scanning .camera-card .scan-line,
body.scanning .camera-card .corner {
    opacity: 1;
}

body.scanning .camera-card {
    border-color: rgba(245, 158, 11, 0.35);
}

body.success .camera-card {
    border-color: rgba(79, 110, 253, 0.45);
    box-shadow: 0 28px 90px rgba(79, 110, 253, 0.16);
}

@keyframes scan {
    0% { transform: translateY(0); }
    100% { transform: translateY(100%); }
}

/* Loading Indicator */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: white;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 0.875rem;
    font-weight: 500;
}

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

:root {
    --bg-start: #f8fafc;
    --bg-end: #ffffff;
    --accent-gradient-start: #4f68f2;
    --accent-gradient-end: #9b5cf7;
    --accent-light: #d3d8ff;
    --accent-soft: rgba(79, 110, 253, 0.14);
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: rgba(255, 255, 255, 0.95);
    --surface-border: rgba(79, 110, 253, 0.18);
    --text-default: #111827;
    --text-muted: #4b5563;
    --status-orange: #f59e0b;
    --success-green: #10b981;
    --shadow-soft: 0 26px 80px rgba(15, 23, 42, 0.08);
    --shadow-light: 0 14px 44px rgba(15, 23, 42, 0.08);
    --radius-lg: 28px;
    --radius-xl: 34px;
    --radius-full: 999px;
    --transition: 0.32s ease-in-out;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-default);
    line-height: 1.6;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    background: var(--bg-start);
}

button,
input,
textarea,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

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

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

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .workspace-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .workspace {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .action-section {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}
