/* سامانه حضور و غیاب - استایل اصلی (نسخه حرفه‌ای) */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400; font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700; font-display: swap;
}

:root {
    --bg: #0B0F1A;
    --bg-elevated: #141B2C;
    --bg-elevated-2: #1B2438;
    --border: #2A3348;
    --blue: #4C7CF3;
    --blue-light: #7AA2FF;
    --blue-dim: rgba(76,124,243,0.15);
    --success: #3DD9A4;
    --success-dim: rgba(61,217,164,0.15);
    --danger: #FF5C7A;
    --danger-dim: rgba(255,92,122,0.15);
    --warning: #FFB648;
    --warning-dim: rgba(255,182,72,0.15);
    --purple: #A78BFA;
    --text: #EDF0F7;
    --text-dim: #8B93A7;
    --text-faint: #5C6377;
    --radius: 16px;
    --radius-sm: 11px;
    --shadow: 0 12px 32px rgba(0,0,0,0.35);
    --shadow-sm: 0 4px 14px rgba(0,0,0,0.2);
    --ease: cubic-bezier(.22,1,.36,1);
}

body.light-mode {
    --bg: #EEF1F8;
    --bg-elevated: #FFFFFF;
    --bg-elevated-2: #F3F5FB;
    --border: #E1E6EF;
    --text: #1B2130;
    --text-dim: #5B6478;
    --text-faint: #9AA3B5;
    --shadow: 0 12px 32px rgba(20,30,60,0.10);
    --shadow-sm: 0 4px 14px rgba(20,30,60,0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg); color: var(--text);
    direction: rtl; min-height: 100vh; line-height: 1.7;
    transition: background-color .3s var(--ease), color .3s var(--ease);
}
a { color: var(--blue-light); text-decoration: none; }

@keyframes fadeInUp { from { opacity:0; transform: translateY(10px);} to { opacity:1; transform: translateY(0);} }
@keyframes floatGlow { 0%,100% { transform: translate(0,0);} 50% { transform: translate(-14px,10px);} }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(76,124,243,.45);} 70% { box-shadow: 0 0 0 12px rgba(76,124,243,0);} 100% { box-shadow: 0 0 0 0 rgba(76,124,243,0);} }

/* صفحه لاگین/ثبت‌نام */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden; padding: 20px;
    background: var(--bg);
}
.auth-page::before, .auth-page::after {
    content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%;
    filter: blur(70px); opacity: .35; animation: floatGlow 14s ease-in-out infinite;
    pointer-events: none;
}
.auth-page::before { background: var(--blue); top: -100px; right: -80px; }
.auth-page::after { background: var(--purple); bottom: -120px; left: -100px; animation-delay: 3s; }

.auth-card {
    position: relative; z-index: 1;
    background: linear-gradient(180deg, var(--bg-elevated), var(--bg-elevated-2));
    border: 1px solid var(--border);
    border-radius: 22px; padding: 42px 36px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow);
    animation: fadeInUp .5s var(--ease);
}
.auth-title {
    font-size: 25px; font-weight: 700; text-align: center; margin-bottom: 6px;
    background: linear-gradient(90deg, var(--blue-light), var(--purple));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-subtitle { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 22px; }
.auth-tabs a { flex: 1; text-align: center; padding: 10px; border-radius: 8px; color: var(--text-dim); font-weight: 700; font-size: 14px; transition: all .25s var(--ease); }
.auth-tabs a.active { background: var(--blue); color: white; box-shadow: 0 4px 14px rgba(76,124,243,.4); }

/* فرم‌ها */
input, select, textarea {
    font-family: inherit; background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); padding: 12px 14px; color: var(--text);
    font-size: 14px; width: 100%; transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-dim); }
label { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; display: block; font-weight: 700; }
.field { margin-bottom: 16px; }

/* دکمه‌ها */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; border-radius: var(--radius-sm); padding: 11px 20px;
    font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
    position: relative; overflow: hidden;
    transition: transform .18s var(--ease), filter .2s var(--ease), box-shadow .2s var(--ease);
}
.btn .ripple {
    position: absolute; border-radius: 50%; transform: scale(0);
    background: rgba(255,255,255,.45); pointer-events: none;
    animation: rippleAnim .55s ease-out forwards;
}
@keyframes rippleAnim { to { transform: scale(2.6); opacity: 0; } }
.btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn:active { transform: scale(0.96) translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--blue), #3D63D0); color: white; box-shadow: 0 6px 18px rgba(76,124,243,.35); }
.btn-success { background: linear-gradient(135deg, var(--success), #23B383); color: #06281F; box-shadow: 0 6px 18px rgba(61,217,164,.3); }
.btn-danger { background: linear-gradient(135deg, var(--danger), #E23A5C); color: #340012; box-shadow: 0 6px 18px rgba(255,92,122,.3); }
.btn-warning { background: linear-gradient(135deg, var(--warning), #E89530); color: #3A2500; box-shadow: 0 6px 18px rgba(255,182,72,.3); }
.btn-ghost { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue-light); }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* alerts */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; border: 1px solid transparent; animation: fadeInUp .35s var(--ease); }
.alert-success { background: var(--success-dim); color: var(--success); border-color: rgba(61,217,164,0.3); }
.alert-danger { background: var(--danger-dim); color: var(--danger); border-color: rgba(255,92,122,0.3); }
.alert-warning { background: var(--warning-dim); color: var(--warning); border-color: rgba(255,182,72,0.3); }
.alert-info { background: var(--blue-dim); color: var(--blue-light); border-color: rgba(76,124,243,0.3); }

/* Layout اصلی اپ */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px; background: linear-gradient(180deg, var(--bg-elevated), var(--bg));
    border-left: 1px solid var(--border);
    padding: 24px 16px; display: flex; flex-direction: column; gap: 6px;
    position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { font-weight: 700; font-size: 17px; margin-bottom: 24px; padding: 0 8px; display: flex; align-items: center; gap: 8px; }
.sidebar-brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 12px var(--blue); animation: pulseRing 2.5s infinite; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); color: var(--text-dim); font-size: 14px; font-weight: 600; transition: all .2s var(--ease); }
.nav-item:hover { background: var(--bg-elevated-2); color: var(--text); transform: translateX(-2px); }
.nav-item.active { background: var(--blue-dim); color: var(--blue-light); box-shadow: inset 0 0 0 1px rgba(76,124,243,.25); }
.sidebar-footer { margin-top: auto; }
.theme-toggle {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px; border-radius: var(--radius-sm); background: var(--bg);
    border: 1px solid var(--border); color: var(--text-dim); font-size: 13px;
    font-weight: 700; cursor: pointer; margin-bottom: 6px; width: 100%;
    transition: all .2s var(--ease);
}
.theme-toggle:hover { color: var(--text); border-color: var(--blue); }
.main-content { flex: 1; padding: 28px 32px; max-width: 100%; overflow-x: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; }
.page-subtitle { color: var(--text-dim); font-size: 13px; margin-top: 4px; }

/* کارت‌های آماری */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card {
    background: linear-gradient(160deg, var(--bg-elevated), var(--bg-elevated-2));
    border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
    position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
    transition: transform .25s var(--ease), box-shadow .25s var(--ease);
    animation: fadeInUp .4s var(--ease);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card::before { content: ''; position: absolute; top: 0; right: 0; width: 4px; height: 100%; background: var(--accent, var(--blue)); box-shadow: 0 0 12px var(--accent, var(--blue)); }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--accent, var(--blue-light)); }
.stat-card .stat-label { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }

.card {
    background: linear-gradient(160deg, var(--bg-elevated), var(--bg-elevated-2));
    border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px;
    box-shadow: var(--shadow-sm); animation: fadeInUp .4s var(--ease);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }

.action-buttons { display: flex; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.action-buttons .btn { padding: 16px 28px; font-size: 15px; flex: 1; min-width: 160px; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab-link { padding: 10px 18px; color: var(--text-dim); font-weight: 700; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .2s; }
.tab-link.active { color: var(--blue-light); border-color: var(--blue); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th { background: var(--bg); color: var(--text-dim); text-align: right; padding: 12px 14px; font-weight: 700; font-size: 12.5px; white-space: nowrap; border-bottom: 1px solid var(--border); }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr { transition: background-color .15s; }
tbody tr:hover { background: rgba(76,124,243,0.05); }
tbody tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 700; }
.badge-present { background: var(--success-dim); color: var(--success); }
.badge-late { background: var(--warning-dim); color: var(--warning); }
.badge-absent { background: var(--danger-dim); color: var(--danger); }
.badge-leave { background: var(--blue-dim); color: var(--blue-light); }
.badge-pending { background: rgba(167,139,250,0.15); color: var(--purple); }

.calendar-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.calendar-month-label { font-size: 17px; font-weight: 700; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.calendar-weekday { text-align: center; color: var(--text-dim); font-size: 12px; font-weight: 700; padding-bottom: 6px; }
.calendar-day { background: var(--bg); border: 1.5px solid var(--border); border-radius: 10px; padding: 8px; min-height: 64px; font-size: 13px; position: relative; transition: transform .15s var(--ease); }
.calendar-day:not(.empty):hover { transform: scale(1.04); z-index: 2; }
.calendar-day.holiday { border-color: var(--danger); background: var(--danger-dim); }
.calendar-day.status-present { border-color: var(--success); }
.calendar-day.status-late { border-color: var(--warning); }
.calendar-day.status-leave { border-color: var(--blue); }
.calendar-day.status-absent { border-color: var(--danger); }
.calendar-day .day-num { font-weight: 700; }
.calendar-day .holiday-title { font-size: 9.5px; color: var(--danger); display: block; margin-top: 3px; line-height: 1.3; }
.calendar-day.empty { background: transparent; border: none; }

.filter-row { display: flex; gap: 12px; align-items: end; margin-bottom: 20px; flex-wrap: wrap; }
.filter-row .field { margin-bottom: 0; min-width: 140px; }

.flex { display: flex; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.mt-16 { margin-top: 16px; }
.text-dim { color: var(--text-dim); }
.text-center { text-align: center; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-dim); }
.empty-state .icon { font-size: 36px; margin-bottom: 10px; }

@media (max-width: 880px) {
    .app-shell { flex-direction: column; }
    .sidebar {
        width: 100%; height: auto; position: static; flex-direction: row;
        overflow-x: auto; padding: 10px 12px; gap: 6px;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar-brand { display: none; }
    .nav-item { white-space: nowrap; flex-shrink: 0; padding: 10px 14px; }
    .nav-item:hover { transform: none; }
    .sidebar-footer { margin-top: 0; display: flex; flex-shrink: 0; }
    .theme-toggle { white-space: nowrap; width: auto; margin-bottom: 0; }
    .main-content { padding: 16px 14px; }
    .action-buttons .btn { min-width: 100%; padding: 14px 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card:hover { transform: none; }
    .stat-card .stat-value { font-size: 22px; }
    .calendar-day { min-height: 44px; font-size: 10.5px; padding: 4px; }
    .calendar-day .holiday-title { display: none; }
    .topbar { flex-direction: column; align-items: flex-start; }
    .page-title { font-size: 18px; }
    table { font-size: 12px; }
    thead th, tbody td { padding: 8px 10px; }
    .card { padding: 16px; }
    .filter-row { flex-direction: column; align-items: stretch; }
    .filter-row .field { min-width: 0; }
    input, select, textarea, .btn { font-size: 16px; }
}
@media (max-width: 480px) {
    .auth-card { padding: 28px 20px; }
    .stats-grid { grid-template-columns: 1fr; }
}
