/* ==========================================
   1. CSS VARIABLES (Theme Colors & Settings)
   ========================================== */
:root {
    --dv-dark-blue: #2B358F;
    --dv-teal: #00A896;
    --dv-gradient: linear-gradient(135deg, #2B358F 0%, #00A896 100%);
    --bg-color: #F3F4F6;
    --card-bg: #FFFFFF;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #E5E7EB;
}

/* ==========================================
   2. RESET & BASE STYLES
   ========================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    display: flex;
    min-height: 100vh;
    color: var(--text-main);
}

/* ==========================================
   3. SIDEBAR NAVIGATION
   ========================================== */
.sidebar {
    width: 250px;
    background: white;
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.logo {
    width: 100%;
    max-width: 180px;
    margin-bottom: 40px;
    align-self: center;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.3s;
}

.nav-links li i {
    margin-right: 10px;
}

.nav-links li:hover, 
.nav-links li.active {
    background: var(--dv-gradient);
    color: white;
}

/* ==========================================
   4. MAIN CONTENT & HEADER
   ========================================== */
.main-content {
    flex: 1;
    padding: 30px 40px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

header h1 {
    color: var(--dv-dark-blue);
    font-size: 24px;
}

/* User Profile & Dropdown Menu */
.user-profile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 8px 18px;
    border-radius: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    transition: background 0.3s;
}

.user-profile:hover {
    background: #f8fcfb;
}

.avatar-icon {
    font-size: 32px;
    color: var(--dv-teal);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.greeting {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--dv-dark-blue);
}

.profile-menu {
    position: absolute;
    top: 115%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 240px;
    z-index: 1000;
    cursor: default;
}

.profile-menu-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column; /* التأكد من أن العناصر تحت بعضها */
    gap: 5px; /* مسافة بين الاسم والإيميل */
}

.menu-name {
    font-weight: bold;
    color: var(--dv-dark-blue);
    font-size: 14px;
    display: block; /* إجبار الاسم على أخذ سطر كامل */
}

.menu-email {
    font-size: 12px;
    color: var(--text-muted);
    word-break: break-all;
    display: block; /* إجبار الإيميل على أخذ سطر جديد */
    line-height: 1.4;
}

.profile-menu-body {
    padding: 10px;
}

.btn-logout {
    width: 100%;
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #fca5a5;
    color: #991b1b;
}

/* ==========================================
   5. CARDS & FORMS
   ========================================== */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

h2 {
    color: var(--dv-dark-blue);
    font-size: 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dv-dark-blue);
}

/* Smart Search Chips & Dropdown */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    cursor: text;
}

.chips-container:focus-within {
    border-color: var(--dv-teal);
    box-shadow: 0 0 0 3px rgba(0, 168, 150, 0.1);
}

.chips-container input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 200px;
    padding: 4px;
    box-shadow: none;
}

.chip {
    display: flex;
    align-items: center;
    background-color: #e0f2f1;
    color: var(--dv-dark-blue);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.chip i { 
    margin-right: 6px; 
    color: var(--dv-teal); 
}

.chip-close {
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    color: #999;
}

.chip-close:hover { 
    color: red; 
}

.dropdown-content {
    position: absolute;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    width: calc(100% - 80px);
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.1);
    z-index: 10;
    margin-top: 5px;
}

.dropdown-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
}

.dropdown-item:hover { 
    background-color: #f8fcfb; 
}

.dropdown-item-name { 
    font-weight: bold; 
    color: var(--dv-dark-blue); 
    display: block; 
}

.dropdown-item-email { 
    font-size: 12px; 
    color: var(--text-muted); 
}

/* File Upload Box - Reduced Size */
.file-upload-box {
    border: 2px dashed var(--dv-teal);
    border-radius: 8px;
    padding: 15px 20px;
    text-align: center;
    background-color: #f8fcfb;
    position: relative;
    cursor: pointer;
}

.file-upload-box i {
    font-size: 22px;
    color: var(--dv-teal);
    margin-bottom: 5px;
}

.uploaded-files-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fcfb;
    border: 1px solid var(--dv-teal);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--dv-dark-blue);
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-item-remove {
    color: #ef4444;
    cursor: pointer;
    font-size: 14px;
    transition: color 0.2s;
}

.file-item-remove:hover {
    color: #b91c1c;
}

/* ==========================================
   6. BUTTONS
   ========================================== */
.btn-primary {
    background: var(--dv-gradient);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    width: 100%;
    transition: opacity 0.3s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* ==========================================
   7. TABLES & UNIFORM ALIGNED COLUMNS
   ========================================== */
.requests-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Ensures strict alignment matching between both tables */
}

.requests-table th, .requests-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    /* إزالة word-break: break-word لمنع تكدس النصوص الطويلة */
}

/* Strict Column Width Proportions */
.requests-table th:nth-child(1), .requests-table td:nth-child(1) { width: 20%; }
.requests-table th:nth-child(2), .requests-table td:nth-child(2) { 
    width: 40%; /* إعطاء مساحة أكبر لاسم الملف */
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; /* إضافة النقاط الثلاث للملفات الطويلة */
}
.requests-table th:nth-child(3), .requests-table td:nth-child(3) { width: 15%; }
.requests-table th:nth-child(4), .requests-table td:nth-child(4) { width: 15%; }
.requests-table th:nth-child(5), .requests-table td:nth-child(5) { 
    width: 10%; 
    text-align: center; 
}

.status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    display: inline-block;
}

.status.pending { background: #e0f0ff; color: #0056b3; }
.status.signed { background: #d4edda; color: #155724; }
.status.declined { background: #fee2e2; color: #b91c1c; }
.status.cancelled { background: #fde8e8; color: #991b1b; }

/* تحسين زر التفاصيل لمنع انقسامه */
.btn-view {
    background: none;
    border: 1px solid var(--dv-teal);
    color: var(--dv-teal);
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap; /* يمنع انقسام الكلمة على سطرين */
    font-size: 13px;
}

.btn-view:hover {
    background: var(--dv-teal);
    color: white;
}

/* ==========================================
   8. MODALS & REORDER LIST
   ========================================== */
.modal {
    display: none; 
    position: fixed; 
    z-index: 100; 
    left: 0; top: 0; width: 100%; height: 100%; 
    background-color: rgba(0,0,0,0.5); 
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    width: 45%;
    min-width: 500px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.detail-box {
    background: #f8fcfb;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.detail-box h3 {
    font-size: 14px;
    color: var(--dv-teal);
    margin-bottom: 12px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 8px;
}

.document-info-box {
    background: #fff;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--dv-dark-blue);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.reorder-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reorder-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

.reorder-controls button {
    background: none;
    border: none;
    color: var(--dv-teal);
    cursor: pointer;
    padding: 5px;
    font-size: 15px;
    transition: color 0.2s;
}

.reorder-controls button:hover {
    color: var(--dv-dark-blue);
}

.reorder-controls button:disabled {
    color: #d1d5db;
    cursor: not-allowed;
}

/* Sign In Button Style */
.btn-signin {
    width: 100%;
    background: #e0f2f1;
    color: var(--dv-teal);
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-signin:hover {
    background: var(--dv-teal);
    color: white;
}

/* Disabled state for Primary Button */
.btn-primary:disabled {
    background: #cbd5e1; /* لون رمادي باهت */
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.7;
    box-shadow: none;
}
