﻿/* ===== فونت‌های کوچک‌تر و ظریف‌تر برای تمام برنامه ===== */
body {
    font-size: 14px;
    line-height: 1.5;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ===== استایل برای تمام جدول‌ها ===== */
table {
    font-size: 0.875rem;
    border-collapse: collapse;
}

table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #374151;
}

table th,
table td {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
}

table tr:hover {
    background-color: #f9fafb;
}

/* ===== استایل برای کارت‌ها و باکس‌ها ===== */
.bg-white.rounded.shadow {
    font-size: 0.875rem;
}

.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1rem;
}

/* ===== استایل برای دکمه‌ها ===== */
button, 
a[class*="bg-"],
.btn {
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

button:focus,
a:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

button:hover,
a[class*="bg-"]:hover,
.btn:hover {
    transform: translateY(-1px);
}

/* ===== استایل برای فرم‌ها ===== */
input, 
select, 
textarea {
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease-in-out;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== استایل برای هدینگ‌ها ===== */
h1 { 
    font-size: 1.5rem; 
    font-weight: 700;
    color: #1f2937;
}

h2 { 
    font-size: 1.25rem; 
    font-weight: 600;
    color: #374151;
}

h3 { 
    font-size: 1.125rem; 
    font-weight: 600;
    color: #4b5563;
}

/* ===== استایل برای ناوبری و منو ===== */
nav {
    font-size: 0.875rem;
}

.nav-item {
    transition: all 0.2s ease-in-out;
    border-radius: 0.5rem;
}

.nav-item:hover {
    transform: translateY(-1px);
    background-color: #f8fafc;
}

/* ===== استایل برای منوی dropdown ===== */
.dropdown-group {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 220px;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    margin-top: 0.5rem;
}

.dropdown-group:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: right;
    color: #374151;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    font-size: 0.875rem;
    cursor: pointer;
}

.dropdown-item:first-child {
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}

.dropdown-item:last-child {
    border-bottom-left-radius: 0.75rem;
    border-bottom-right-radius: 0.75rem;
}

.dropdown-item:hover {
    background-color: #f8fafc;
    color: #3b82f6;
}

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0.25rem 0;
}

/* ===== استایل برای پیام‌های سیستم ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    animation: slideIn 0.3s ease-out;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ===== استایل برای وضعیت‌ها ===== */
.status-valid {
    background-color: #d1fae5;
    color: #065f46;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.status-expired {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.status-warning {
    background-color: #fef3c7;
    color: #92400e;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

.status-neutral {
    background-color: #f3f4f6;
    color: #374151;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}

/* ===== کلاس‌های سفارشی برای استفاده در صفحات ===== */
.table-sm th,
.table-sm td {
    padding: 0.375rem;
    font-size: 0.8rem;
}

.table-compact th,
.table-compact td {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.card-sm {
    font-size: 0.8rem;
    padding: 0.75rem;
}

.card-compact {
    font-size: 0.75rem;
    padding: 0.5rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-2xs {
    font-size: 0.625rem;
}

/* ===== استایل برای هشدارها و اعلان‌ها ===== */
.birthday-alert { 
    background-color: #fce7f3; 
    color: #be185d; 
    border: 1px solid #fbcfe8; 
    font-size: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

.insurance-expired { 
    background-color: #fee2e2; 
    color: #dc2626; 
    border: 1px solid #fecaca; 
    font-size: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

.insurance-urgent { 
    background-color: #ffedd5; 
    color: #ea580c; 
    border: 1px solid #fed7aa; 
    font-size: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

.no-insurance { 
    background-color: #f3f4f6; 
    color: #6b7280; 
    border: 1px solid #d1d5db; 
    font-size: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

.payment-overdue { 
    background-color: #fecaca; 
    color: #dc2626; 
    border: 1px solid #fca5a5; 
    font-size: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    animation: blinkRed 1s infinite;
}

.belt-alert { 
    background-color: #dbeafe; 
    color: #1d4ed8; 
    border: 1px solid #bfdbfe; 
    font-size: 0.75rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

/* چشمک زن برای معوقه */
.blink-red {
    animation: blinkRed 1s infinite;
}

@keyframes blinkRed {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

/* ===== استایل برای نمایش در موبایل ===== */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 0.375rem;
        font-size: 0.8rem;
    }
    
    h1 { font-size: 1.25rem; }
    h2 { font-size: 1.125rem; }
    h3 { font-size: 1rem; }
    
    .table-sm th,
    .table-sm td {
        padding: 0.25rem;
        font-size: 0.75rem;
    }
    
    .card-sm {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .btn-sm {
        padding: 0.125rem 0.375rem;
        font-size: 0.75rem;
    }
    
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }
    
    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: 1px solid #e5e7eb;
        margin-top: 0;
        opacity: 1;
        visibility: visible;
        transform: none;
    }
}

/* ===== استایل برای پرینت ===== */
@media print {
    body {
        font-size: 12px;
        background: white;
    }
    
    table {
        font-size: 10px;
    }
    
    table th,
    table td {
        padding: 0.25rem;
        border: 1px solid #000;
    }
    
    .no-print {
        display: none !important;
    }
    
    .alert {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
    }
}

/* ===== استایل‌های کمکی ===== */
.text-justify {
    text-align: justify;
}

.border-light {
    border: 1px solid #e5e7eb;
}

.shadow-light {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.shadow-medium {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.rounded-sm {
    border-radius: 0.25rem;
}

.rounded-lg {
    border-radius: 0.5rem;
}

.rounded-xl {
    border-radius: 0.75rem;
}

/* ===== انیمیشن‌های ظریف ===== */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.scale-in {
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ===== استایل برای اسکرول بار ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== استایل‌های ویژه برای دکمه‌ها ===== */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* ===== استایل برای کارت‌های ویژه ===== */
.feature-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* ===== استایل برای نوار پیشرفت ===== */
.progress-bar {
    background-color: #e5e7eb;
    border-radius: 1rem;
    overflow: hidden;
    height: 0.5rem;
}

.progress-fill {
    height: 100%;
    border-radius: 1rem;
    transition: width 0.3s ease;
}

.progress-blue { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.progress-green { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-red { background: linear-gradient(90deg, #ef4444, #f87171); }
.progress-yellow { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

/* ===== استایل برای ثابت کردن ستون اسم و فامیل در حضور و غیاب ===== */
#attendanceTable table {
    position: relative;
}

#attendanceTable table thead th:first-child,
#attendanceTable table tbody td:first-child {
    position: sticky;
    right: 0;
    background-color: white;
    z-index: 10;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
}

#attendanceTable table thead th:first-child {
    z-index: 20;
    background-color: #f8fafc;
}

.sticky-header {
    position: sticky;
    right: 0;
    background-color: #f8fafc;
    z-index: 15;
}

.sticky-cell {
    position: sticky;
    right: 0;
    background-color: white;
    z-index: 10;
}

/* برای موبایل و تبلت */
@media (max-width: 768px) {
    #attendanceTable table thead th:first-child,
    #attendanceTable table tbody td:first-child {
        position: sticky;
        right: 0;
        min-width: 120px;
        background-color: white;
    }
    
    #attendanceTable table thead th:first-child {
        background-color: #f8fafc;
    }
    
    .sticky-header,
    .sticky-cell {
        position: sticky;
        right: 0;
    }
}
/* ===== استایل کامل برای ثابت کردن هدرها در حضور و غیاب ===== */
#attendanceTable .overflow-x-auto {
    max-height: 70vh;
    overflow: auto;
    position: relative;
}

#attendanceTable table thead {
    position: sticky;
    top: 0;
    z-index: 25;
    background-color: #f8fafc;
}

#attendanceTable table thead th {
    background-color: #f8fafc;
    border-bottom: 2px solid #e5e7eb;
}

#attendanceTable table thead th.sticky-header {
    position: sticky;
    right: 0;
    top: 0;
    z-index: 30;
    background-color: #f8fafc;
    border-bottom: 2px solid #e5e7eb;
}

#attendanceTable table tbody td.sticky-cell {
    position: sticky;
    right: 0;
    z-index: 20;
    background-color: white;
}

/* هدر اصلی صفحه */
.container.mx-auto.p-4 > .flex.justify-between.items-center.mb-6 {
    position: sticky;
    top: 0;
    background: white;
    z-index: 40;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

/* برای موبایل */
@media (max-width: 768px) {
    #attendanceTable .overflow-x-auto {
        max-height: 60vh;
    }
    
    .container.mx-auto.p-4 > .flex.justify-between.items-center.mb-6 {
        position: relative;
        padding: 0.5rem 0;
    }
}