@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-active: #3730a3;
    --sidebar-bg: #0f172a;
    --body-bg: #f8fafc;
    --text-dark: #1e293b;
    --text-muted: #64748b;
    --sidebar-width: 280px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
    --shadow-indigo: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--body-bg) !important;
    color: var(--text-dark);
    display: flex !important;
    min-height: 100vh;
    direction: rtl;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width) !important;
    background: var(--sidebar-bg) !important;
    height: 100vh;
    position: fixed !important;
    right: 0 !important;
    top: 0;
    padding: 40px 24px;
    z-index: 9999;
    color: white;
    border-left: 1px solid rgba(255,255,255,0.05);
}

.sidebar-logo {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
    color: #fff;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 12px;
}

.nav-links a {
    color: #94a3b8;
    text-decoration: none;
    padding: 16px 20px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 600;
    transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links a:hover {
    background: rgba(255,255,255,0.05);
    color: white;
    transform: translateX(-5px);
}

.nav-links a.active {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: var(--shadow-indigo);
}

/* Main Content Wrapper */
.main-wrapper {
    margin-right: var(--sidebar-width) !important;
    flex: 1;
    padding: 40px;
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.page-title h2 {
    font-size: 2rem;
    font-weight: 800;
}

.page-title p {
    color: var(--text-muted);
    margin-top: 5px;
}

/* Buttons Fix & Enhancement */
.btn-modern {
    padding: 14px 28px;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1rem;
    position: relative;
    overflow: hidden;
    user-select: none;
    justify-content: center;
}

.btn-primary-m {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
    color: white !important;
    box-shadow: var(--shadow-indigo);
}

.btn-primary-m:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -3px rgba(79, 70, 229, 0.5);
    filter: brightness(1.1);
}

.btn-primary-m:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 5px 10px -2px rgba(79, 70, 229, 0.4);
    background: var(--primary-active) !important;
}

/* Glass Card & Gradients */
.glass-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

/* Stat Cards Enhancement */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.widget {
    background: white;
    padding: 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 25px;
    border: 1px solid #f1f5f9;
    transition: all 0.3s ease;
}

.widget:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.widget-icon {
    width: 65px;
    height: 65px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.blue-icon { background: #eef2ff; color: #4338ca; }
.green-icon { background: #ecfdf5; color: #059669; }
.red-icon { background: #fef2f2; color: #dc2626; }
.purple-icon { background: #f5f3ff; color: #7c3aed; }

.widget-info h4 { color: var(--text-muted); font-size: 0.9rem; font-weight: 600; margin-bottom: 5px; }
.widget-info .val { font-size: 2rem; font-weight: 800; }

/* Tables */
.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table th {
    background: #f9fafb;
    padding: 20px;
    text-align: right;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.modern-table td {
    padding: 20px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
}

.modern-table tr:hover td {
    background-color: #f8fafc !important;
}

/* Employee Cards */
.employees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
}

.emp-card-modern {
    background: white;
    padding: 35px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    border: 1px solid #f3f4f6;
    transition: all 0.3s ease;
}

.emp-card-modern:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.06);
}

.emp-img-wrapper {
    width: 130px;
    height: 130px;
    margin: 0 auto 25px;
}

.emp-img-wrapper img, .no-img-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 40px;
    object-fit: cover;
    border: 5px solid #f9fafb;
}

/* Modals */
.modal-modern {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(8px) !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100000 !important;
}

.modal-content-m {
    background: white !important;
    padding: 40px !important;
    border-radius: 32px !important;
    width: 90% !important;
    max-width: 500px !important;
    box-shadow: 0 30px 70px rgba(0,0,0,0.3) !important;
    position: relative !important;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Badges */
.badge {
    padding: 6px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.8rem;
}

.badge-success { background: #ecfdf5; color: #059669; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-danger { background: #fef2f2; color: #dc2626; }

/* Status Labels in Table */
.status-badge {
    padding: 6px 12px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.8rem;
}

.status-present { background: #dcfce7; color: #15803d; }
.status-absent { background: #fee2e2; color: #b91c1c; }
.status-weekend { background: #f1f5f9; color: #64748b; }

.present-day { background-color: #f0fdf4; }
.absent-day { background-color: #fff1f2; }
.weekend-day { background-color: #f8fafc; color: #94a3b8; }
.future-day { opacity: 0.6; background-color: #fdfdfd; }

.thumb-container {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

.thumb-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-dark);
}

input, select {
    width: 100%;
    padding: 14px 18px;
    border-radius: 16px;
    border: 2px solid #e2e8f0;
    font-family: inherit;
    font-size: 1rem;
    transition: 0.2s;
}

input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 90px; padding: 30px 10px; }
    .sidebar-logo span, .nav-links span { display: none; }
    .main-wrapper { margin-right: 90px; width: calc(100% - 90px); }
}
