/**
 * استایل پنل مدیریت شهریه برای حسابداران (فرانت‌اند)
 * طراحی فلت، مدرن، واکنش‌گرا
 * 
 * @package School_Fees_Manager
 * @version 1.0
 */

/* ============================================
   ریست و تنظیمات پایه
   ============================================ */
:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #eff6ff;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --gray: #64748b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
}

.sfm-accountant-panel {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Tahoma, sans-serif;
    direction: rtl;
    background: var(--light);
    min-height: 100vh;
    color: var(--dark);
}

/* ============================================
   هدر پنل
   ============================================ */
.sfm-accountant-panel .panel-header {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.sfm-accountant-panel .panel-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.sfm-accountant-panel .user-info {
    font-size: 0.875rem;
    color: var(--gray);
}

.sfm-accountant-panel .user-info a {
    color: var(--primary);
    text-decoration: none;
}

.sfm-accountant-panel .user-info a:hover {
    text-decoration: underline;
}

/* ============================================
   تب‌ها
   ============================================ */
.sfm-accountant-panel .panel-tabs {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    position: sticky;
    top: 73px;
    z-index: 99;
}

.sfm-accountant-panel .tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: all 0.2s;
}

.sfm-accountant-panel .tab-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.sfm-accountant-panel .tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    background: var(--primary-light);
}

/* ============================================
   محتوای تب‌ها
   ============================================ */
.sfm-accountant-panel .tab-contents {
    padding: 2rem;
}

.sfm-accountant-panel .tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--gray);
}

/* ============================================
   کارت‌ها و گرید آمار (داشبورد)
   ============================================ */
.sfm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.sfm-stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.sfm-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray);
    margin-top: 0.5rem;
}

/* ============================================
   جدول‌ها
   ============================================ */
.sfm-table-container {
    overflow-x: auto;
    margin: 1rem 0;
}

.sfm-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.sfm-table th,
.sfm-table td {
    padding: 0.75rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.sfm-table th {
    background: var(--light);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--dark);
}

.sfm-table tr:hover td {
    background: var(--primary-light);
}

/* ============================================
   بادج وضعیت
   ============================================ */
.sfm-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fed7aa;
    color: #9a3412;
}

.badge-secondary {
    background: #e2e8f0;
    color: #334155;
}

/* ============================================
   فرم‌ها
   ============================================ */
.sfm-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.sfm-card h2,
.sfm-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.sfm-form-row {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.sfm-form-row label {
    width: 150px;
    font-weight: 500;
    color: var(--dark);
}

.sfm-form-row input,
.sfm-form-row select,
.sfm-form-row textarea {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border 0.2s;
}

.sfm-form-row input:focus,
.sfm-form-row select:focus,
.sfm-form-row textarea:focus {
    outline: none;
    border-color: var(--primary);
    ring: 2px solid var(--primary-light);
}

/* ============================================
   دکمه‌ها
   ============================================ */
.sfm-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.sfm-btn-primary {
    background: var(--primary);
    color: white;
}

.sfm-btn-primary:hover {
    background: var(--primary-dark);
}

.sfm-btn-secondary {
    background: white;
    border-color: var(--border);
    color: var(--dark);
}

.sfm-btn-secondary:hover {
    background: var(--light);
}

.sfm-btn-danger {
    background: var(--danger);
    color: white;
}

.sfm-btn-danger:hover {
    background: #dc2626;
}

.sfm-btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* ============================================
   مودال
   ============================================ */
.sfm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.sfm-modal-content {
    background: white;
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
}

.sfm-modal-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
}

.sfm-modal-close:hover {
    color: var(--dark);
}

/* ============================================
   پیام‌ها
   ============================================ */
.sfm-notice {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.sfm-notice-success {
    background: #d1fae5;
    color: #065f46;
    border-right: 4px solid #10b981;
}

.sfm-notice-error {
    background: #fee2e2;
    color: #991b1b;
    border-right: 4px solid #ef4444;
}

.sfm-notice-warning {
    background: #fed7aa;
    color: #9a3412;
    border-right: 4px solid #f59e0b;
}

/* ============================================
   ابزارک‌ها
   ============================================ */
.sfm-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* واکنش‌گرایی */
@media (max-width: 768px) {
    .sfm-accountant-panel .panel-header,
    .sfm-accountant-panel .panel-tabs,
    .sfm-accountant-panel .tab-contents {
        padding: 1rem;
    }
    .sfm-form-row label {
        width: 100%;
        margin-bottom: 0.25rem;
    }
    .sfm-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}