/* استایل‌های کلی */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazir', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* هدر */
.header {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.logo-container {
    flex-shrink: 0;
}

.school-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #667eea;
}

.header-text {
    flex: 1;
}

.header-text h1 {
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.school-motto {
    color: #667eea;
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.academic-year {
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* ناوبری */
.navigation {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(31, 38, 135, 0.2);
}

.nav-buttons {
    display: flex;
    gap: 10px;
}

.nav-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #f8f9fa;
    color: #6c757d;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.nav-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* بخش فرم */
.form-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.form-container h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.section-title {
    grid-column: 1 / -1;
    font-size: 1.2rem;
    font-weight: 600;
    color: #667eea;
    margin: 20px 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

label {
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 5px;
    font-size: 0.95rem;
}

input[type="text"],
input[type="tel"],
select,
textarea {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input[type="text"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* دکمه‌های فرم */
.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.submit-btn,
.reset-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.submit-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.6);
}

.reset-btn {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.reset-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #5a6268 0%, #343a40 100%);
}

/* داشبورد */
.dashboard-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.dashboard-container h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
}

/* آمار */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

@media (min-width: 1024px) {
    .stats-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.stat-card h3 {
    font-size: 0.9rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

/* دکمه‌های عملیات */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.import-btn {
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
    color: white;
}

.show-remaining-btn {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: white;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* فیلتر و جستجو */
.filter-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
}

.search-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#searchInput,
#classFilter {
    flex: 1;
    min-width: 200px;
}

/* جدول */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

.students-table {
    width: 100%;
    background: white;
    border-collapse: collapse;
}

.students-table th,
.students-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #e9ecef;
}

.students-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.students-table tr:hover {
    background: #f8f9fa;
}

.view-btn,
.delete-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    margin: 0 2px;
    transition: all 0.3s ease;
}

.view-btn {
    background: #007bff;
    color: white;
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.view-btn:hover,
.delete-btn:hover {
    transform: scale(1.05);
}

/* بخش دانش آموزان باقی مانده */
.remaining-students-section {
    background: #fff3cd;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #ffeaa7;
}

.remaining-students-section h3 {
    color: #856404;
    margin-bottom: 15px;
}

.remaining-students-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 10px;
}

.remaining-student-item {
    background: white;
    padding: 10px 15px;
    border-radius: 6px;
    border-right: 4px solid #ffc107;
    font-weight: 500;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

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

.loading-spinner p {
    color: white;
    font-weight: 500;
}

/* پیام‌ها */
.message-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
}

.message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    color: white;
    font-weight: 500;
    min-width: 300px;
    text-align: center;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message-icon {
    font-size: 18px;
    font-weight: bold;
}

.message.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.message.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.message.info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
    }
    
    .header-text h1 {
        font-size: 1.4rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-buttons {
        flex-direction: column;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .submit-btn,
    .reset-btn {
        width: 100%;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .students-table {
        font-size: 0.85rem;
    }
    
    .students-table th,
    .students-table td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .school-logo {
        width: 60px;
        height: 60px;
    }
    
    .header-text h1 {
        font-size: 1.2rem;
    }
    
    .school-motto {
        font-size: 1rem;
    }
    
    .form-section,
    .dashboard-section {
        padding: 20px;
    }
}

/* تنظیمات چاپ */
@media print {
    body {
        background: white;
    }
    
    .navigation,
    .action-buttons,
    .filter-section {
        display: none;
    }
    
    .header {
        background: white;
        box-shadow: none;
        border-bottom: 2px solid #333;
    }
    
    .students-table {
        box-shadow: none;
    }
    
    .students-table th {
        background: #f8f9fa !important;
        color: #333 !important;
    }
}

/* استایل‌های مودال ورود */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    position: relative;
    text-align: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close-modal {
    position: absolute;
    top: 15px;
    left: 20px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-modal:hover {
    color: #ddd;
}

#loginForm {
    padding: 30px;
}

#loginForm .form-group {
    margin-bottom: 20px;
}

#loginForm label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: 500;
}

#loginForm input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    direction: ltr;
    text-align: left;
}

#loginForm input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.form-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #ddd;
}

.btn-secondary:hover {
    background: #e9ecef;
}

/* استایل دکمه خروج */
.logout-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%) !important;
    color: white !important;
}

.logout-btn:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}
/* ا
ستایل‌های پیام‌های بهبود یافته */
.message-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 500px;
    width: 90%;
}

.message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    position: relative;
}

.message.show {
    opacity: 1;
    transform: translateY(0);
}

.message.fade-out {
    opacity: 0;
    transform: translateY(-20px);
}

.message-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
}

.message.success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message.error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message.warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message.info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message-close {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: inherit;
    font-size: 1.5rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.message-close:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

/* انیمیشن برای loading spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner p {
    color: white;
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* استایل‌های دانش آموزان بدون ثبت نام */
.remaining-students-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.remaining-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.remaining-header h4 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin: 0;
}

.export-remaining-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.export-remaining-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.class-group {
    margin-bottom: 25px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.class-group:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.class-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.class-group-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.export-class-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.export-class-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.class-group-body {
    padding: 15px;
    background: #f8f9fa;
}

.remaining-student-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.remaining-student-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
    transform: translateX(-3px);
}

.remaining-student-item:last-child {
    margin-bottom: 0;
}

.student-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.student-name {
    flex: 1;
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.95rem;
}

.student-national-id {
    color: #6c757d;
    font-size: 0.85rem;
    direction: ltr;
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
}

/* حالت خالی */
.remaining-students-section .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.remaining-students-section .empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* انیمیشن ورود */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.class-group {
    animation: slideIn 0.3s ease forwards;
}

.class-group:nth-child(1) { animation-delay: 0.1s; }
.class-group:nth-child(2) { animation-delay: 0.2s; }
.class-group:nth-child(3) { animation-delay: 0.3s; }
.class-group:nth-child(4) { animation-delay: 0.4s; }
.class-group:nth-child(5) { animation-delay: 0.5s; }

/* Responsive */
@media (max-width: 768px) {
    .remaining-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .export-remaining-btn {
        width: 100%;
    }
    
    .class-group-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .export-class-btn {
        width: 100%;
    }
    
    .remaining-student-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .student-number {
        align-self: flex-start;
    }
}
