/*
   نظام إدارة مطالبات الحوادث - تصميم عصري خرافي
   Premium Arabic RTL Design
*/

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #0f172a;
    --secondary-color: #4f46e5;
    --accent-color: #7c3aed;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    --light-color: #f1f5f9;
    --dark-color: #0f172a;
    --sidebar-width: 264px;
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border-color: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

/* ==================== Accessibility ==================== */
/* Skip to main content link — hidden until focused */
.skip-link {
    position: absolute;
    top: -100%;
    right: 0;
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 0 0 8px 0;
    font-size: 14px;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Visible focus ring for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--secondary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #f1f5f9;
    margin: 0;
    padding: 0;
    direction: rtl;
    text-align: right;
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #111827 0%, #0b1120 100%);
    color: white;
    z-index: 1000;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile overlay behind the off-canvas sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
}

/* Hamburger toggle (hidden on desktop) */
.sidebar-toggle {
    display: none;
    background: transparent;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: var(--text-main);
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header small {
    opacity: 0.4;
    font-size: 0.75rem;
}

.sidebar-menu {
    padding: 12px 10px 20px;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    margin: 2px 0;
    color: rgba(255, 255, 255, 0.62);
    text-decoration: none;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;
}

.menu-item.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.menu-item i {
    margin-left: 12px;
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
    opacity: 0.8;
}

.menu-item:hover i,
.menu-item.active i {
    opacity: 1;
}

.menu-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    margin: 12px 10px;
}

.menu-label {
    padding: 14px 14px 6px;
    font-size: 0.68rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1.5px;
    font-weight: 700;
}

/* Main Content */
.main-content {
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    padding: 20px;
}

/* Top Bar */
.top-bar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 14px 28px;
    margin: -20px -20px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.page-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dark-color);
}

.breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.85rem;
    color: #94a3b8;
}

.breadcrumb a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb a:hover {
    opacity: 0.7;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    background: #fafbfc;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(79, 70, 229, 0.3);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: white;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: var(--gradient-primary);
}

.stat-icon.success {
    background: linear-gradient(135deg, #059669, #047857);
}

.stat-icon.warning {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.stat-icon.danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.stat-icon.info {
    background: linear-gradient(135deg, #0891b2, #0e7490);
}

.stat-info h3 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-info p {
    margin: 4px 0 0;
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 18px;
    text-align: right;
    border-bottom: 1px solid #f1f5f9;
}

.table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: inherit;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
}

.btn-success:hover {
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: white;
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid #e2e8f0;
    color: #475569;
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

/* Forms */
.form-group {
    margin-bottom: 22px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.88rem;
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    transition: var(--transition);
    background: #fafbfc;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    background: white;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 15px center;
    padding-left: 35px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-primary {
    background: #eef2ff;
    color: #4f46e5;
}

.badge-secondary {
    background: #f1f5f9;
    color: #475569;
}

.badge-success {
    background: #ecfdf5;
    color: #059669;
}

.badge-warning {
    background: #fffbeb;
    color: #d97706;
}

.badge-danger {
    background: #fef2f2;
    color: #dc2626;
}

.badge-info {
    background: #ecfeff;
    color: #0891b2;
}

.badge-dark {
    background: #1e293b;
    color: white;
}

/* Alerts */
.alert {
    padding: 16px 22px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #ecfeff;
    color: #155e75;
    border: 1px solid #a5f3fc;
}

/* Timeline */
.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #eee;
}

.timeline-item {
    position: relative;
    padding-right: 45px;
    margin-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    right: 10px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--secondary-color);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--secondary-color);
}

.timeline-item .time {
    font-size: 0.8rem;
    color: #999;
}

.timeline-item .content {
    margin-top: 5px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 20px;
}

.pagination a,
.pagination span {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: var(--dark-color);
}

.pagination a:hover {
    background: #f8f9fa;
}

.pagination .active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

/* Workflow Steps */
.workflow-steps {
    display: flex;
    justify-content: space-between;
    margin: 30px 0;
    padding: 0;
    list-style: none;
    position: relative;
}

.workflow-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    right: 0;
    left: 0;
    height: 3px;
    background: #eee;
    z-index: 0;
}

.workflow-step {
    text-align: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.workflow-step .step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: bold;
    color: #999;
}

.workflow-step.active .step-icon {
    background: var(--secondary-color);
    color: white;
}

.workflow-step.completed .step-icon {
    background: var(--success-color);
    color: white;
}

.workflow-step .step-label {
    font-size: 0.8rem;
    color: #666;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 2000;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 2001;
    display: none;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-muted {
    color: #999;
}

.text-success {
    color: var(--success-color);
}

.text-danger {
    color: var(--danger-color);
}

.text-warning {
    color: var(--warning-color);
}

.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-flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

.gap-1 {
    gap: 10px;
}

.gap-2 {
    gap: 20px;
}

.w-100 {
    width: 100%;
}

/* Responsive */
/* ── ≤768px: الشريط الجانبي يصبح درجًا منزلقًا (off-canvas) ── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        box-shadow: none;
        width: min(300px, 85vw);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .main-content {
        margin-right: 0;
        padding: 14px;
    }

    .top-bar {
        margin: -14px -14px 18px;
        padding: 10px 14px;
    }

    .page-title {
        font-size: 1.1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    table {
        font-size: 13px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ── 480px: هواتف صغيرة ── */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .card {
        border-radius: var(--radius-sm);
    }
}

/* ── 768px: هواتف كبيرة ── */
@media (min-width: 481px) and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .workflow-steps {
        flex-direction: column;
        gap: 20px;
    }

    .workflow-steps::before {
        display: none;
    }
}

/* ── 1024px: أجهزة لوحية ── */
@media (min-width: 769px) and (max-width: 1024px) {
    :root { --sidebar-width: 220px; }

    .main-content {
        margin-right: var(--sidebar-width);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── 1440px+: شاشات كبيرة ── */
@media (min-width: 1440px) {
    .main-content {
        max-width: 1600px;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Print Styles */
@media print {

    .sidebar,
    .top-bar,
    .btn,
    .pagination {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================
   تحسينات إضافية - واجهة المستخدم المتقدمة
   ============================================ */

/* نظام الإشعارات */
.notifications-dropdown {
    position: relative;
    display: inline-block;
}

.notifications-bell {
    position: relative;
    cursor: pointer;
    padding: 10px;
    font-size: 1.2rem;
    color: #666;
    transition: color 0.3s;
}

.notifications-bell:hover {
    color: var(--secondary-color);
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.notifications-panel {
    position: absolute;
    top: 100%;
    left: 0;
    width: 350px;
    max-height: 400px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.15);
    z-index: 3000;
    display: none;
    overflow: hidden;
}

.notifications-panel.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notifications-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.notifications-header h4 {
    margin: 0;
    font-size: 0.95rem;
}

.notifications-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.notification-item:hover {
    background: #f8f9fa;
}

.notification-item.unread {
    background: #e3f2fd;
}

.notification-item.unread:hover {
    background: #bbdefb;
}

.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.notification-icon.info {
    background: #e3f2fd;
    color: #1976d2;
}

.notification-icon.success {
    background: #e8f5e9;
    color: #388e3c;
}

.notification-icon.warning {
    background: #fff3e0;
    color: #f57c00;
}

.notification-icon.error {
    background: #ffebee;
    color: #d32f2f;
}

.notification-content {
    flex: 1;
}

.notification-content .title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 3px;
}

.notification-content .message {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 3px;
}

.notification-content .time {
    font-size: 0.7rem;
    color: #999;
}

.notifications-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid #eee;
}

/* الرسوم البيانية */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    padding: 10px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    margin-top: 15px;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.chart-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* بطاقات التقارير */
.report-card {
    background: var(--gradient-primary);
    color: white;
    border-radius: 12px;
    padding: 25px;
    position: relative;
    overflow: hidden;
}

.report-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.report-card.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.report-card.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.report-card.info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.report-card h3 {
    font-size: 2rem;
    margin: 0 0 5px;
}

.report-card p {
    margin: 0;
    opacity: 0.9;
}

.report-card .trend {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 0.85rem;
    padding: 5px 10px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.2);
}

.report-card .trend.up::before {
    content: '↑ ';
}

.report-card .trend.down::before {
    content: '↓ ';
}

/* جدول متقدم */
.table-advanced {
    border-radius: 10px;
    overflow: hidden;
}

.table-advanced th {
    background: var(--primary-color);
    color: white;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.table-advanced tbody tr {
    transition: all 0.3s;
}

.table-advanced tbody tr:hover {
    background: #f0f7ff;
    transform: scale(1.01);
}

.table-advanced .actions {
    display: flex;
    gap: 5px;
}

/* أيقونات الإجراءات */
.action-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

.action-icon:hover {
    transform: scale(1.1);
}

.action-icon.view {
    background: var(--info-color);
}

.action-icon.edit {
    background: var(--warning-color);
}

.action-icon.delete {
    background: var(--danger-color);
}

.action-icon.print {
    background: var(--secondary-color);
}

/* فلاتر البحث */
.search-filters {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

/* شريط التقدم */
.progress-bar {
    height: 10px;
    background: #eee;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.progress-fill.success {
    background: linear-gradient(90deg, #11998e, #38ef7d);
}

.progress-fill.warning {
    background: linear-gradient(90deg, #f093fb, #f5576c);
}

.progress-fill.info {
    background: linear-gradient(90deg, #4facfe, #00f2fe);
}

/* تأثيرات التحميل */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #eee;
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* تبويبات */
.tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
}

.tab {
    padding: 12px 25px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
    color: #666;
}

.tab:hover {
    color: var(--secondary-color);
}

.tab.active {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* بطاقة معلومات */
.info-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-right: 4px solid var(--secondary-color);
}

.info-card.success {
    border-right-color: var(--success-color);
}

.info-card.warning {
    border-right-color: var(--warning-color);
}

.info-card.danger {
    border-right-color: var(--danger-color);
}

/* Toast Messages */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
}

.toast-container > * {
    pointer-events: auto;
}

.toast {
    background: #333;
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

.toast.info {
    background: var(--info-color);
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* بطاقة الملف الشخصي */
.profile-card {
    text-align: center;
    padding: 30px;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    margin: 0 auto 15px;
}

.profile-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.profile-role {
    color: #666;
    font-size: 0.9rem;
}

/* Accordion */
.accordion-item {
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.accordion-header {
    padding: 15px 20px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s;
}

.accordion-header:hover {
    background: #f0f0f0;
}

.accordion-header i {
    transition: transform 0.3s;
}

.accordion-item.open .accordion-header i {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s;
}

.accordion-item.open .accordion-content {
    padding: 20px;
    max-height: 500px;
}

/* تنسيقات الطباعة المتقدمة */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white;
        font-size: 12pt;
    }

    .card {
        page-break-inside: avoid;
        margin-bottom: 15px;
    }

    .table {
        font-size: 10pt;
    }

    .report-card {
        color: black !important;
        background: #f0f0f0 !important;
    }
}

/* ══════════════════════════════════════════════
   مخطط أضرار المركبة التفاعلي
   Interactive Vehicle Damage Diagram
   ══════════════════════════════════════════════ */

.dmg-diagram-wrap {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 12px 12px;
    text-align: center;
    position: relative;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.dmg-diagram-wrap .dmg-svg {
    width: 100%;
    max-width: 620px;
    height: auto;
    margin: 0 auto;
    display: block;
}

/* Zone default style — line-art: white fill, thin outline */
.dmg-zone {
    fill: #ffffff;
    stroke: #9aa8b5;
    stroke-width: 1;
    cursor: pointer;
    transition: fill 0.2s, stroke 0.2s, filter 0.2s;
}

.dmg-zone:hover {
    fill: #e8f5e9;
    stroke: #66bb6a;
    stroke-width: 1.4;
}

/* Glass zones (windshields) default */
.dmg-zone.dmg-glass {
    fill: #f5f9fc;
    stroke: #9aa8b5;
}
.dmg-zone.dmg-glass:hover {
    fill: #e8f5e9;
    stroke: #66bb6a;
}

/* Damaged zone (hit) — GREEN like Krooka */
.dmg-zone.dmg-hit {
    fill: #4caf50;
    stroke: #2e7d32;
    stroke-width: 1.4;
    filter: drop-shadow(0 0 2px rgba(76, 175, 80, 0.3));
    animation: dmg-pulse 2.5s ease-in-out infinite;
}
.dmg-zone.dmg-hit.dmg-glass {
    fill: #66bb6a;
    stroke: #2e7d32;
}

.dmg-zone.dmg-hit:hover {
    fill: #43a047;
    stroke: #1b5e20;
    filter: drop-shadow(0 0 5px rgba(76, 175, 80, 0.5));
}

/* Interactive mode: selected zone */
.dmg-zone.dmg-selected {
    fill: #4caf50;
    stroke: #2e7d32;
    stroke-width: 1.4;
    filter: drop-shadow(0 0 2px rgba(76, 175, 80, 0.3));
}

@keyframes dmg-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 1px rgba(76, 175, 80, 0.2));
    }
    50% {
        filter: drop-shadow(0 0 4px rgba(76, 175, 80, 0.45));
    }
}

/* Zone number labels */
.dmg-num {
    font-size: 11px;
    font-weight: 700;
    fill: #5a6d7e;
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: central;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.dmg-hit+.dmg-num,
.dmg-zone.dmg-hit~text.dmg-num {
    fill: #fff;
}

/* FRONT / REAR labels */
.dmg-side-label {
    font-size: 11px;
    fill: #90a4ae;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    letter-spacing: 2px;
}

/* Summary bar */
.dmg-summary {
    margin-top: 8px;
    font-size: 0.85rem;
}

.dmg-count {
    color: #2e7d32;
    font-weight: 600;
}

.dmg-none {
    color: #43a047;
    font-weight: 500;
}

/* Tooltip */
.dmg-tooltip {
    position: absolute;
    background: rgba(33, 33, 33, 0.92);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transform: translateX(-50%);
    transition: opacity 0.15s;
}

.dmg-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: rgba(33, 33, 33, 0.92) transparent transparent transparent;
}

/* Compact mode */
.dmg-compact .dmg-svg {
    max-width: 380px;
}

.dmg-compact .dmg-num {
    font-size: 8px;
}

.dmg-compact .dmg-side-label {
    font-size: 8px;
}

.dmg-compact .dmg-summary {
    font-size: 0.75rem;
}

/* ============================================================
   تحسينات v2.0 — Premium UX Components
   أضيفت لتوحيد المظهر وتقليل inline styles عبر القوالب
   ============================================================ */

/* ---------- Design Tokens (مسافات وأحجام نصوص موحّدة) ---------- */
:root {
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
}

/* ---------- Banner ترحيبي للوحات التحكم ---------- */
.welcome-banner {
    background: var(--gradient-primary);
    border-radius: var(--radius);
    padding: var(--space-6) var(--space-8);
    margin-bottom: var(--space-6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.25);
}
.welcome-banner h2 {
    margin: 0;
    font-size: var(--text-2xl);
    font-weight: 800;
}
.welcome-banner p {
    margin: var(--space-2) 0 0;
    opacity: 0.85;
    font-size: 0.95rem;
}
.welcome-banner .btn-on-gradient {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}
.welcome-banner .btn-on-gradient:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---------- Password Field with Toggle ---------- */
.password-field {
    position: relative;
}
.password-field .password-toggle {
    position: absolute;
    inset-inline-start: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: var(--space-1);
    border-radius: var(--space-1);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.password-field .password-toggle:hover {
    color: var(--secondary-color);
    background: rgba(79, 70, 229, 0.08);
}
.password-field .password-toggle:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}
.password-field input {
    /* RTL: padding-inline-start for icon, padding-inline-end for normal */
    padding-inline-start: 42px !important;
}

/* ---------- Button Loading State ---------- */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2.5px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Empty State (موحّد) ---------- */
.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-6);
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-3);
    display: block;
    opacity: 0.3;
    color: var(--text-muted);
}
.empty-state .empty-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: var(--space-2);
}
.empty-state .empty-text {
    margin: 0 0 var(--space-4);
    font-size: 0.95rem;
}

/* ---------- Skeleton Loader ---------- */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(226, 232, 240, 0.5) 25%,
        rgba(226, 232, 240, 1) 50%,
        rgba(226, 232, 240, 0.5) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--space-1);
}
.skeleton-line {
    height: 14px;
    margin-bottom: var(--space-2);
}
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-block;
}
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- Sticky Table Header ---------- */
.table-sticky thead th {
    position: sticky;
    top: 0;
    background: var(--primary-color);
    color: #fff;
    z-index: 10;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
}
.table-sticky thead th a,
.table-sticky thead th i {
    color: #fff;
}

/* ---------- Sortable Header Indicator ---------- */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.sortable:hover { opacity: 0.85; }
th.sortable::after {
    content: ' ⇅';
    opacity: 0.4;
    font-size: 0.85em;
}
th.sortable.sort-asc::after {
    content: ' ↑';
    opacity: 1;
    color: #fbbf24;
}
th.sortable.sort-desc::after {
    content: ' ↓';
    opacity: 1;
    color: #fbbf24;
}

/* ---------- Currency / Amount Cell ---------- */
.amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: end;
    direction: ltr;
    unicode-bidi: embed;
    white-space: nowrap;
}
.amount-pos { color: var(--success-color); }
.amount-neg { color: var(--danger-color); }
.amount .currency {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85em;
    margin-inline-start: 4px;
}
.balance-ok {
    background: #ecfdf5;
    color: var(--success-color);
    font-weight: 700;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}
.balance-error {
    background: #fef2f2;
    color: var(--danger-color);
    font-weight: 700;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

/* ---------- Form: Error Messages ---------- */
.field-error {
    display: block;
    color: var(--danger-color);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
    min-height: 1.2em;
    font-weight: 500;
}
.form-group.has-error .form-control {
    border-color: var(--danger-color);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.form-group.has-error label {
    color: var(--danger-color);
}
.form-group.has-success .form-control {
    border-color: var(--success-color);
}

/* ---------- Form: Required Indicator ---------- */
.form-label.required::after,
label.required::after {
    content: ' *';
    color: var(--danger-color);
    font-weight: 700;
}

/* ---------- Helper Text ---------- */
.form-text {
    display: block;
    margin-top: var(--space-1);
    color: var(--text-muted);
    font-size: var(--text-xs);
}

/* ---------- Filter Bar (لجداول الفلاتر المتعددة) ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: flex-end;
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}
.filter-bar .form-group {
    margin-bottom: 0;
    flex: 1 1 180px;
    min-width: 160px;
}
.filter-bar .filter-actions {
    display: flex;
    gap: var(--space-2);
    flex: 0 0 auto;
}
@media (max-width: 768px) {
    .filter-bar .form-group {
        flex: 1 1 100%;
    }
}

/* ---------- Generic Icon Circle (بديل الإيموجي) ---------- */
.icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.icon-circle.sm { width: 32px; height: 32px; font-size: 1rem; }
.icon-circle.lg { width: 64px; height: 64px; font-size: 2rem; }
.icon-circle.primary { background: rgba(79, 70, 229, 0.1); color: var(--secondary-color); }
.icon-circle.success { background: rgba(5, 150, 105, 0.1); color: var(--success-color); }
.icon-circle.warning { background: rgba(217, 119, 6, 0.1); color: var(--warning-color); }
.icon-circle.danger  { background: rgba(220, 38, 38, 0.1); color: var(--danger-color); }
.icon-circle.info    { background: rgba(8, 145, 178, 0.1); color: var(--info-color); }

/* ---------- Responsive form row على الجوال ---------- */
@media (max-width: 640px) {
    .form-row {
        flex-direction: column;
        gap: var(--space-3);
    }
    .form-row .form-group {
        flex: 1 1 100% !important;
        min-width: 0 !important;
    }
    /* الجداول تأخذ scroll أفقي */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Rashed modal يأخذ كامل العرض */
    .rashed-modal {
        width: calc(100vw - 32px) !important;
        max-width: 380px;
        left: 16px !important;
        bottom: 90px !important;
    }
    /* FAB button فوق السطر */
    .ai-fab {
        bottom: 20px !important;
        left: 20px !important;
        width: 52px !important;
        height: 52px !important;
        font-size: 20px !important;
    }
}

/* ---------- Card consistent utilities ---------- */
.card-flex {
    display: flex;
    flex-direction: column;
}
.card-flex .card-body {
    flex: 1;
}

/* ---------- Page Title + Actions Bar ---------- */
.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.page-actions .page-actions-title {
    font-size: var(--text-xl);
    font-weight: 700;
    margin: 0;
}
.page-actions .page-actions-buttons {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ---------- Toast container (موحّد) ---------- */
.toast-container {
    position: fixed;
    top: 70px;
    inset-inline-start: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
    max-width: 380px;
}

.toast-container .toast,
.toast-container .notif-toast {
    pointer-events: auto;
}

/* ---------- Print helper ---------- */
@media print {
    .no-print,
    .sidebar,
    .top-bar,
    .ai-fab,
    .rashed-modal,
    .notification-bell,
    .page-actions-buttons {
        display: none !important;
    }
    .main-content {
        margin-inline-start: 0 !important;
    }
    body { background: #fff !important; }
}

/* ---------- Section Subtitle (للنماذج متعددة الأقسام) ---------- */
.section-subtitle {
    margin: var(--space-5) 0 var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 2px solid var(--border-color);
    color: var(--text-main);
    font-weight: 700;
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.section-subtitle i {
    color: var(--secondary-color);
}

/* ---------- Status Strip (للجداول مع فلاتر سريعة) ---------- */
.status-strip {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    border-radius: 999px;
    background: var(--surface-muted);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    transition: var(--transition);
}
.status-chip b {
    background: rgba(15, 23, 42, 0.08);
    color: var(--text-main);
    padding: 0 var(--space-2);
    border-radius: 999px;
    font-size: var(--text-xs);
}
.status-chip:hover {
    background: var(--surface);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}
.status-chip.active {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #fff;
}
.status-chip.active b {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* ---------- Helper utilities ---------- */
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-center { text-align: center !important; }

.claim-link {
    color: var(--secondary-color);
    font-weight: 600;
    text-decoration: none;
}
.claim-link:hover { text-decoration: underline; }

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.quick-actions .btn {
    justify-content: center;
}
