/* admin/style.css - (v15.0 - النسخة النهائية: تذكرة النسر V2 + إصلاحات الإشعارات والنظام) */

/* 1. الخطوط المحلية */
@font-face {
    font-family: 'Tajawal';
    src: url('fonts/Tajawal-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Tajawal';
    src: url('fonts/Tajawal-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --neon-blue: #38bdf8;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: #111827; /* gray-900 */
    color: #e5e7eb; /* gray-200 */
    overflow-x: hidden;
    padding-bottom: 80px; /* مساحة إضافية في الأسفل عشان شريط الحالة */
}

/* 2. تحسين شريط التمرير (Scrollbar) */
::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #1f2937;
}

::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 3. تنسيقات عامة (زجاج، مودال، تنقل) */

.glass-panel {
    background: rgba(31, 41, 55, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(75, 85, 99, 0.4);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.glass-panel:hover {
    background: rgba(31, 41, 55, 0.9);
    border-color: rgba(75, 85, 99, 0.6);
}

.glass-dropdown {
    background: rgba(31, 41, 55, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(75, 85, 99, 0.4);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    transform-origin: top left;
    transition: all 0.2s ease-out;
    z-index: 50;
}

.nav-button {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    color: #9ca3af;
    text-decoration: none;
    display: inline-block;
}

.nav-button:hover {
    background-color: #374151;
    color: #e5e7eb;
}

.nav-button.active {
    color: #14b8a6;
    border-bottom-color: #14b8a6;
    font-weight: 700;
    background-color: rgba(20, 184, 166, 0.1);
}

/* المودال (النافذة المنبثقة) */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    transform: scale(0.9);
    transition: transform 0.3s ease;
    background-color: #1f2937;
    border: 1px solid #374151;
    color: #f3f4f6;
}

.modal-backdrop.visible .modal-content {
    transform: scale(1);
}

/* --- شريط الحالة (متصل) --- */
.status-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    top: auto;
    width: fit-content;
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

/* --- زر الجرس (للسماح بظهور الشارة) --- */
#notification-btn {
    position: relative;       /* ضروري لتحديد مكان الشارة بالنسبة له */
    overflow: visible !important; /* السماح للشارة بالخروج عن حدود الزر */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;              /* تكبير مساحة الزر قليلاً */
    height: 45px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

/* --- تحسين لمبة الإشعارات (الجرس) --- */
#notification-badge {
    position: absolute;
    top: -3px;               /* رفعها للأعلى قليلاً لتخرج من الزر */
    right: -3px;             /* إزاحتها لليمين لتبرز */
    min-width: 20px;         /* تكبير حجم الشارة لتسع الرقم */
    height: 20px;
    padding: 0 4px;
    background-color: #ef4444; /* أحمر فاقع */
    color: white;
    font-size: 11px;         /* تكبير الخط قليلاً للقراءة */
    font-weight: 800;
    line-height: 18px;       /* لضمان توسيط الرقم عمودياً */
    border-radius: 99px;     /* شكل كبسولة */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #1f2937; /* حدود بلون الخلفية لفصلها بصرياً */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 50;             /* ضمان ظهورها فوق كل شيء */
    animation: bounce-badge 1s infinite;
}

@keyframes bounce-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

input, select, textarea {
    background-color: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

/* ============================================================
   4. تنسيقات لوحة التحكم (تم التحديث: تذكرة النسر V2) 🦅
   ============================================================ */

.trip-ticket {
    background: rgba(30, 41, 59, 0.6); /* خلفية زجاجية غامقة */
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    position: relative;
    overflow: hidden; /* لقص الشريط الجانبي */
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column; /* الترتيب: محتوى فوق، أزرار تحت */
    margin-bottom: 1.5rem;
}

.trip-ticket:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
}

/* أ) الشريط الجانبي الملون (Family Strip) */
.family-strip {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    z-index: 10;
    box-shadow: -2px 0 10px currentColor; /* توهج بنفس لون العائلة */
}

/* ب) منطقة المحتوى العلوية */
.ticket-content {
    padding: 1.25rem;
    padding-right: 1.5rem; /* مساحة للشريط */
    flex-grow: 1;
}

/* ج) شريط الأزرار السفلي (Action Bar) */
.ticket-actions {
    background: rgba(17, 24, 39, 0.9); /* خلفية داكنة للأزرار */
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: space-between;
}

/* د) تحسينات الجوال (Grid Layout للأزرار) */
@media (max-width: 640px) {
    .ticket-actions {
        display: grid; 
        grid-template-columns: 1fr 1fr; /* عمودين للجوال */
        gap: 0.5rem;
    }
    
    /* جعل أزرار التحكم تأخذ الصف الأخير كاملاً */
    .ticket-actions .admin-tools {
        grid-column: span 2;
        display: flex;
        justify-content: space-between;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    
    /* جعل زر العمليات الصغيرة يأخذ مكانه */
    .action-btn-small {
        grid-column: span 1;
    }
}

/* هـ) العناصر الجمالية الجديدة */
.icon-3d {
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.4));
    display: inline-block;
    transition: transform 0.2s;
}
button:hover .icon-3d { transform: scale(1.2); }

.price-tag-large {
    font-size: 1.5rem; /* رقم كبير وواضح */
    font-weight: 900;
    line-height: 1;
}

.trip-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid transparent;
}

/* و) الأزرار القديمة (للتوافق إذا وجدت) */
.status-btn {
    font-size: 10px; font-weight: 800; padding: 4px 2px; border-radius: 6px;
    width: 100%; text-align: center; margin-bottom: 4px; border: 1px solid transparent;
    transition: all 0.2s; display: block;
}
.st-done { background-color: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
.st-pending { background-color: rgba(239, 68, 68, 0.15); color: #f87171; border-color: rgba(239, 68, 68, 0.3); }

/* ز) زر العمليات الصغيرة (للتوافق) */
.action-btn-small { white-space: nowrap; }

/* 5. تنسيقات صفحة السائقين والمركبات */

.driver-card-v2 {
    background-color: #1f2937;
    border: 1px solid #374151;
    border-radius: 16px;
    padding: 16px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.driver-card-v2:hover {
    transform: translateY(-3px);
    border-color: #4b5563;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.driver-avatar {
    background: linear-gradient(135deg, #374151, #111827);
    border: 2px solid #4b5563;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.call-btn {
    background-color: rgba(55, 65, 81, 0.5);
    color: #f87171;
    border-radius: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.call-btn:hover {
    background-color: #ef4444;
    color: white;
}

.vehicle-plate-yellow {
    background-color: #f3f4f6;
    border: 2px solid #000;
    border-radius: 8px;
    display: flex;
    height: 80px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}

.vehicle-plate-yellow:hover {
    transform: scale(1.02);
}

.plate-strip {
    width: 40px;
    background-color: #fbbf24;
    border-left: 2px solid #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: black;
    font-weight: 900;
    font-family: sans-serif;
    line-height: 1.1;
}

.expiry-warning {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 1px #ef4444 !important;
}

.expiry-badge {
    position: absolute;
    top: -1px;
    left: -1px;
    background-color: #ef4444;
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-bottom-right-radius: 8px;
    border-top-left-radius: 16px;
    font-weight: bold;
    z-index: 10;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.bg-yellow-600.expiry-badge {
    background-color: #ca8a04;
}

/* 6. التنبيهات (Toasts) */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 90%;
    max-width: 400px;
    pointer-events: none;
}

.toast-message {
    background: rgba(31, 41, 55, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease-out forwards;
    pointer-events: auto;
}

.toast-message.hiding {
    animation: fadeOut 0.3s ease-in forwards;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-10px); }
}

.toast-success { border-color: #059669; border-right-width: 4px; }
.toast-error { border-color: #dc2626; border-right-width: 4px; }
.toast-info { border-color: #2563eb; border-right-width: 4px; }
.toast-warning { border-color: #ca8a04; border-right-width: 4px; }

/* 7. تنسيقات خاصة بطباعة العقد */
.company-name-ar { font-size: 20px; font-weight: bold; }
.company-name-en { font-size: 13px; font-weight: bold; }

@media print {
    .no-print, #status-indicator, #controls-toolbar, header {
        display: none !important;
    }
    body {
        background-color: white;
        color: black;
    }
    .a4-page {
        margin: 0 !important;
        box-shadow: none !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
}

.hidden { display: none !important; }