* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== تنظیمات فونت ==================== */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Sahel&display=swap');
@import url('https://fonts.googleapis.com/css2?family=YekanBakh&display=swap');

body {
    font-family: 'Tahoma', 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
}

body.font-vazirmatn {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

body.font-sahel {
    font-family: 'Sahel', Tahoma, sans-serif;
}

body.font-yekanbakh {
    font-family: 'YekanBakh', Tahoma, sans-serif;
}

.container {
    max-width: 1300px;
    margin: 0 auto;
}

/* ==================== سربرگ موسسه با لوگو و شعار ==================== */
.letterhead {
    background: #ffffff;
    border-radius: 25px 25px 0 0;
    padding: 25px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-bottom: 3px solid #3498db;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.logo-image {
    max-width: 70px;
    max-height: 70px;
    object-fit: contain;
    border-radius: 12px;
}

.logo-icon {
    font-size: 55px;
    color: #3498db;
}

.logo-text-section {
    text-align: right;
}

.logo-section h2 {
    color: #2c3e50;
    font-size: 26px;
    font-weight: bold;
    margin-bottom: 5px;
}

.company-slogan {
    color: #7f8c8d;
    font-size: 14px;
    font-style: italic;
    margin-top: 5px;
    padding-right: 10px;
    border-right: 3px solid #3498db;
}

.owner-info {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
    color: #555;
    font-size: 14px;
}

.owner-info div {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 6px 15px;
    border-radius: 25px;
}

.owner-info i {
    color: #3498db;
}

/* ==================== تب‌های اصلی ==================== */
.main-tabs {
    display: flex;
    gap: 12px;
    background: #ffffff;
    padding: 15px 25px 0 25px;
    flex-wrap: wrap;
}

.main-tab-btn {
    padding: 12px 28px;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    border-radius: 15px 15px 0 0;
    font-size: 15px;
    font-weight: bold;
    color: #555;
}

.main-tab-btn i {
    margin-left: 8px;
    color: #3498db;
}

.main-tab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.main-tab-btn.active i {
    color: white;
}

.main-tab-content {
    display: none;
    background: #ffffff;
    border-radius: 0 0 25px 25px;
    padding: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.main-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== زیر تب‌های پنل مشتری ==================== */
.customer-subtabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
}

.subtab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #666;
}

.subtab-btn i {
    margin-left: 5px;
    color: #3498db;
}

.subtab-btn.active {
    color: #667eea;
    border-bottom: 3px solid #667eea;
}

.subtab-btn.active i {
    color: #667eea;
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

/* ==================== ساب‌تب‌های پنل مدیریت ==================== */
.admin-subtabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    flex-wrap: wrap;
}

.admin-subtab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    color: #666;
    border-radius: 10px;
    transition: all 0.3s;
}

.admin-subtab-btn i {
    margin-left: 8px;
}

.admin-subtab-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.admin-subtab-content {
    display: none;
}

.admin-subtab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ==================== کارت‌ها ==================== */
.card {
    background: #f9f9f9;
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.card h2, .card h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    border-right: 5px solid #3498db;
    padding-right: 15px;
    font-size: 22px;
    font-weight: bold;
}

.card h2 i, .card h3 i {
    margin-left: 10px;
    color: #3498db;
}

/* ==================== فرم‌ها ==================== */
.form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 14px;
}

label i {
    margin-left: 8px;
    color: #3498db;
}

.required {
    color: #e74c3c;
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 14px;
    background: #ffffff;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ==================== دکمه‌ها ==================== */
.btn-submit, .btn-search, .btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-submit:hover, .btn-search:hover, .btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-search {
    width: auto;
}

.btn-add-part {
    background: #2ed573;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 15px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-add-part:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

.btn-delete {
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    margin: 0 3px;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-invoice {
    background: #9c27b0;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    margin: 0 3px;
    transition: all 0.2s;
}

.btn-invoice:hover {
    background: #7b1fa2;
    transform: translateY(-2px);
}

.btn-archive {
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    margin: 0 3px;
    transition: all 0.2s;
}

.btn-archive:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

.report-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    margin: 5px;
}

/* ==================== کارت‌های آمار ==================== */
.stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
    justify-content: center;
}

.stat-card-blue, 
.stat-card-yellow, 
.stat-card-blue2, 
.stat-card-green, 
.stat-card-purple {
    flex: 1;
    min-width: 160px;
    background: white;
    border-radius: 16px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-card-blue { border-right: 4px solid #2196f3; background: linear-gradient(135deg, #fff, #e3f2fd); }
.stat-card-yellow { border-right: 4px solid #ff9800; background: linear-gradient(135deg, #fff, #fff3e0); }
.stat-card-blue2 { border-right: 4px solid #00bcd4; background: linear-gradient(135deg, #fff, #e0f7fa); }
.stat-card-green { border-right: 4px solid #4caf50; background: linear-gradient(135deg, #fff, #e8f5e9); }
.stat-card-purple { border-right: 4px solid #9c27b0; background: linear-gradient(135deg, #fff, #f3e5f5); }

.stat-card-blue:hover, 
.stat-card-yellow:hover, 
.stat-card-blue2:hover,
.stat-card-green:hover, 
.stat-card-purple:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    font-size: 24px;
}

.stat-info {
    flex: 1;
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: #666;
}

/* ==================== نوار ابزار مدیریت ==================== */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 16px;
}

.search-box-admin {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 10px 15px;
}

.search-box-admin i {
    color: #999;
    margin-left: 10px;
}

.search-box-admin input {
    border: none;
    flex: 1;
    background: transparent;
    padding: 0;
}

.filter-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-chip {
    padding: 6px 14px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 30px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.filter-chip i {
    margin-left: 5px;
}

.filter-chip.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
}

.btn-excel {
    background: #4caf50;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.btn-excel:hover {
    background: #45a049;
    transform: translateY(-2px);
}

.btn-info {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-info:hover {
    background: #138496;
    transform: translateY(-2px);
}

.btn-warning {
    background: #ff9800;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-warning:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

/* ==================== جدول درخواست‌ها ==================== */
.requests-table-container {
    background: white;
    border-radius: 20px;
    overflow-x: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.requests-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 950px;
}

.requests-table thead tr {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.requests-table th {
    padding: 12px;
    text-align: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
}

.requests-table th i {
    margin-right: 5px;
}

.requests-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.requests-table tbody tr:hover {
    background: #f8f9fa;
}

/* ==================== وضعیت و نشانگرها ==================== */
.status-badge-sm {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
}

.status-pending { background: #ffa502; color: white; }
.status-repairing { background: #1e90ff; color: white; }
.status-done { background: #2ed573; color: white; }

.paid-badge {
    background: #4caf50;
    color: white;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
}

.unpaid-badge {
    background: #ff9800;
    color: white;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
}

.no-invoice-badge {
    background: #ffebee;
    color: #f44336;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 11px;
}

.invoice-badge {
    background: #e8f5e9;
    color: #4caf50;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    display: inline-block;
}

.btn-view, .btn-edit {
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    margin: 0 3px;
    transition: all 0.2s;
}

.btn-view { background: #2196f3; color: white; }
.btn-view:hover { background: #1976d2; }
.btn-edit { background: #ff9800; color: white; }
.btn-edit:hover { background: #f57c00; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

.close-panel-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
}

.close-panel-btn:hover { color: #f44336; }

/* ==================== تاریخچه تعمیرات ==================== */
.repair-history-item {
    background: white;
    padding: 12px;
    margin: 10px 0;
    border-radius: 12px;
    border-right: 3px solid #2ed573;
}

.repair-date {
    color: #2c3e50;
    font-weight: bold;
    margin-bottom: 8px;
}

.parts-list {
    margin: 10px 0;
    padding: 12px;
    background: #e8f4f8;
    border-radius: 12px;
}

.part-tag {
    display: inline-block;
    background: #2ed573;
    color: white;
    padding: 4px 12px;
    margin: 4px;
    border-radius: 20px;
    font-size: 12px;
}

.invoice-box {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 12px;
    margin-top: 15px;
}

.history-card {
    background: white;
    border-radius: 15px;
    padding: 18px;
    margin-top: 15px;
    border-right: 4px solid #3498db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box input { flex: 2; }

/* ==================== نمودارها ==================== */
.charts-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
}

.chart-card {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.chart-card h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: #2c3e50;
}

.chart-card canvas {
    max-height: 200px;
    width: 100%;
}

.chart-error {
    color: #e74c3c;
    padding: 20px;
    text-align: center;
}

/* ==================== آمار حافظه ==================== */
.storage-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.storage-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    flex: 1;
    min-width: 200px;
}

.storage-item span:first-child {
    font-weight: bold;
    color: #2c3e50;
}

.storage-item span:last-child {
    font-family: monospace;
    color: #3498db;
}

/* ==================== دکمه‌های بایگانی ==================== */
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ==================== راهنما ==================== */
.help-icon {
    color: #3498db;
    font-size: 14px;
    cursor: help;
    margin-right: 5px;
    transition: all 0.2s;
}

.help-icon:hover {
    color: #1e3c72;
    transform: scale(1.1);
}

/* ==================== سوئیچ تنظیمات ==================== */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-left: 10px;
    vertical-align: middle;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4caf50;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* ==================== پنل نوتیفیکیشن ==================== */
.notification-panel {
    position: fixed;
    top: 0;
    left: -380px;
    width: 380px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 30px rgba(0,0,0,0.2);
    transition: left 0.3s ease;
    z-index: 1000;
    border-radius: 0 20px 20px 0;
}

.notification-panel.open { left: 0; }

.notification-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-list {
    padding: 15px;
    max-height: calc(100% - 70px);
    overflow-y: auto;
}

.notification-item {
    background: #f8f9fa;
    padding: 14px;
    margin-bottom: 10px;
    border-radius: 12px;
    border-right: 3px solid #3498db;
    cursor: pointer;
}

.notification-item.unread { background: #fff3e0; }

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: red;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 10px;
}

.notifications-area {
    position: relative;
    cursor: pointer;
}

/* ==================== مودال با قابلیت اسکرول ==================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 25px;
    border-radius: 25px;
    width: 90%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover { color: #3498db; }

#imagePreview img {
    max-width: 100%;
    margin-top: 12px;
    border-radius: 12px;
}

/* ==================== دکمه بایگانی در جدول ==================== */
.btn-archive {
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    margin: 0 3px;
    transition: all 0.2s;
}

.btn-archive:hover {
    background: #f57c00;
    transform: translateY(-2px);
}

/* ==================== پاسخگو ==================== */
@media (max-width: 768px) {
    body { padding: 10px; }
    .form-row { flex-direction: column; gap: 0; }
    .logo-section { flex-direction: column; text-align: center; }
    .logo-text-section { text-align: center; }
    .company-slogan { border-right: none; border-top: 2px solid #3498db; padding-top: 8px; margin-top: 8px; }
    .owner-info { flex-direction: column; align-items: center; gap: 8px; }
    .main-tabs { flex-direction: column; }
    .main-tab-btn { border-radius: 12px; }
    .stats-grid { flex-wrap: wrap; }
    .stat-card-blue, .stat-card-yellow, .stat-card-blue2, .stat-card-green, .stat-card-purple { min-width: calc(50% - 15px); flex: 0 1 calc(50% - 15px); padding: 12px; }
    .stat-number { font-size: 20px; }
    .admin-toolbar { flex-direction: column; }
    .search-box { flex-direction: column; }
    .btn-search { width: 100%; }
    .filter-chips { flex-wrap: wrap; }
    .requests-table th { font-size: 10px; padding: 8px; }
    .admin-subtabs { flex-direction: column; }
    .admin-subtab-btn { border-radius: 10px; text-align: center; }
    .charts-row { flex-direction: column; }
    .chart-card { min-width: auto; }
    .storage-stats { flex-direction: column; }
    .storage-item { min-width: auto; }
    .notification-panel { width: 100%; left: -100%; }
    .modal-content { width: 95%; margin: 10% auto; }
}

/* ==================== اسکرول بار ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3498db;
}