:root {
    --primary: #667eea; --success: #48bb78; --error: #f56565; --warning: #ed8936;
    --info: #3182ce; --border: #e2e8f0; --bg: #f7fafc; --dark: #2d3748;
}

* { box-sizing: border-box; }

body {
    font-family: 'Vazir', 'Segoe UI', Tahoma, Arial, sans-serif;
    margin: 0; padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container { max-width: 1600px; margin: 0 auto; }

.card {
    background: white; border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    padding: 30px; margin-bottom: 30px;
    position: relative;
}

h1, h2, h3, h4 { 
    color: #333; margin-bottom: 20px; 
    font-weight: 700;
}

h4 {
    font-size: 18px;
    margin-top: 25px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    color: var(--primary);
}

.alert {
    padding: 15px 20px; border-radius: 10px;
    margin-bottom: 25px; font-weight: 500;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.alert-success { 
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%); 
    color: #155724; 
    border: 1px solid #c3e6cb; 
}

.alert-error { 
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%); 
    color: #721c24; 
    border: 1px solid #f5c6cb; 
}

/* تب‌ها */
.tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 3px solid var(--border);
}

.tab-btn {
    padding: 14px 28px;
    background: none;
    border: none;
    font-size: 18px;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* داشبورد دو بخشی */
.dashboard-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
}

.dashboard-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-section h3::before {
    content: '📊';
    font-size: 24px;
}

.dashboard-section.general h3::before { content: '🌍'; }
.dashboard-section.specific h3::before { content: '🎯'; }

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    margin: 10px 0;
    display: block;
}

.stat-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.info .stat-value { color: var(--info); }
.stat-card.error .stat-value { color: var(--error); }

/* جدول */
.table-container { 
    overflow-x: auto; 
    margin-top: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

table {
    width: 100%; 
    border-collapse: collapse;
    min-width: 1200px;
}

th, td {
    padding: 14px 12px; 
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; 
    font-weight: 600;
    position: sticky; 
    top: 0;
    z-index: 10;
}

tr:hover { 
    background: var(--bg); 
}

.btn {
    padding: 9px 18px; 
    border: none; 
    border-radius: 8px;
    font-size: 14px; 
    font-weight: 600; 
    cursor: pointer;
    transition: all 0.3s; 
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn:hover { 
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary { 
    background: linear-gradient(135deg, var(--primary) 0%, #5568d3 100%); 
    color: white; 
}

.btn-success { 
    background: linear-gradient(135deg, var(--success) 0%, #38a169 100%); 
    color: white; 
}

.btn-warning { 
    background: linear-gradient(135deg, var(--warning) 0%, #dd6b20 100%); 
    color: #333; 
}

.btn-danger { 
    background: linear-gradient(135deg, var(--error) 0%, #e53e3e 100%); 
    color: white; 
}

.btn-info {
    background: linear-gradient(135deg, var(--info) 0%, #2b6cb0 100%);
    color: white;
}

.btn-back { 
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%); 
    color: white; 
}

.btn-sm { 
    padding: 7px 14px; 
    font-size: 13px; 
}

.btn-export {
    background: linear-gradient(135deg, #9b2c2c 0%, #742a2a 100%);
    color: white;
    margin-right: 15px;
}

.btn-export:disabled {
    background: #cbd5e0;
    color: #718096;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.badge {
    display: inline-block; 
    padding: 5px 10px;
    border-radius: 20px; 
    font-size: 13px; 
    font-weight: 600;
    min-width: 70px;
}

.badge-success { 
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%); 
    color: #155724; 
}

.badge-danger { 
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%); 
    color: #721c24; 
}

.badge-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

.badge-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
}

.filter-section {
    background: white; 
    padding: 25px;
    border-radius: 12px; 
    margin-bottom: 25px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
}

.filter-row {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px; 
}

select, input {
    width: 100%; 
    padding: 12px;
    border: 2px solid var(--border); 
    border-radius: 8px;
    font-size: 15px;
    background: white;
    transition: all 0.3s;
}

select:focus, input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

select:disabled {
    background: #f8f9fa;
    color: #999;
    cursor: not-allowed;
}

.empty-state {
    text-align: center; 
    padding: 70px 20px;
    color: #999; 
    background: white;
    border-radius: 16px; 
    margin-top: 20px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.05);
}

.empty-state-icon { 
    font-size: 72px; 
    margin-bottom: 25px;
    opacity: 0.7;
}

.empty-state h3 {
    font-size: 28px; 
    margin-bottom: 15px; 
    color: #666;
    font-weight: 600;
}

.empty-state p { 
    font-size: 18px; 
    color: #718096;
    max-width: 600px;
    margin: 0 auto;
}

/* سبک‌های سلسله‌مراتبی */
.hierarchy-col { font-weight: 600; }
.cluster-col { background-color: #e3f2fd; color: #1565c0; }
.field-col { background-color: #e8f5e9; color: #2e7d32; }

/* دکمه بازگشت و اکسل */
.action-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 25px 0;
    flex-wrap: wrap;
    gap: 15px;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn-export {
        margin-right: 0;
        width: 100%;
    }
}

/* استایل RTL برای SweetAlert2 */
.swal2-rtl {
    direction: rtl;
    text-align: right;
    font-family: 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.swal2-title-rtl {
    font-weight: 700;
    font-size: 20px;
}

.swal2-confirm-rtl {
    font-family: 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
}

.swal2-cancel-rtl {
    font-family: 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 8px;
}

.swal2-popup.swal2-toast {
    direction: rtl;
}

/* استایل تب تاریخچه */
.tab-btn[data-tab="history"]::before {
    content: '📜 ';
}

/* ستون وضعیت نسخه */
.version-status-archived {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #c62828;
}

.version-status-active {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
}
