/* =====================================================
   Modern Dashboard Styles - Clean & Minimal
   تجديد - لوحة التحكم
   ===================================================== */

:root {
    /* Primary Colors - Modern Blue */
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;

    /* Success - Fresh Green */
    --success: #10b981;
    --success-light: #34d399;
    --success-dark: #059669;
    --success-50: #ecfdf5;

    /* Warning - Warm Amber */
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --warning-dark: #d97706;
    --warning-50: #fffbeb;

    /* Danger - Soft Red */
    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-dark: #dc2626;
    --danger-50: #fef2f2;

    /* Info - Cool Cyan */
    --info: #06b6d4;
    --info-light: #22d3ee;
    --info-dark: #0891b2;
    --info-50: #ecfeff;

    /* Neutrals */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Sidebar Colors */
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: rgba(59, 130, 246, 0.15);
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

    /* Border Radius */
    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* Base RTL Setup */
html[dir="rtl"] {
    direction: rtl;
}

body.rtl-layout {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-align: right;
    background-color: var(--gray-50);
    color: var(--gray-800);
}

/* Typography */
.rtl-layout h1, .rtl-layout h2, .rtl-layout h3,
.rtl-layout h4, .rtl-layout h5, .rtl-layout h6,
.rtl-layout p, .rtl-layout span, .rtl-layout a,
.rtl-layout label, .rtl-layout th, .rtl-layout td {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* =====================================================
   Sidebar Styles
   ===================================================== */

.sidebar-wrapper {
    background: var(--sidebar-bg);
    border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.rtl-layout .sidebar-wrapper {
    right: 0;
    left: auto;
    border-left: none;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.rtl-layout #sidebar {
    text-align: right;
}

.sidebar-wrapper .menu .dropdown-toggle {
    color: var(--sidebar-text);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 2px 8px;
    transition: all 0.15s ease;
}

.sidebar-wrapper .menu .dropdown-toggle:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.sidebar-wrapper .menu.active .dropdown-toggle,
.sidebar-wrapper .menu .dropdown-toggle.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
}

.sidebar-wrapper .menu-heading .heading {
    padding: 20px 16px 8px;
}

.sidebar-wrapper .menu-heading .heading span {
    color: var(--gray-500);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-wrapper .submenu {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
    margin: 4px 8px;
    padding: 8px 0;
}

.sidebar-wrapper .submenu li a {
    color: var(--sidebar-text);
    padding: 10px 16px;
    font-size: 13px;
    transition: all 0.15s ease;
}

.sidebar-wrapper .submenu li a:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover);
}

.sidebar-wrapper .submenu li a i {
    margin-left: 8px;
    opacity: 0.7;
}

/* Theme Brand */
.sidebar-wrapper .theme-brand {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-wrapper .theme-text a {
    color: white;
    font-size: 18px;
    font-weight: 600;
}

/* RTL Sidebar Adjustments */
.rtl-layout .sidebar-wrapper .menu .dropdown-toggle {
    flex-direction: row-reverse;
}

.rtl-layout .sidebar-wrapper .menu .dropdown-toggle > div:first-child {
    flex-direction: row-reverse;
}

.rtl-layout .sidebar-wrapper .menu .dropdown-toggle svg.feather-chevron-right {
    transform: rotate(180deg);
}

.rtl-layout .sidebar-wrapper .submenu {
    padding-right: 0;
    padding-left: 0;
}

/* =====================================================
   Main Content
   ===================================================== */

.rtl-layout .main-container {
    margin-right: 255px;
    margin-left: 0;
}

.rtl-layout.sidebar-closed .main-container {
    margin-right: 80px;
    margin-left: 0;
}

#content {
    background: var(--gray-50);
    min-height: 100vh;
}

/* =====================================================
   Cards - Clean & Modern
   ===================================================== */

.card {
    background: white;
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--gray-100);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    padding: 16px 20px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* =====================================================
   Stat Cards
   ===================================================== */

.stat-card,
.card .widget-icon {
    border-radius: var(--radius-md);
}

.widget-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border-radius: var(--radius-md);
}

.widget-icon.bg-primary {
    background: var(--primary-100) !important;
    color: var(--primary) !important;
}

.widget-icon.bg-success {
    background: var(--success-50) !important;
    color: var(--success) !important;
}

.widget-icon.bg-warning {
    background: var(--warning-50) !important;
    color: var(--warning) !important;
}

.widget-icon.bg-danger {
    background: var(--danger-50) !important;
    color: var(--danger) !important;
}

.widget-icon.bg-info {
    background: var(--info-50) !important;
    color: var(--info) !important;
}

/* Card Stats Text */
.card-body h2,
.card-body h3 {
    font-weight: 700;
    color: var(--gray-900);
}

.card-body .text-muted {
    color: var(--gray-500) !important;
    font-size: 13px;
}

.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-primary { color: var(--primary) !important; }

/* =====================================================
   Badges - Clean Design
   ===================================================== */

.badge {
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    letter-spacing: 0.01em;
}

.badge.bg-primary,
.btn-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

.badge.bg-success {
    background: var(--success) !important;
}

.badge.bg-warning {
    background: var(--warning) !important;
    color: white !important;
}

.badge.bg-danger {
    background: var(--danger) !important;
}

.badge.bg-info {
    background: var(--info) !important;
}

.badge.bg-secondary {
    background: var(--gray-200) !important;
    color: var(--gray-700) !important;
}

/* =====================================================
   Buttons - Modern & Clean
   ===================================================== */

.btn {
    border-radius: var(--radius);
    font-weight: 500;
    padding: 8px 16px;
    font-size: 14px;
    transition: all 0.15s ease;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

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

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

.btn-outline-secondary {
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    background: transparent;
}

.btn-outline-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-700);
}

.btn-light {
    background: rgba(255, 255, 255, 0.9);
    color: var(--gray-700);
    backdrop-filter: blur(4px);
}

.btn-light:hover {
    background: white;
}

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

/* =====================================================
   Dashboard Welcome Header
   ===================================================== */

.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    color: white;
    position: relative;
    overflow: hidden;
}

.dashboard-welcome::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.dashboard-welcome::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: 10%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.dashboard-welcome h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.dashboard-welcome p {
    opacity: 0.85;
    font-size: 15px;
    position: relative;
    z-index: 1;
}

.dashboard-welcome .btn-light {
    position: relative;
    z-index: 1;
}

/* =====================================================
   Quick Action Cards
   ===================================================== */

.quick-action-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.quick-action-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.quick-action-card i {
    font-size: 28px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}

.quick-action-card h6 {
    color: var(--gray-700);
    font-weight: 500;
    margin: 0;
    font-size: 14px;
}

/* =====================================================
   Tables - Clean Design
   ===================================================== */

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 14px 16px;
}

.table tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.table-hover tbody tr:hover {
    background-color: var(--gray-50);
}

.rtl-layout .table th,
.rtl-layout .table td {
    text-align: right;
}

/* =====================================================
   List Groups & Urgent Tasks
   ===================================================== */

.list-group-item {
    border: none;
    border-bottom: 1px solid var(--gray-100);
    padding: 16px 20px;
}

.list-group-item:last-child {
    border-bottom: none;
}

.urgent-task-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-left: 16px;
    flex-shrink: 0;
}

.rtl-layout .urgent-task-icon {
    margin-left: 0;
    margin-right: 16px;
}

.urgent-task-icon.bg-warning {
    background: var(--warning-50) !important;
    color: var(--warning) !important;
}

.urgent-task-icon.bg-info {
    background: var(--info-50) !important;
    color: var(--info) !important;
}

.urgent-task-icon.bg-danger {
    background: var(--danger-50) !important;
    color: var(--danger) !important;
}

/* =====================================================
   Activity Timeline
   ===================================================== */

.activity-timeline .activity-item {
    position: relative;
    padding-bottom: 20px;
}

.activity-timeline .activity-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 17px;
    top: 40px;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}

.rtl-layout .activity-timeline .activity-item:not(:last-child)::after {
    right: auto;
    left: 17px;
}

.activity-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.activity-icon.bg-success {
    background: var(--success-50) !important;
    color: var(--success) !important;
}

.activity-icon.bg-primary {
    background: var(--primary-100) !important;
    color: var(--primary) !important;
}

/* =====================================================
   Alerts - Modern Style
   ===================================================== */

.alert {
    border-radius: var(--radius-lg);
    border: none;
    padding: 16px 20px;
}

.alert-warning {
    background: var(--warning-50);
    color: var(--warning-dark);
    border-right: 4px solid var(--warning);
}

.rtl-layout .alert-warning {
    border-left: none;
    border-right: 4px solid var(--warning);
}

/* =====================================================
   Forms
   ===================================================== */

.form-control,
.form-select {
    border-radius: var(--radius);
    border: 1px solid var(--gray-300);
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.rtl-layout .form-control,
.rtl-layout .form-select {
    text-align: right;
}

/* =====================================================
   Navbar Adjustments
   ===================================================== */

.header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.header .nav-link {
    color: var(--gray-600);
}

.header .nav-link:hover {
    color: var(--primary);
}

.header .theme-text a {
    color: var(--gray-800);
    font-weight: 600;
}

/* RTL Navbar */
.rtl-layout .navbar-item.flex-row {
    flex-direction: row-reverse;
}

.rtl-layout .header .navbar-item.theme-brand {
    margin-right: 0;
    margin-left: auto;
}

.rtl-layout .action-area {
    margin-left: 0;
    margin-right: auto;
}

.rtl-layout .sidebarCollapse {
    margin-right: 0;
    margin-left: 15px;
}

/* =====================================================
   RTL Utilities Override
   ===================================================== */

.rtl-layout .text-end {
    text-align: left !important;
}

.rtl-layout .text-start {
    text-align: right !important;
}

.rtl-layout .ms-auto {
    margin-left: 0 !important;
    margin-right: auto !important;
}

.rtl-layout .me-auto {
    margin-right: 0 !important;
    margin-left: auto !important;
}

.rtl-layout .ms-1 { margin-left: 0 !important; margin-right: 0.25rem !important; }
.rtl-layout .ms-2 { margin-left: 0 !important; margin-right: 0.5rem !important; }
.rtl-layout .ms-3 { margin-left: 0 !important; margin-right: 1rem !important; }

.rtl-layout .me-1 { margin-right: 0 !important; margin-left: 0.25rem !important; }
.rtl-layout .me-2 { margin-right: 0 !important; margin-left: 0.5rem !important; }
.rtl-layout .me-3 { margin-right: 0 !important; margin-left: 1rem !important; }

.rtl-layout .dropdown-menu {
    text-align: right;
}

/* =====================================================
   Scrollbar Styling
   ===================================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* =====================================================
   Page Headings
   ===================================================== */

.page-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--gray-900);
}

.page-header .text-muted {
    color: var(--gray-500);
    font-size: 14px;
}

/* =====================================================
   Empty States
   ===================================================== */

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state i {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state p {
    color: var(--gray-500);
    font-size: 15px;
}

/* =====================================================
   Responsive
   ===================================================== */

@media (max-width: 991px) {
    .rtl-layout .main-container {
        margin-right: 0;
    }

    .rtl-layout .sidebar-wrapper {
        right: -255px;
    }

    .rtl-layout.show-sidebar .sidebar-wrapper {
        right: 0;
    }

    .dashboard-welcome {
        padding: 20px 24px;
    }

    .dashboard-welcome h2 {
        font-size: 20px;
    }
}

/* =====================================================
   Loading States
   ===================================================== */

.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =====================================================
   Focus States (Accessibility)
   ===================================================== */

.btn:focus,
.form-control:focus,
.form-select:focus,
a:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* =====================================================
   Dark Mode Support (Optional)
   ===================================================== */

@media (prefers-color-scheme: dark) {
    .dark-mode body.rtl-layout {
        background-color: var(--gray-900);
        color: var(--gray-100);
    }
}
