:root {
    --primary-color: #ff3b3f;
    --secondary-color: #a80000;
    --dark-bg: #121212;
    --card-bg: #1e1e1e;
    --input-bg: #2b2b2b;
    --text-color: #f5f5f5;
    --border-color: #444;
    --success-color: #1e4d2b;
    --error-color: #630000;
    --whatsapp-color: #25D366;
    --blue-color: #2196F3;
    --orange-color: #FF9800;
    --green-color: #4CAF50;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, sans-serif;
    background: var(--dark-bg);
    color: var(--text-color);
    direction: rtl;
    line-height: 1.6;
    padding: 20px;
}

h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-align: center;
}

/* ========== التصميم العام ========== */
.form-container {
    max-width: 100%;
    margin: 2rem auto;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

/* ========== مربع البحث ========== */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
}

.search-box button {
    padding: 10px 20px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.search-box button:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* ========== جدول الطلبات ========== */
.table-container {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    margin: 20px 0;
    overflow: hidden;
}

.table-header {
    padding: 15px 20px;
    background: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.table-stats {
    font-size: 14px;
    color: #aaa;
}

.requests-table {
    width: 100%;
    border-collapse: collapse;
}

.requests-table th {
    background: #2b2b2b;
    color: var(--primary-color);
    padding: 12px 15px;
    text-align: right;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--border-color);
}

.requests-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.requests-table tr:hover td {
    background: #3a3a3a;
}

.requests-table tr:last-child td {
    border-bottom: none;
}

.client-name {
    font-weight: 500;
    margin-bottom: 3px;
}

.client-nid {
    color: #aaa;
    font-size: 12px;
}

.actions-cell {
    display: flex;
    gap: 5px;
    justify-content: center;
}

/* ========== أنماط الحالة ========== */
.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    min-width: 100px;
}

.status-new { background: #3498db20; color: #3498db; }
.status-processing { background: #f39c1220; color: #f39c12; }
.status-completed { background: #2ecc7120; color: #2ecc71; }
.status-cancelled { background: #e74c3c20; color: #e74c3c; }
.status-approved { background: #9b59b620; color: #9b59b6; }
.status-pending { background: #f1c40f20; color: #f1c40f; }
.status-rejected { background: #e74c3c20; color: #e74c3c; }
.status-changed { background: #8e44ad20; color: #8e44ad; }

/* ========== التصفح ========== */
.table-footer {
    padding: 15px 20px;
    background: #2b2b2b;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-prev, .btn-next {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-prev:hover, .btn-next:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-prev:disabled, .btn-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
    border-color: var(--border-color);
}

.page-info {
    font-size: 14px;
}

/* ========== الأزرار ========== */
.btn-refresh {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-refresh:hover {
    background: var(--blue-color);
    border-color: var(--blue-color);
}

.btn-edit, .btn-delete, .btn-email, .btn-urgent, .btn-etisalat {
    border: none;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.btn-edit {
    background: var(--green-color);
}

.btn-delete {
    background: var(--secondary-color);
}

.btn-email {
    background: var(--blue-color);
}

.btn-urgent {
    background: var(--orange-color);
}

.btn-etisalat {
    background: var(--whatsapp-color);
}

.btn-edit:hover, .btn-delete:hover, 
.btn-email:hover, .btn-urgent:hover,
.btn-etisalat:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

/* ========== النافذة المنبثقة ========== */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.popup-content {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close-popup {
    position: absolute;
    top: 10px;
    left: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

/* ========== التحميل ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== التنبيهات ========== */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-weight: bold;
}

.alert.success {
    background: #1e4d2b;
    color: white;
}

.alert.error {
    background: #630000;
    color: white;
}

/* ========== التجاوب مع الأجهزة المحمولة ========== */
@media (max-width: 768px) {
    .form-container {
        margin: 1rem 0;
        padding: 1rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .requests-table {
        font-size: 0.8rem;
    }
    
    .requests-table th, .requests-table td {
        padding: 8px 10px;
    }
    
    .actions-cell {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
    
    .btn-edit, .btn-delete, 
    .btn-email, .btn-urgent,
    .btn-etisalat {
        padding: 5px 8px;
        font-size: 12px;
    }
    
    .status-badge {
        min-width: 70px;
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .table-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}
/* أنماط البوب اب المعدلة */
.popup-content {
    max-width: 1000px;
    width: 98%;
    max-height: 97vh;
    overflow-y: auto;
    padding: 20px;
}

.compact-form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #aaa;
    font-size: 14px;
    font-weight: 500;
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 15px;
}

.input-with-icon input,
.input-with-icon select,
.input-with-icon textarea {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border: 1px solid #444;
    border-radius: 5px;
    background-color: #333;
    color: #fff;
    font-size: 14px;
}

.input-with-icon textarea {
    min-height: 70px;
    resize: vertical;
}

.input-with-icon select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #444;
}

/* تعديلات للشاشات المتوسطة */
@media (max-width: 1200px) {
    .compact-form-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .form-group.full-width {
        grid-column: span 3;
    }
}

/* تعديلات للهواتف */
@media (max-width: 768px) {
    .compact-form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-group.full-width {
        grid-column: span 2;
    }
}

@media (max-width: 480px) {
    .compact-form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-group.full-width {
        grid-column: span 1;
    }
    
    .popup-content {
        padding: 15px;
    }
    
    .input-with-icon input,
    .input-with-icon select,
    .input-with-icon textarea {
        padding: 8px 8px 8px 30px;
        font-size: 13px;
    }
}
/* أنماط سجل التاريخ */
.history-container {
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px;
}

.history-item {
    background: #2b2b2b;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border-left: 4px solid #ff3b3f;
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: bold;
    color: #ff3b3f;
}

.history-type {
    background: #ff3b3f;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.history-details {
    margin-top: 10px;
    padding: 10px;
    background: #333;
    border-radius: 5px;
    font-size: 14px;
}

.history-user {
    color: #aaa;
    font-size: 12px;
    margin-top: 5px;
}

.history-time {
    color: #777;
    font-size: 12px;
}

.history-diff {
    margin-top: 10px;
}

.history-diff-item {
    margin-bottom: 5px;
    padding: 5px;
    border-bottom: 1px dashed #444;
}

.history-old {
    color: #e74c3c;
    text-decoration: line-through;
}

.history-new {
    color: #2ecc71;
}

.btn-history {
    background: #8e44ad !important;
}