
/* CRM Anglor Styles - مطابق للتصميم الأصلي */

/*
 * تم تعطيل هذا الكود لأنه يخفي عناصر choices.js المستخدمة في FormIO
 * مما يسبب مشاكل في عرض حقول الاختيار (select/dropdown)
 *
 * إخفاء غلاف Form.io القديم للـ select (choices.js) حتى لا يظهر حقل فارغ فوق الـ select الحقيقي
 * .formio-component .choices,
 * .formio-component .choices__inner {
 *     display: none !important;
 * }
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --primary-light: #8b9cf7;
    --primary-rgb: 102, 126, 234;
    --secondary-color: #4facfe;
    --secondary-dark: #00f2fe;
    --success-color: #10b981;
    --success-rgb: 16, 185, 129;
    --warning-color: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --error-color: #ef4444;
    --error-rgb: 239, 68, 68;
    --info-color: #3b82f6;
    --info-rgb: 59, 130, 246;
    --ai-color: #10b981;
    --ai-rgb: 16, 185, 129;
    --text-primary: #1a202c;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --background-primary: #ffffff;
    --background-secondary: #f8fafc;
    --background-light: #f1f5f9;
    --sidebar-width: 280px;
    --border-color: #e5e7eb;
    --border-radius: 8px;
    /* Sidebar Variables */
    --sidebar-bg: #ffffff;
    --sidebar-text: #0f172a;
    --sidebar-icon-color: #2563eb;
    --sidebar-active: #667eea;
    --sidebar-hover-bg: rgba(102, 126, 234, 0.08);
    --sidebar-active-bg: rgba(102, 126, 234, 0.15);
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 25px rgba(0,0,0,0.15);
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--background-light);
    color: var(--text-primary);
    margin: 0; /* Reset default browser margin to remove outer gaps */
    line-height: 1.6;
    scroll-behavior: smooth;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--primary-rgb), 0.65) var(--background-secondary);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(236, 240, 255, 0.9);
    border-radius: 12px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.85), rgba(var(--primary-rgb), 0.55));
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.7);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(var(--primary-rgb), 1), rgba(var(--primary-rgb), 0.75));
}

.app-container {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
    position: relative;
}

/* Sidebar */
.sidebar {
    inline-size: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 0;
    block-size: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: fixed;
    inset-block-start: 0;
    inset-inline-start: 0; /* left in LTR, right in RTL */
    display: flex;
    flex-direction: column;
    z-index: 1000;
    will-change: transform;
    box-shadow: 0 0 0 rgba(0,0,0,0.0); /* neutral; page header has its own shadow */
    transition: transform 0.3s ease;
}

/* Off-canvas positions (overlay) */
html[dir="ltr"] .sidebar { transform: translateX(calc(-1 * var(--sidebar-width))); }
html[dir="rtl"] .sidebar { transform: translateX(var(--sidebar-width)); }
/* Open state */
.sidebar.show { transform: translateX(0) !important; }

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: var(--border-color);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

html[dir="rtl"] .sidebar.collapsed {
    transform: translateX(100%);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--sidebar-header-bg, #f8fafc);
    backdrop-filter: none;
    flex-shrink: 0;
}

.sidebar {
    font-family: 'Cairo', 'Segoe UI', sans-serif;
    font-size: 14px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 8px;
    white-space: nowrap;
}

.logo .material-icons {
    font-size: 28px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--sidebar-icon-color);
    padding: 6px;
    border-radius: 8px;
    box-shadow: none;
    flex-shrink: 0;
}

.logo-subtitle {
    font-size: 11px;
    opacity: 0.8;
    font-weight: 600;
    margin-top: 4px;
    line-height: 1.3;
}

.nav-menu {
    padding-block: 12px;
    padding-inline: 10px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-search {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin: 0 12px 14px;
    border-radius: 12px;
    background: var(--sidebar-hover-bg);
    box-shadow: inset 0 0 0 1px var(--border-color);
    z-index: 2;
}

.nav-search .material-icons {
    font-size: 18px;
    color: var(--sidebar-icon-color);
}

.nav-search input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 600;
    outline: none;
}

.nav-search input::placeholder {
    color: var(--text-muted);
}

.nav-section {
    margin-bottom: 20px;
}

.nav-section-title {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    padding: 10px 16px;
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    text-transform: none;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-section-title:hover {
    color: var(--sidebar-text);
    background: var(--sidebar-hover-bg);
    border-radius: var(--border-radius);
}

.nav-section-title .section-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 800;
    color: var(--sidebar-text);
    flex: 1;
    overflow: hidden;
}

.nav-section-title .section-label .section-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.nav-section-title .section-icon {
    font-size: 18px;
    color: var(--sidebar-icon-color);
    background: var(--sidebar-hover-bg);
    border-radius: 10px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-section-title .toggle-icon {
    color: var(--text-muted);
}

.nav-section-title .material-icons {
    font-size: 18px;
}

.nav-items.collapsed {
    display: none;
}

.nav-section .nav-items.expanded {
    display: flex;
    flex-direction: column;
    background: var(--sidebar-hover-bg);
    margin: 0;
    padding: 6px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border-radius: var(--border-radius);
    margin: 2px 0;
    padding-block: 12px;
    padding-inline-start: 28px;
    padding-inline-end: 18px;
    overflow: hidden;
}

.nav-item > span:not(.material-icons) {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    background: var(--sidebar-active);
    border-radius: 0 4px 4px 0;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: var(--sidebar-hover-bg);
    color: var(--sidebar-text);
    box-shadow: 0 4px 12px var(--sidebar-hover-bg);
}

html[dir="ltr"] .nav-item:hover {
    transform: translateX(4px);
}

html[dir="rtl"] .nav-item:hover {
    transform: translateX(-4px);
}

.nav-item:hover::before {
    width: 4px;
    height: 24px;
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text);
    box-shadow: 0 4px 12px var(--sidebar-hover-bg);
}

.nav-item.active::before {
    width: 4px;
    height: 32px;
    background: var(--sidebar-active);
}

.nav-item .material-icons {
    font-size: 20px;
    opacity: 0.9;
    transition: all 0.3s ease;
    flex-shrink: 0;
    color: var(--sidebar-icon-color);
    margin-inline-start: 4px;
}

.nav-item:hover .material-icons,
.nav-item.active .material-icons {
    opacity: 1;
    transform: scale(1.1);
}

/* Main Content (logical, auto-respects RTL/LTR) */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    margin-inline-start: 0;
    transition: margin 0.3s ease;
}

body.is-desktop:not(.sidebar-collapsed) .main-content {
    margin-inline-start: var(--sidebar-width);
}

.header {
    background: white;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.menu-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
}

.menu-toggle:active {
    background: rgba(102, 126, 234, 0.2);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon-strip {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 14px;
    background: #f2f5ff;
    color: #5b6df4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(91, 109, 244, 0.2);
    transition: all 0.2s ease;
}

.header-icon-btn .material-icons {
    font-size: 20px;
    color: #5b6df4;
}

.header-icon-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    background: rgba(91, 109, 244, 0.15);
}

.header-icon-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.header-icon-btn .icon-badge {
    position: absolute;
    top: 2px;
    inset-inline-end: 2px;
    background: #ff4d6d;
    color: #fff;
    border-radius: 999px;
    font-size: 10px;
    padding: 2px 5px;
    line-height: 1;
}

.header-divider {
    width: 1px;
    height: 32px;
    background: rgba(148, 163, 184, 0.4);
}

.language-switcher-icon {
    position: relative;
}

.language-switcher-icon .dropdown-toggle,
.language-switcher-icon button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.language-switcher-icon .dropdown-toggle::after {
    display: none;
}

.language-switcher-icon .dropdown-menu {
    min-width: 160px;
    inset-inline-end: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--background-secondary);
    cursor: pointer;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
}

/* Content Area */
.content {
    /* تقليل التباعد الداخلي حتى تقترب الصفحة من القوائم */
    padding: 12px 16px;
    padding-inline-start: 0 !important; /* side next to sidebar */
    flex: 1;
    overflow-y: visible;
    background: #f8fafc;
    min-height: calc(100vh - 120px);
    padding-bottom: 32px;
}

/* Page Header */
.page-header {
    background: white;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
    position: relative;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 16px 16px 0 0;
}

.page-header h1 {
    margin: 0;
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 700;
}

.page-header p {
    margin: 8px 0 0 0;
    color: var(--text-secondary);
    font-size: 16px;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
}

.page-subtitle {
    color: var(--text-secondary);
    margin-top: 8px;
}

.page-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    min-height: 44px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn .material-icons {
    font-size: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-error {
    background: var(--error-color);
    color: white;
}

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

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

/* Stats Grid - Crypto/Finance Style Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    padding: 20px 24px;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
    border: 1px solid #eef2f7;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    /* تم إزالة transform لتجنب مشاكل stacking context مع dropdowns */
}

/* Card Header - Icon + Title */
.stat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.stat-icon .material-icons {
    font-size: 22px;
    color: white;
}

.stat-card:hover .stat-icon {
    transform: scale(1.1);
}

/* Icon Colors by variant */
.stat-card.primary .stat-icon { background: linear-gradient(135deg, #6259ca 0%, #4a44b5 100%); }
.stat-card.success .stat-icon { background: linear-gradient(135deg, #26bf94 0%, #1fa580 100%); }
.stat-card.warning .stat-icon { background: linear-gradient(135deg, #f5734a 0%, #f56040 100%); }
.stat-card.info .stat-icon { background: linear-gradient(135deg, #45aaf2 0%, #2d98da 100%); }
.stat-card.secondary .stat-icon { background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%); }
.stat-card.danger .stat-icon { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }

.stat-title {
    font-size: 14px;
    color: #5b6e88;
    font-weight: 500;
    margin: 0;
}

.stat-subtitle {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 400;
    margin: 0;
}

/* Card Content - Value + Change */
.stat-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    margin: 0;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.stat-change.up { color: #26bf94; }
.stat-change.down { color: #ef4444; }
.stat-change.neutral { color: #64748b; }

.stat-change .material-icons {
    font-size: 16px;
}

/* Card Footer - Mini Chart */
.stat-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    position: relative;
    height: 40px;
}

.stat-sparkline {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 35px;
}

/* SVG Sparkline Colors */
.stat-card.primary .stat-sparkline path { stroke: #6259ca; }
.stat-card.success .stat-sparkline path { stroke: #26bf94; }
.stat-card.warning .stat-sparkline path { stroke: #f5734a; }
.stat-card.info .stat-sparkline path { stroke: #45aaf2; }
.stat-card.secondary .stat-sparkline path { stroke: #a855f7; }
.stat-card.danger .stat-sparkline path { stroke: #ef4444; }

/* ===== OLD STRUCTURE COMPATIBILITY ===== */
/* For pages still using old structure */
.stat-card .stat-content:has(.stat-info) {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.stat-info {
    flex: 1;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px 0;
    line-height: 1.2;
}

.stat-info p {
    font-size: 14px;
    color: #5b6e88;
    font-weight: 500;
    margin: 0;
}

/* Old structure icon styling */
.stat-card .stat-content > .stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.stat-card .stat-content > .stat-icon .material-icons {
    font-size: 26px;
}

/* Footer trend for old structure */
.stat-footer .trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
}

.stat-footer .trend.up { color: #26bf94; }
.stat-footer .trend.down { color: #ef4444; }
.stat-footer .trend .material-icons { font-size: 16px; }

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: visible;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    /* تم إزالة transform لأنه ينشئ stacking context جديد ويسبب اختفاء dropdowns */
}

/* تعطيل تأثيرات hover على العناصر التي تحتوي dropdown مفتوح */
.card:has(.ss-dropdown.open),
.card:has(.searchable-select-dropdown),
.card:has(.dropdown-menu.show),
.card:has(.choices.is-open) {
    transform: none !important;
    z-index: auto !important;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--background-secondary);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.card-title .material-icons {
    color: var(--primary-color);
}

.card-content {
    padding: 24px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: 16px 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.table th,
.table td {
    padding: 16px 12px;
    text-align: start;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table th {
    background: var(--background-secondary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table td {
    color: var(--text-primary);
    font-size: 14px;
}

.table tr:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

.table tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

.badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.badge.error {
    background: #fee2e2;
    color: #991b1b;
}

.badge.info {
    background: #dbeafe;
    color: #1e40af;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --sidebar-width: min(85vw, 320px);
    }

    /* Sidebar للجوال */
    .sidebar {
        position: fixed !important;
        inset-block-start: 0 !important;
        inset-inline-end: 0 !important;
        inset-inline-start: auto !important;
        height: 100vh !important;
        inline-size: var(--sidebar-width) !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) !important;
        z-index: 1001 !important;
        box-shadow: -12px 0 30px rgba(15, 23, 42, 0.35) !important;
        border-radius: 0 28px 28px 0;
        padding-block: 18px 32px;
        padding-inline: 12px;
    }

    html[dir="ltr"] .sidebar {
        inset-inline-start: 0 !important;
        inset-inline-end: auto !important;
        transform: translateX(calc(-1 * 100%)) !important;
        box-shadow: 12px 0 30px rgba(15, 23, 42, 0.35) !important;
        border-radius: 28px 0 0 28px;
    }

    .sidebar.show {
        transform: translateX(0) !important;
    }

    .sidebar.collapsed {
        transform: translateX(100%) !important;
    }

    html[dir="ltr"] .sidebar.collapsed {
        transform: translateX(calc(-1 * 100%)) !important;
    }

    .sidebar-header {
        display: none;
    }

    .nav-menu {
        padding: 12px 12px 48px;
    }

    .nav-search {
        margin: 0 0 16px;
        border-radius: 14px;
        padding-inline: 16px;
    }

    .nav-section-title {
        font-size: 13px;
        padding: 12px;
        border-radius: 10px;
    }

    .nav-item {
        border-radius: 14px;
        padding: 12px;
        font-size: 15px;
    }

    /* Main Content */
    .main-content {
        margin: 0;
        width: 100%;
    }

    /* Menu Toggle - ظاهر دائماً */
    .menu-toggle {
        display: flex !important;
        width: 44px !important;
        height: 44px !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent;
        border-radius: 8px;
        transition: background 0.2s;
    }

    .menu-toggle:hover,
    .menu-toggle:active {
        background: rgba(102, 126, 234, 0.1);
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Page Header */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
        margin-bottom: 20px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    /* Page Actions */
    .page-actions {
        width: 100%;
        justify-content: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .page-actions .btn {
        width: 100%;
    }

    /* Content */
    .content {
        padding: 16px;
    }

    /* Cards */
    .card {
        margin-bottom: 16px;
    }

    .card-header {
        padding: 16px;
    }

    .card-content {
        padding: 16px;
    }

    /* Buttons */
    .btn {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 15px;
    }

    /* Header */
    .header {
        padding: 12px 16px;
    }

    .header-right .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
}


/* Inline validation and hints (Registration UX) */
.validation-message{color:#dc2626;font-size:12px;margin-top:6px}
.form-hint{color:var(--text-secondary);font-size:12px}
.form-input:focus{outline:2px solid var(--primary-color);outline-offset:2px;border-color:var(--primary-color)}


/* Auth pages responsiveness */
.auth-container{max-width:680px;margin-inline:auto}
@media (max-width:768px){
  .auth-container{padding:16px}
  .auth-container .row.auth-grid{display:block !important}
  .auth-container .d-flex.gap-2{flex-direction:column;gap:10px}
  .auth-container .btn{width:100%}
  .form-input{min-height:48px}
}


/* Visual polish for auth and forms */
.auth-card{transition:box-shadow .25s ease}
.auth-card:hover{box-shadow:0 16px 40px rgba(0,0,0,.12)}
.auth-header{position:relative}
.auth-steps .step{transition:box-shadow .2s ease}
.auth-steps .step.current{box-shadow:0 2px 6px rgba(0,0,0,.15)}
.auth-steps .step:hover{box-shadow:0 4px 8px rgba(0,0,0,.1)}
.form-label{font-weight:600}
.form-input{transition:border-color .2s ease, box-shadow .2s ease}
.alert{border-radius:10px}
/* Reduce motion for users preferring less animation */
@media (prefers-reduced-motion: reduce){
  *{animation:none!important;transition:none!important}
}

/* AI Assistant Button Styles */
.ai-assistant-btn {
    position: relative;
    transition: all 0.3s ease;
}

.ai-assistant-btn:hover {
    transform: scale(1.1);
}

.ai-assistant-btn .material-icons {
    animation: pulse-ai 2s ease-in-out infinite;
}

@keyframes pulse-ai {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.ai-assistant-btn:hover .material-icons {
    animation: none;
    transform: scale(1.1);
}

/* Language Switcher Dropdown in Header */
.language-dropdown-header {
    min-width: 140px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: white;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    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='%23667eea' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 32px;
}

.language-dropdown-header:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.language-dropdown-header:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.language-switcher {
    display: flex;
    align-items: center;
}

/* Language Icon Only Button */
.language-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.language-icon-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.language-icon-btn .material-icons {
    font-size: 22px;
}
