/* FaceHR - نظام الحضور الذكي */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary: #64748b;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --dark: #1e293b;
    --sidebar-width: 260px;
    --sidebar-bg: #1e293b;
}

* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f1f5f9;
    margin: 0;
    padding: 0;
    direction: rtl;
}

/* ==================== صفحة تسجيل الدخول ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card h2 {
    text-align: center;
    color: var(--dark);
    margin-bottom: 8px;
}

.login-card .subtitle {
    text-align: center;
    color: var(--secondary);
    margin-bottom: 30px;
}

.login-card .logo {
    text-align: center;
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 16px;
}

/* ==================== التخطيط الرئيسي ==================== */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* ==================== القائمة الجانبية ==================== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    color: #fff;
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.collapsed {
    right: calc(-1 * var(--sidebar-width));
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.3rem;
}

.sidebar-nav {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-right: 3px solid transparent;
}

.sidebar-nav li a:hover,
.sidebar-nav li.active a {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-right-color: var(--primary);
}

.sidebar-nav li a i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==================== المحتوى ==================== */
.content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 20px;
    transition: margin-right 0.3s ease;
}

.content.expanded {
    margin-right: 0;
}

/* ==================== البطاقات الإحصائية ==================== */
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s;
    border-right: 4px solid var(--primary);
}

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

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

.stat-card .stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-card .stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-card .stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-card .stat-icon.yellow { background: #fef3c7; color: var(--warning); }

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark);
    margin: 8px 0 4px;
}

.stat-card .stat-label {
    color: var(--secondary);
    font-size: 0.9rem;
}

/* ==================== الجداول ==================== */
.table-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.table-card .card-header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.table-card .card-header h5 {
    margin: 0;
    color: var(--dark);
}

.table-card .table {
    margin: 0;
}

.table-card .table th {
    background: #f8fafc;
    color: var(--secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    border-bottom: 2px solid #e2e8f0;
    padding: 12px 16px;
}

.table-card .table td {
    padding: 12px 16px;
    vertical-align: middle;
}

/* ==================== الأزرار ==================== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ==================== صفحة الكاميرا ==================== */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
}

.camera-container video {
    width: 100%;
    display: block;
    transform: scaleX(-1);
}

.camera-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.face-guide {
    width: 220px;
    height: 280px;
    border: 3px dashed rgba(255, 255, 255, 0.5);
    border-radius: 50%;
}

.camera-status {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.camera-status.success { background: rgba(22, 163, 74, 0.8); }
.camera-status.error { background: rgba(220, 38, 38, 0.8); }

/* ==================== التسجيل بالوجه ==================== */
.enrollment-progress {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 16px 0;
}

.enrollment-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background 0.3s;
}

.enrollment-dot.captured {
    background: var(--success);
}

.face-thumbnails {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 16px 0;
}

.face-thumbnail {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}

.face-thumbnail.active {
    border-color: var(--primary);
}

/* ==================== الإحصائيات في لوحة التحكم ==================== */
.chart-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* ==================== حالة الحضور ==================== */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.present { background: #dcfce7; color: #166534; }
.status-badge.late { background: #fef3c7; color: #92400e; }
.status-badge.absent { background: #fee2e2; color: #991b1b; }
.status-badge.approved { background: #dcfce7; color: #166534; }
.status-badge.pending { background: #fef3c7; color: #92400e; }

/* ==================== النماذج ==================== */
.form-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.form-label {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 6px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

/* ==================== التنبيهات ==================== */
.alert-float {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    min-width: 300px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==================== Modal ==================== */
.modal-header {
    background: var(--primary);
    color: #fff;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ==================== Responsive ==================== */
@media (max-width: 768px) {
    .sidebar {
        right: calc(-1 * var(--sidebar-width));
    }
    .sidebar.show {
        right: 0;
    }
    .content {
        margin-right: 0;
    }
    .stat-card .stat-number {
        font-size: 1.5rem;
    }
}

/* ==================== Empty state ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* ==================== Print styles ==================== */
@media print {
    .sidebar, .navbar, .btn, .no-print { display: none !important; }
    .content { margin: 0 !important; padding: 0 !important; }
}
