@font-face {
    font-family: 'Expo Arabic';
    src: url('/fonts/Expo-Arabic-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Expo Arabic';
    src: url('/fonts/alfont_com_AlFont_com_ExpoArabic-Medium.ttf') format('truetype');
    font-weight: 400;
    /* Map Medium to regular weight to cover general text */
    font-style: normal;
}

@font-face {
    font-family: 'Expo Arabic';
    src: url('/fonts/alfont_com_AlFont_com_ExpoArabic-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Expo Arabic';
    src: url('/fonts/alfont_com_AlFont_com_ExpoArabic-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
}

@font-face {
    font-family: 'Expo Arabic';
    src: url('/fonts/Expo-Arabic-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

:root {
    --primary: #dc2626;
    --primary-dark: #b91c1c;
    --primary-rgb: 220, 38, 38;
    --secondary: #10b981;
    --dark-bg: #7f1d1d;
    --dark-sidebar: #b91c1c;
    --light-bg: #f8fafc;
    --text-main: #334155;
    --border-color: #e2e8f0;
}

body {
    background-color: var(--light-bg);
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    font-family: 'Expo Arabic', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Auth Page Styles */
.auth-body {
    background-color: #fff;
}

.bg-login-image {
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
}

.auth-bg-shapes {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 10%, transparent 10%),
        radial-gradient(circle, rgba(255, 255, 255, 0.03) 20%, transparent 20%);
    background-size: 50px 50px;
}

.auth-glass-panel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-input-group {
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.login-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
}

.btn-login-submit {
    border-radius: 12px;
}

/* App Layout & Sidebar Styles */
.wrapper {
    min-height: 100vh;
    overflow-x: hidden;
}

.modern-sidebar {
    background: var(--dark-sidebar);
    width: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.05);
    z-index: 1030;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.sidebar-collapsed .modern-sidebar {
    width: 80px;
}

.sidebar-header {
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-collapsed .sidebar-header h4,
.sidebar-collapsed .sidebar-header .badge {
    opacity: 0;
    display: none;
}

.sidebar-collapsed .brand-logo i {
    width: 2rem !important;
    height: 2rem !important;
}

.sidebar-nav {
    padding: 0 15px;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom Scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

.sidebar-nav a {
    color: #94a3b8;
    text-decoration: none;
    padding: 12px;
    display: flex;
    align-items: center;
    border-radius: 10px;
    margin-bottom: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.sidebar-nav a i {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
}

.sidebar-nav a span.nav-text {
    margin-right: 12px;
    transition: opacity 0.3s ease;
}

.sidebar-collapsed .sidebar-nav a {
    justify-content: center;
}

.sidebar-collapsed .sidebar-nav a span.nav-text {
    display: none;
}

.sidebar-collapsed .sidebar-heading {
    display: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateX(-4px);
}

.sidebar-collapsed .sidebar-nav a:hover,
.sidebar-collapsed .sidebar-nav a.active {
    transform: translateX(0);
}

.sidebar-nav a.active {
    background: var(--primary);
    box-shadow: 0 4px 10px rgba(var(--primary-rgb), 0.3);
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
    position: absolute;
    left: -16px;
    top: 30px;
    background: var(--primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1040;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 3px solid var(--light-bg);
    transition: transform 0.3s ease;
}

.sidebar-collapsed .sidebar-toggle-btn {
    transform: rotate(180deg);
}

.sidebar-toggle-btn:hover {
    background: var(--primary-dark);
}

.sidebar-footer {
    padding: 15px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-collapsed .sidebar-footer .logout-text {
    display: none;
}

.sidebar-collapsed .sidebar-footer .btn {
    padding: 12px;
    justify-content: center;
}

.sidebar-collapsed .sidebar-footer .btn i {
    margin: 0 !important;
}

.main-content {
    padding: 20px 30px;
    flex-grow: 1;
    width: calc(100% - 260px);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-collapsed .main-content {
    width: calc(100% - 80px);
}

/* Responsive */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1020;
}

@media (max-width: 991px) {
    .modern-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        transform: translateX(100%);
    }

    .mobile-sidebar-open .modern-sidebar {
        transform: translateX(0);
    }

    .sidebar-collapsed .modern-sidebar {
        width: 260px;
        /* Don't collapse on mobile, just slide out */
    }

    .sidebar-collapsed .sidebar-header h4,
    .sidebar-collapsed .sidebar-header .badge,
    .sidebar-collapsed .sidebar-nav a span.nav-text,
    .sidebar-collapsed .sidebar-heading,
    .sidebar-collapsed .sidebar-footer .logout-text {
        display: block;
        opacity: 1;
    }

    .sidebar-collapsed .sidebar-nav a {
        justify-content: flex-start;
    }

    .sidebar-toggle-btn {
        display: none;
        /* Hide edge toggle on mobile */
    }

    .main-content,
    .sidebar-collapsed .main-content {
        width: 100%;
        padding: 15px;
    }

    .mobile-sidebar-open .mobile-overlay {
        display: block;
    }
}

/* Cards & Tables */
.card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

.table {
    margin-bottom: 0;
}

.table> :not(caption)>*>* {
    padding: 1rem 1.2rem;
    border-bottom-color: var(--border-color);
}

.table th {
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.25rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* SweetAlert Customization without !important */
body .swal2-container .swal-custom-popup {
    border-radius: 20px;
}

body .swal2-container .swal-custom-title {
    font-family: 'Expo Arabic', sans-serif;
    font-weight: 700;
}

/* Bootstrap Primary Overrides (Red Theme) */
html body .text-primary {
    color: var(--primary);
}

html body .bg-primary {
    background-color: var(--primary);
}

html body .badge.bg-primary {
    background-color: var(--primary);
}

html body .btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

html body .btn-primary:hover,
html body .btn-primary:focus,
html body .btn-primary:active {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

html body .btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

html body .btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

html body .alert-primary {
    background-color: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}