/**
 * ERP System - Main Stylesheet  
 * Dark Theme with Modern Design
 */

/* ========== CSS Variables (Colors & Sizes) ========== */
:root {
    /* Primary Colors */
    --primary-color: #3b82f6;
    --primary-color-rgb: 59, 130, 246;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;

    /* Background Colors - DARK THEME DEFAULT */
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --light-bg: #334155;
    --dark-bg: #020617;

    /* Text Colors - LIGHT TEXT FOR DARK BG */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-light: #94a3b8;

    /* Status Colors */
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;

    /* Border & Shadow */
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    /* Layout Sizes */
    --header-height: 70px;
    --sidebar-width: 260px;
    --border-radius: 16px;

    /* Transitions */
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Premium Gradients */
    --grad-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --grad-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --grad-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    --grad-info: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    --grad-warning: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --grad-dark: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.glass-panel {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.premium-stat-card {
    border-radius: 20px;
    padding: 24px;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.premium-stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.premium-stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    z-index: -1;
}

.floating-float {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.gradient-text {
    background: var(--grad-primary);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* ========== Global Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
}

/* Arabic Font */
body[dir="rtl"] {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

/* ========== Header ========== */
.header {
    background: var(--bg-card);
    height: var(--header-height);
    box-shadow: var(--shadow-md);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 30px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-base);
}

.dark-theme .header {
    background: rgba(30, 41, 59, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 1.8rem;
}

/* Moño Hair Spa Logo Styling */
.logo-mono {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    line-height: 1;
    transition: var(--transition-base);
}

.logo-mono:hover {
    transform: scale(1.05);
}

.logo-mono .logo-main {
    font-family: 'Arial', sans-serif;
    font-size: 2.8rem;
    font-weight: 400;
    letter-spacing: 2px;
    display: block;
    text-transform: lowercase;
    margin-bottom: -5px;
    color: var(--text-primary);
}

.logo-mono .logo-sub {
    font-family: 'Arial', sans-serif;
    font-size: 1.1rem;
    font-weight: 300;
    letter-spacing: 4px;
    display: block;
    text-transform: lowercase;
    margin-top: 5px;
    color: var(--text-secondary);
}

/* Header variant */
.header .logo-mono {
    align-items: flex-start;
}

.header .logo-mono .logo-main {
    font-size: 1.8rem;
    color: var(--primary-color);
}

.header .logo-mono .logo-sub {
    font-size: 0.7rem;
    letter-spacing: 3px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition-base);
    cursor: pointer;
}

.user-info:hover {
    background: var(--light-bg);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    gap: 6px;
    background: var(--light-bg);
    padding: 5px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.lang-btn {
    padding: 8px 18px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-base);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Theme Switcher */
.theme-switcher-wrapper {
    position: relative;
}

.theme-btn {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    cursor: pointer;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Added Theme Switcher Button Style */
.theme-switcher-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition-base);
    font-weight: 500;
}

.theme-switcher-btn:hover {
    background: var(--light-bg);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.theme-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.theme-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    padding: 12px;
    min-width: 240px;
    display: none;
    z-index: 1001;
    border: 1px solid var(--border-color);
}

body[dir="rtl"] .theme-dropdown {
    right: auto;
    left: 0;
}

.theme-dropdown.show {
    display: block;
    animation: dropdownSlide 0.3s ease-out;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.theme-option {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 6px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    border-radius: 10px;
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.theme-option:last-child {
    margin-bottom: 0;
}

body[dir="rtl"] .theme-option {
    text-align: right;
}

.theme-option i {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: var(--transition-base);
}

.theme-option[data-theme="light"] i {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.theme-option[data-theme="dark"] i {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

.theme-option[data-theme="blue"] i {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: white;
}

.theme-option[data-theme="green"] i {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.theme-option[data-theme="orange"] i {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
}

.theme-option:hover {
    background: var(--light-bg);
    transform: translateX(4px);
}

body[dir="rtl"] .theme-option:hover {
    transform: translateX(-4px);
}

.theme-option:hover i {
    transform: scale(1.1) rotate(5deg);
}

/* ========== Page Header ========== */
.page-title {
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i {
    color: var(--primary-color);
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    transition: var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 1.1rem;
    background: rgba(59, 130, 246, 0.05);
}

.card-body {
    padding: 25px;
}


/* ========== Grid System ========== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}

@media (min-width: 768px) {
    .col-md-3 {
        flex: 0 0 25%;
        max-width: 25%;
        padding-right: 15px;
        padding-left: 15px;
    }

    .col-md-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
        padding-right: 15px;
        padding-left: 15px;
    }

    .col-md-5 {
        flex: 0 0 41.666667%;
        max-width: 41.666667%;
        padding-right: 15px;
        padding-left: 15px;
    }

    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
        padding-right: 15px;
        padding-left: 15px;
    }

    .col-md-7 {
        flex: 0 0 58.333333%;
        max-width: 58.333333%;
        padding-right: 15px;
        padding-left: 15px;
    }

    .col-md-8 {
        flex: 0 0 66.666667%;
        max-width: 66.666667%;
        padding-right: 15px;
        padding-left: 15px;
    }

    .col-md-12 {
        flex: 0 0 100%;
        max-width: 100%;
        padding-right: 15px;
        padding-left: 15px;
    }
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--bg-card), var(--light-bg));
    padding: 25px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 15px;
    transition: var(--transition-base);
    min-height: 150px;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    flex-shrink: 0;
    margin: 0 auto;
}

.stat-info {
    width: 100%;
    text-align: center;
}

.stat-icon.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.stat-icon.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-icon.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stat-icon.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-icon.secondary {
    background: linear-gradient(135deg, #64748b, #475569);
}

.stat-info h3 {
    font-size: 2rem;
    margin: 0 0 5px 0;
    color: var(--text-primary);
    font-weight: 700;
}

.stat-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 116, 139, 0.3);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: var(--transition-base);
    background: var(--bg-main);
    color: var(--text-primary);
    height: auto;
    /* Fix for text clipping due to Bootstrap fixed height */
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* ========== Tables ========== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
    overflow: hidden;
    /* Ensure corners are clipped */
    border: 1px solid var(--border-color);
    /* Matches card style */
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.table thead th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Fix for Light Table Headers */
.table thead.bg-light th {
    color: var(--text-primary) !important;
}

body[dir="rtl"] .table thead th {
    text-align: right;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table-hover tbody tr {
    transition: var(--transition-base);
}

.table-hover tbody tr:hover {
    background: var(--light-bg);
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success,
.badge.bg-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.badge-danger,
.badge.bg-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.badge-warning,
.badge.bg-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.badge-info,
.badge.bg-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.badge-primary,
.badge.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

/* ========== Alerts ========== */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-left-color: #10b981;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-left-color: #ef4444;
}

.alert-info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-left-color: #3b82f6;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border-left-color: #f59e0b;
}

/* ========== Modals ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    animation: modalSlideIn 0.3s ease;
    border: 1px solid var(--border-color);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 1.6rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    body[dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px 15px;
    }

}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.table thead th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: white;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body[dir="rtl"] .table thead th {
    text-align: right;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.table-hover tbody tr {
    transition: var(--transition-base);
}

.table-hover tbody tr:hover {
    background: var(--light-bg);
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success,
.badge.bg-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.badge-danger,
.badge.bg-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.badge-warning,
.badge.bg-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.badge-info,
.badge.bg-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.badge-primary,
.badge.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

/* ========== Alerts ========== */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-left: 4px solid;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border-left-color: #10b981;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-left-color: #ef4444;
}

.alert-info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border-left-color: #3b82f6;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border-left-color: #f59e0b;
}

/* ========== Modals ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    animation: modalSlideIn 0.3s ease;
    border: 1px solid var(--border-color);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 1.6rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    body[dir="rtl"] .sidebar {
        transform: translateX(100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px 15px;
    }

    body[dir="rtl"] .main-content {
        margin-right: 0;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Global Table Alignment Fix ========== */
.table th,
.table td {
    text-align: right !important;
    vertical-align: middle !important;
}

/* ========== Print Styles ========== */
@media print {

    .header,
    .sidebar,
    .btn,
    .modal,
    .page-actions {
        display: none !important;
    }

    .main-content {
        margin: 0;
        padding: 20px;
    }
}


.premium-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.premium-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.icon-box-sm {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
}

.btn-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(var(--primary-color-rgb, 59, 130, 246), 0.1);
    color: var(--primary-color);
    cursor: pointer;
    transition: var(--transition-base);
}

.btn-icon-sm:hover {
    background: var(--primary-color);
    color: white;
}


.glass-effect {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.dark-theme .glass-effect {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ========== Premium UI Enhancements ========== */
.premium-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
    font-size: 0.95rem;
    border: none;
    color: white;
}

.premium-btn-primary {
    background: var(--grad-primary);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.premium-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.premium-btn-danger {
    background: var(--grad-danger);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    color: white !important;
}

.premium-btn-danger:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

.premium-btn-success {
    background: var(--grad-success);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    color: white !important;
}

.premium-btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.premium-btn-warning {
    background: var(--grad-warning);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    color: white !important;
}

.premium-btn-warning:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

.premium-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary) !important;
}

.premium-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* Light Theme overrides for secondary button */
.theme-light .premium-btn-secondary,
.theme-white .premium-btn-secondary {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #334155 !important;
}

.theme-light .premium-btn-secondary:hover,
.theme-white .premium-btn-secondary:hover {
    background: #cbd5e1;
}

.premium-control-modern {
    width: 100%;
    padding: 14px 20px;
    background: var(--bg-main);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-primary);
    font-weight: 600;
    transition: var(--transition-base);
}

.premium-control-modern:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    outline: none;
}

.premium-label {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.premium-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.85rem;
    gap: 8px;
    transition: var(--transition-base);
}

.premium-badge-info {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #3b82f6 !important;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.premium-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition-base);
    text-decoration: none;
    color: var(--text-secondary);
}

.premium-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.1);
    color: white;
}

.premium-header {
    margin: 0;
    border-radius: 0 0 30px 30px;
    padding: 40px 30px;
    background: var(--grad-dark);
    position: relative;
    overflow: hidden;
    z-index: 10;
}

/* RTL Specifics */
body[dir="rtl"] .premium-control-modern {
    text-align: right;
}

body[dir="rtl"] .premium-label {
    text-align: right;
}

/* Final Global Fixes */
.container-fluid {
    width: 100%;
    padding-right: 1.5rem;
    padding-left: 1.5rem;
    margin-right: auto;
    margin-left: auto;
}

/* Chart of Accounts Enhancements */
.level-indicator {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    margin: 0 auto;
}

.level-indicator.level-1 {
    background: #6366f1;
    color: white;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.level-indicator.level-2 {
    background: #64748b;
    color: white;
}

.level-indicator.level-3 {
    background: #94a3b8;
    color: white;
}

.level-indicator.level-4 {
    background: #cbd5e1;
    color: #475569;
}

.level-indicator.level-5 {
    background: #f1f5f9;
    color: #64748b;
}

.tree-icon {
    transition: transform 0.3s ease;
}

.account-row:hover .tree-icon {
    transform: scale(1.2);
}

/* Premium Modal Styles */
/* Premium Modal Styles */
/* Premium Modal Styles */
.premium-modal-content {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 24px !important;
    overflow-y: auto;
    /* Enable vertical scrolling */
    max-height: 85vh;
    /* Limit height to viewport */
    animation: premiumModalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    scrollbar-width: thin;
    /* For Firefox */
    scrollbar-color: var(--primary-color) rgba(255, 255, 255, 0.05);
    /* For Firefox */
    position: relative;
    width: 100%;
    /* Ensure responsiveness */
}

/* Custom Scrollbar for Modal */
.premium-modal-content::-webkit-scrollbar {
    width: 6px;
}

.premium-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.premium-modal-content::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

.modal {
    display: none;
    position: fixed;
    /* Force fixed positioning */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
}

.modal.show {
    display: flex !important;
    /* Force flex to enable centering */
}

@keyframes premiumModalSlide {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Light Theme Modal Overrides */
.theme-light .premium-modal-content,
.theme-white .premium-modal-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.theme-light .premium-btn-secondary,
.theme-white .premium-btn-secondary {
    background: #f1f5f9;
    color: #475569 !important;
    border: 1px solid #e2e8f0;
}

/* Tighter Form Spacing */
.premium-label {
    margin-bottom: 6px !important;
    /* Reduce gap between label and input */
    margin-top: 0;
}

.theme-light .premium-control,
.theme-white .premium-control {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #1e293b !important;
}

.theme-light .premium-label,
.theme-white .premium-label {
    color: #475569;
}

.theme-light .premium-addon,
.theme-white .premium-addon {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #64748b;
}

/* New Form Improvements */
.premium-control:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    outline: none;
    color: white;
}

.theme-light .premium-control:focus,
.theme-white .premium-control:focus {
    background: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    color: #0f172a !important;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    transition: var(--transition-base);
    cursor: pointer;
}

.btn-close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

.gap-3 {
    gap: 1rem;
}

/* ========== Dashboard Statistics (Added) ========== */
.stat-label {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.1;
    font-family: 'Inter', sans-serif;
}

.stat-description {
    font-size: 1.1rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.icon-box {
    width: 55px;
    height: 55px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 18px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
    transition: transform 0.3s ease;
}

.premium-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 25px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    height: 100%;
}

.premium-stat-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

.premium-stat-card:hover .icon-box {
    transform: scale(1.1) rotate(5deg);
}

/* Fix Delete Button Text Color in Light Mode */
.premium-btn-danger,
.btn-danger,
.premium-btn-danger:hover,
.btn-danger:hover {
    color: #ffffff !important;
}

/* Premium Action Menu (Dropdown) */
.premium-dropdown {
    position: relative;
    display: inline-block;
}

.premium-dropdown-btn {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.premium-dropdown-btn:hover {
    background: var(--primary-color);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--primary-color-rgb, 99, 102, 241), 0.3);
}

.premium-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    z-index: 1100;
    margin-top: 8px;
    overflow: hidden;
    animation: dropdownPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

body[dir="rtl"] .premium-dropdown-content {
    right: auto;
    left: 0;
}

@keyframes dropdownPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.premium-dropdown-content a,
.premium-dropdown-content button {
    color: var(--text-primary);
    padding: 12px 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    border: none;
    background: transparent;
    text-align: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.premium-dropdown-content a:hover,
.premium-dropdown-content button:hover {
    background: rgba(var(--primary-color-rgb, 99, 102, 241), 0.1);
    color: var(--primary-color);
    padding-inline-start: 25px;
}

.premium-dropdown-content i {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
}

.premium-dropdown.show .premium-dropdown-content {
    display: block !important;
}

.premium-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
    opacity: 0.5;
}

.dark-theme .premium-dropdown-content {
    background: rgba(30, 41, 59, 0.8) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-color: rgba(255, 255, 255, 0.1);
}

/* ========== Import Data Page Utility Classes ========== */
.bg-success-soft {
    background: rgba(16, 185, 129, 0.1) !important;
}

.bg-primary-soft {
    background: rgba(59, 130, 246, 0.1) !important;
}

.bg-danger-soft {
    background: rgba(239, 68, 68, 0.1) !important;
}

.bg-success-5 {
    background: rgba(16, 185, 129, 0.05) !important;
}

.bg-primary-5 {
    background: rgba(59, 130, 246, 0.05) !important;
}

.bg-danger-5 {
    background: rgba(239, 68, 68, 0.05) !important;
}

.bg-light-5 {
    background: rgba(200, 200, 200, 0.05) !important;
}

.border-success-10 {
    border: 1px solid rgba(16, 185, 129, 0.1) !important;
}

.border-primary-10 {
    border: 1px solid rgba(59, 130, 246, 0.1) !important;
}

.border-danger-10 {
    border: 1px solid rgba(239, 68, 68, 0.1) !important;
}

.rounded-xl {
    border-radius: 16px !important;
}

/* Ensure text in soft backgrounds is readable */
.bg-success-soft,
.bg-success-5 {
    color: #10b981 !important;
}

.bg-primary-soft,
.bg-primary-5 {
    color: var(--primary-color) !important;
}

.bg-danger-soft,
.bg-danger-5 {
    color: #ef4444 !important;
}

/* In Dark Theme, make these soft backgrounds slightly more visible */
body.dark-theme .bg-success-soft {
    background: rgba(16, 185, 129, 0.2) !important;
}

body.dark-theme .bg-primary-soft {
    background: rgba(59, 130, 246, 0.2) !important;
}

body.dark-theme .bg-danger-soft {
    background: rgba(239, 68, 68, 0.2) !important;
}

/* Light Theme Glass Panel Override - Exclude premium header to keep its gradient */
body:not(.dark-theme):not(.theme-blue):not(.theme-green):not(.theme-purple):not(.theme-orange) .glass-panel:not(.premium-header) {
    background: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1) !important;
    color: var(--text-primary) !important;
}

/* Ensure premium header keeps its vibrant gradient and white text */
.premium-header.glass-panel {
    background: var(--grad-primary) !important;
    color: white !important;
}

.premium-header.glass-panel * {
    color: white !important;
}

/* Fix for Select dropdown color in light theme */
.premium-control-modern option {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Darken muted text in light mode for better accessibility */
body:not(.dark-theme) .text-muted {
    color: #5e6d82 !important;
}

/* Fix for pre/code in light mode */
body:not(.dark-theme) code {
    background-color: #f1f5f9;
    color: #e83e8c;
    padding: 2px 4px;
    border-radius: 4px;
}

/* Aliases for soft backgrounds */
.bg-soft-primary {
    background: rgba(59, 130, 246, 0.1) !important;
    color: var(--primary-color) !important;
}

.bg-soft-success {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #10b981 !important;
}

.bg-soft-danger {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

.bg-soft-warning {
    background: rgba(245, 158, 11, 0.1) !important;
    color: #f59e0b !important;
}

.bg-soft-info {
    background: rgba(59, 130, 246, 0.1) !important;
    color: #3b82f6 !important;
}

/* Restore Sidebar header/footer specific colors if needed */
.sidebar {
    font-family: 'Cairo', 'Tajawal', sans-serif !important;
}

.premium-header {
    font-family: 'Cairo', 'Tajawal', sans-serif !important;

    /* ========== LIGHT THEME PREMIUM ENHANCEMENTS & FIXES ========== */
    .theme-light {
        --text-primary: #1e293b;
        --text-secondary: #475569;
        --text-light: #64748b;
        --text-muted: #94a3b8;
        --border-color: #cbd5e1;
        --bg-main: #f1f5f9;
        --bg-card: #ffffff;
        --light-bg: #f8fafc;
        --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    }

    .theme-light body {
        background-color: var(--bg-main) !important;
        color: var(--text-primary) !important;
    }

    .theme-light .card,
    .theme-light .header,
    .theme-light .sidebar {
        background: #ffffff !important;
        border-color: #cbd5e1 !important;
    }

    .theme-light .sidebar {
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05) !important;
    }

    .theme-light .sidebar-menu>li>a {
        color: #475569 !important;
    }

    .theme-light .sidebar-menu>li>a:hover {
        background: rgba(var(--primary-color-rgb), 0.08) !important;
        color: var(--primary-color) !important;
    }

    .theme-light .sidebar-menu>li>a i {
        background: #f1f5f9 !important;
        color: #64748b !important;
    }

    .theme-light .sidebar-section-title {
        color: #94a3b8 !important;
    }

    .theme-light .menu-separator {
        background: linear-gradient(90deg, transparent, #e2e8f0, transparent) !important;
    }

    .theme-light .header-container .logo {
        color: #1e293b !important;
    }

    /* Fix visibility of form elements */
    .theme-light .form-control,
    .theme-light .custom-select,
    .theme-light .select2-container--default .select2-selection--single {
        background-color: #ffffff !important;
        border: 1.5px solid #cbd5e1 !important;
        color: #1e293b !important;
    }

    .theme-light .form-control:focus {
        border-color: var(--primary-color) !important;
        box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1) !important;
    }

    .theme-light .form-group label {
        color: #334155 !important;
        font-weight: 600 !important;
    }

    /* Table visibility in Light Mode */
    .theme-light .table {
        background: #ffffff !important;
    }

    .theme-light .table tbody td {
        color: #1e293b !important;
        border-bottom-color: #f1f5f9 !important;
    }

    .theme-light .table-hover tbody tr:hover {
        background-color: #f8fafc !important;
    }

    /* Dashboard Stat Cards */
    .theme-light .stat-card {
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
    }

    .theme-light .stat-info h3 {
        color: #0f172a !important;
    }

    .theme-light .stat-info p {
        color: #64748b !important;
    }

    /* Modal Fixes */
    .theme-light .modal-content {
        background-color: #ffffff !important;
        border-radius: 20px !important;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15) !important;
    }

    .theme-light .modal-header {
        border-bottom-color: #f1f5f9 !important;
        background: #f8fafc !important;
    }

    .theme-light .modal-footer {
        border-top-color: #f1f5f9 !important;
    }

    /* Scrollbar for Light Mode */
    .theme-light ::-webkit-scrollbar-thumb {
        background: #cbd5e1 !important;
    }

    .theme-light ::-webkit-scrollbar-track {
        background: #f1f5f9 !important;
    }

    /* Fix for Button Icons in Light Mode */
    .theme-light .btn-light i {
        color: #475569 !important;
    }

    /* Alert Colors in Light Mode */
    .theme-light .alert {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
    }

    .theme-light hr,
    .theme-light .divider,
    .theme-light .border-bottom,
    .theme-light .border-top,
    .theme-light .border-left,
    .theme-light .border-right {
        border-color: #cbd5e1 !important;
        opacity: 1 !important;
    }

    .theme-light .text-white {
        color: #1e293b !important;
    }

    .theme-light .bg-white {
        background-color: #ffffff !important;
    }

    /* Force specific contrasting colors for light mode */
    .theme-light .text-light {
        color: #64748b !important;
    }

    .theme-light .text-secondary {
        color: #475569 !important;
    }
}