﻿/* ==========================================
   نظام إدارة البلاغات - ملف CSS الرئيسي
   ========================================== */

:root {
    --primary: #2c3e50;
    --secondary: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #17a2b8;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --purple: #9b59b6;
    --green: #2ecc71;
    --orange: #e67e22;
    --gray: #95a5a6;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', 'Segoe UI', sans-serif;
}

body {
    background: #f8f9fa;
    color: var(--dark);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== الهيدر ===== */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--dark) 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 28px;
    color: var(--warning);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: var(--warning);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

/* ===== القائمة الرئيسية ===== */
.admin-nav {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    position: sticky;
    top: 80px;
    z-index: 99;
}

.admin-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-link {
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--dark);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-link:hover, .admin-link.active {
    background: var(--warning);
    color: white;
}

/* ===== الحاوية الرئيسية ===== */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== الأقسام ===== */
.section {
    background: white;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.section-title {
    color: var(--primary);
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== بطاقات الإحصائيات ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s;
    border: 1px solid #e9ecef;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--dark);
}

.stat-label {
    font-size: 14px;
    color: #666;
}

/* ===== الجداول ===== */
.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th {
    background: var(--light);
    color: var(--dark);
    font-weight: 600;
    padding: 15px;
    text-align: right;
    border-bottom: 2px solid #ddd;
}

td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-align: right;
}

tr:hover {
    background: #f8f9fa;
}

/* ===== الأزرار ===== */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    text-decoration: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--dark); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #219653; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #e67e22; }

.btn-info { background: var(--info); color: white; }
.btn-info:hover { background: #138496; }

.btn-purple { background: var(--purple); color: white; }
.btn-purple:hover { background: #8e44ad; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== الشارات ===== */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.badge-active { background: #d4edda; color: #155724; }
.badge-inactive { background: #f8d7da; color: #721c24; }
.badge-new { background: #d1ecf1; color: #0c5460; }
.badge-assigned { background: #cce5ff; color: #004085; }
.badge-in_progress { background: #fff3cd; color: #856404; }
.badge-resolved { background: #d4edda; color: #155724; }
.badge-closed { background: #e2e8f0; color: #4a5568; }
.badge-pending { background: #f8d7da; color: #721c24; }
.badge-available { background: #d4edda; color: #155724; }
.badge-busy { background: #f8d7da; color: #721c24; }
.badge-offline { background: #e2e8f0; color: #4a5568; }
.badge-noemail { background: #e2e8f0; color: #4a5568; }
.badge-paid { background: #d4edda; color: #155724; }
.badge-partial { background: #fff3cd; color: #856404; }

/* ===== شارات الأولوية ===== */
.priority-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}

.priority-urgent { background: #e74c3c; color: white; }
.priority-high { background: #f39c12; color: white; }
.priority-medium { background: #3498db; color: white; }
.priority-low { background: #95a5a6; color: white; }

/* ===== الشارات المالية ===== */
.financial-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    margin: 2px;
}

.financial-cost { background: #e8f5e8; color: #27ae60; border: 1px solid #27ae60; }
.financial-paid { background: #e8f4fd; color: #3498db; border: 1px solid #3498db; }
.financial-remaining { background: #fef7e6; color: #f39c12; border: 1px solid #f39c12; }
.financial-estimated { background: #f5e8fd; color: #9b59b6; border: 1px solid #9b59b6; }

.amount {
    font-family: monospace;
    font-weight: bold;
}

.cost-amount { color: #27ae60; }
.paid-amount { color: #3498db; }
.remaining-amount { color: #f39c12; }
.estimated-amount { color: #9b59b6; }

/* ===== النماذج ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}

.form-control.error {
    border-color: var(--danger);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* ===== التنبيهات ===== */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===== المودالات ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: white;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s;
}

.close-btn:hover {
    color: var(--danger);
}

/* ===== الإجراءات السريعة ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.quick-action-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.quick-action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.quick-action-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 15px;
    color: white;
}

/* ===== البحث ===== */
.search-container {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #dee2e6;
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box input[type="text"] {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.search-box button {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box button:hover {
    background: var(--dark);
}

.search-results-info {
    margin-top: 10px;
    color: #666;
    font-size: 14px;
}

.clear-search-btn {
    background: #e2e8f0;
    color: #666;
    padding: 5px 10px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 12px;
    margin-right: 10px;
}

.clear-search-btn:hover {
    background: #d1d9e6;
}

/* ===== عداد المودال ===== */
.modal-counter {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    margin-right: 10px;
    display: inline-block;
    color: white;
}

.stat-badge {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ===== بطاقات البلاغات ===== */
.complaint-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.complaint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.complaint-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.complaint-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

/* ===== المعلومات المالية ===== */
.financial-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0;
}

.financial-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.financial-label {
    font-size: 11px;
    color: #666;
    margin-bottom: 5px;
}

.financial-value {
    font-size: 14px;
    font-weight: bold;
    font-family: monospace;
}

/* ===== تفاصيل البلاغ ===== */
.complaint-detail-row {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.complaint-detail-label {
    width: 120px;
    font-weight: bold;
    color: var(--dark);
}

.complaint-detail-value {
    flex: 1;
    color: #333;
}

/* ===== الخط الزمني ===== */
.status-timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.timeline-item {
    display: flex;
    gap: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.timeline-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* ===== تحميل ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== تحسينات للهواتف ===== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        padding: 15px 20px;
    }
    
    .logo h1 { font-size: 18px; }
    .logo i { font-size: 22px; }
    
    .admin-nav {
        padding: 10px 15px;
        overflow-x: auto;
    }
    
    .admin-links {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 10px;
    }
    
    .admin-link {
        padding: 8px 12px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .container { padding: 10px; }
    .section { padding: 15px; }
    .section-title { 
        font-size: 16px;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 15px; }
    .stat-icon { width: 50px; height: 50px; font-size: 20px; }
    .stat-number { font-size: 24px; }
    
    .quick-actions { grid-template-columns: 1fr; }
    .quick-action-card { padding: 15px; }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 12px;
    }
    
    th, td { 
        padding: 8px 10px; 
        font-size: 12px; 
    }
    
    .btn { 
        padding: 8px 16px; 
        font-size: 13px; 
        width: 100%;
        justify-content: center;
    }
    
    .btn-sm { 
        padding: 6px 12px; 
        font-size: 12px; 
    }
    
    .action-buttons { 
        flex-direction: column; 
        gap: 5px;
    }
    
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
    }
    
    .modal-header h3 { font-size: 16px; }
    .form-row { grid-template-columns: 1fr; }
    
    .desktop-view { display: none; }
    .mobile-view { display: block; }
    
    .complaint-actions .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .financial-info {
        flex-direction: column;
    }
    
    .financial-item {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .logo h1 { font-size: 16px; }
    .admin-link { padding: 6px 10px; font-size: 12px; }
    .stat-number { font-size: 20px; }
    .badge, .priority-badge, .financial-badge { 
        font-size: 10px; 
        padding: 3px 6px; 
    }
}

/* ===== فئات مساعدة ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.rounded { border-radius: var(--border-radius); }
.shadow { box-shadow: var(--shadow); }