* {
    box-sizing: border-box;
}

:root {
    --primary: #3d5ee1;
    --primary-light: rgba(61, 94, 225, 0.1);
    --primary-hover: #2143c7;
    --secondary: #6c757d;
    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #343a40;
    --sidebar-bg: #ffffff;
    --sidebar-width: 290px;
    --sidebar-collapsed-width: 75px;
    --header-height: 64px;
    --body-bg: #f4f7fe;
    /* Slightly more modern blue tint bg */

    --text-color: #313131;
    --text-muted: #7e8299;
    --border-color: #ededed;
    --card-shadow: 0 4px 24px 0 rgba(34, 41, 47, 0.05);
    /* Modern soft shadow */
}

body {
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.93rem;
    color: var(--text-color);
    background-color: var(--body-bg);
    overflow-x: hidden !important;
    zoom: 0.9;
    /* Zoom out effect */
    /*transform: scale(0.9);*/ /* 90% من الحجم الأصلي */
    /*transform-origin: top left;*/ /* يبدأ من أعلى يسار */
    /*width: 111.111%;*/ /* 1 / 0.9 لتعويض الحجم */
    /*height: auto;*/
}


a {
    text-decoration: none;
    color: var(--primary);
    transition: 0.3s;
}

    a:hover {
        color: var(--primary-hover);
        text-decoration: none;
    }

/* ==========================================================================
   Layout Structure
   ========================================================================== */
.main-wrapper {
    width: 100%;
    position: relative;
}

.page-wrapper {
    margin-left: var(--sidebar-width);
    padding-top: var(--header-height);
    position: relative;
    transition: all 0.25s ease-in-out;
    background-color: var(--body-bg);
    min-height: 100vh;
}

.content {
    padding: 30px;
}


/* ==========================================================================
   Sidebar
   ========================================================================== */
/* ==========================================================================
   Sidebar Premium Styling
   ========================================================================== */
.sidebar {
    background-color: #fff;
    border-right: 1px solid var(--border-color);
    bottom: 0;
    left: 0;
    margin-top: 0;
    position: fixed;
    top: var(--header-height);
    /* Below the header logo area */
    width: var(--sidebar-width);
    z-index: 1002;
    transition: all 0.25s ease-in-out;
    display: flex;
    flex-direction: column;
}

.sidebar-inner {
    height: 100%;
    overflow-y: auto;
    padding-bottom: 50px;
}

/* Sidebar Menu */
/* Sidebar Menu - Creative Simple */
.sidebar-menu {
    padding: 20px 15px;
}

    .sidebar-menu ul {
        list-style-type: none;
        margin: 0;
        padding: 0;
    }

        .sidebar-menu ul li {
            margin-bottom: 8px;
            /* More space between items */
        }

    .sidebar-menu .menu-title {
        color: #9aa0a6;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        padding: 12px 15px 5px;
        letter-spacing: 0.8px;
        margin-top: 10px;
        border-bottom: 1px dashed transparent;
        /* Placeholder for potential divider */
    }

    .sidebar-menu li a {
        align-items: center;
        border-radius: 12px;
        /* Soft Pill shape */
        color: #5e6e82;
        /* Professional Slate Grey */
        display: flex;
        padding: 12px 18px;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        font-weight: 500;
        font-size: 15px;
        text-decoration: none;
        position: relative;
        background: transparent;
    }

        /* Hover Effect: Slide & Lighten */
        .sidebar-menu li a:hover {
            color: var(--primary);
            background-color: #f7f9fc;
            transform: translateX(3px);
            /* Gentle slide right */
        }

    /* Active State: Matches Hover with stronger font */
    .sidebar-menu li.active > a {
        color: var(--primary) !important;
        background-color: #f7f9fc !important;
        font-weight: 700;
    }

    .sidebar-menu li a i {
        font-size: 18px;
        margin-right: 14px;
        width: 24px;
        transition: all 0.3s ease;
        opacity: 0.8;
    }

    .sidebar-menu li a:hover i,
    .sidebar-menu li.active > a i {
        opacity: 1;
    }

    /* Submenu Styles */
    .sidebar-menu li.submenu ul {
        background-color: transparent;
        padding-left: 45px;
        /* Deep indent */
        display: none;
        padding-top: 5px;
        padding-bottom: 5px;
        position: relative;
    }

        /* Submenu Left Line Guide */
        .sidebar-menu li.submenu ul:before {
            content: "";
            position: absolute;
            left: 28px;
            /* Align with parent icon center approximately */
            top: 0;
            bottom: 0;
            width: 1px;
            background: #e9ecef;
        }

        .sidebar-menu li.submenu ul li a {
            padding: 8px 15px 8px 0;
            font-size: 14px;
            color: #7987a1;
            background-color: transparent;
            border-radius: 0;
            transform: none;
            white-space: nowrap;
            /* Prevent text wrapping */
            /* No slide for sub-items default */
        }

            /* Submenu Active State - Fix */
            .sidebar-menu li.submenu ul li.active a,
            .sidebar-menu li.submenu ul li a:hover {
                color: var(--primary);
                background-color: rgba(32, 168, 216, 0.08);
                /* Light Highlight background */
                border-radius: 8px;
                /* Rounded pill for subitems too */
                padding-left: 15px;
                /* Little nudge */
                font-weight: 600;
                transform: translateX(5px);
            }


    /* Menu Arrow */
    .sidebar-menu .menu-arrow {
        display: inline-block;
        font-family: 'FontAwesome';
        font-size: 11px;
        margin-left: auto;
        transition: transform 0.3s ease;
        opacity: 0.6;
    }

        .sidebar-menu .menu-arrow:before {
            content: "\f107";
            /* fa-angle-down */
        }

    .sidebar-menu li.submenu a.subdrop .menu-arrow {
        transform: rotate(-180deg);
    }

/* Mini Sidebar (Collapsed) Styling */
.mini-sidebar .sidebar {
    width: 70px;
    /* Slim width */
    overflow: visible;
    /* Allow submenus to pop out if needed, or hide text */
}

.mini-sidebar .sidebar-menu .menu-title,
.mini-sidebar .sidebar-menu li a span,
.mini-sidebar .sidebar-menu .menu-arrow {
    display: none;
    /* Hide text and titles */
}

.mini-sidebar .sidebar-menu li a {
    padding: 15px;
    justify-content: center;
}

    .mini-sidebar .sidebar-menu li a i {
        margin-right: 0;
        font-size: 22px;
    }

/* Mini Sidebar - Page Wrapper Offset */
body.mini-sidebar .page-wrapper {
    margin-left: var(--sidebar-collapsed-width);
    padding-left: 0;
}

/* Sidebar Logo in Mini Mode */
.mini-sidebar .sidebar-logo img {
    width: 40px;
    object-fit: contain;
}






/* ==========================================================================
   Dashboard Cards & Content
   ========================================================================== */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    margin-bottom: 25px;
    background-color: #fff;
    transition: all 0.3s ease;
}



.card-title {
    margin-bottom: 0;
    color: #333;
    font-weight: 600;
    font-size: 16px;
}

.card-body {
    padding: 1.25rem;
}


/* ==========================================================================
   Mini Sidebar State (Toggled Class on Body)
   ========================================================================== */
body.mini-sidebar .sidebar {
    width: var(--sidebar-collapsed-width);
}

/* Header offset is handled by internal header-left width */
body.mini-sidebar .header {
    padding-left: 0;
}

body.mini-sidebar .header-left {
    width: var(--sidebar-collapsed-width);
}

/* Handled in consolidated section above */

body.mini-sidebar .sidebar-logo img {
    width: 30px;
    height: 30px;
}

body.mini-sidebar .sidebar-menu li.menu-title {
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
}

body.mini-sidebar .sidebar-menu li a span {
    display: none;
}

body.mini-sidebar .sidebar-menu li a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

    body.mini-sidebar .sidebar-menu li a i {
        margin-right: 0;
    }

body.mini-sidebar .sidebar-menu li.submenu > a::after {
    display: none;
}

body.mini-sidebar .sidebar-menu ul ul {
    display: none !important;
    /* Force hide submenus in mini mode or show on hover (advanced) */
}

/* Optional: Show submenu on hover for mini sidebar - skipping for Phase 1 MVP */


/* ==========================================================================
   Responsive (Mobile)
   ========================================================================== */
@media (max-width: 991.98px) {
    .sidebar {
        margin-left: -260px;
        /* Hide sidebar offscreen */
    }

    .navbar-header {
        left: 0;
        width: 100%;
    }

    .page-wrapper {
        margin-left: 0;
    }

    /* When Slide Nav (Mobile Open) is active */
    body.slide-nav .sidebar {
        margin-left: 0;
    }
}

/* ==========================================================================
   New Dashboard Widgets (Counters)
   ========================================================================== */
.dash-widget {
    background-color: #fff;
    border-radius: 10px;
    margin-bottom: 24px;
    padding: 20px;
    position: relative;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.dash-widget-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 15px;
    opacity: 0.15;
    /* Background circle opacity */
}

    /* Specific Widget Colors (can be applied to icon bg) */
    .dash-widget-icon.bg-primary {
        background-color: var(--primary);
        color: var(--primary);
        opacity: 1;
        color: #fff;
    }

    .dash-widget-icon.bg-success {
        background-color: var(--success);
        color: #fff;
        opacity: 1;
    }

    .dash-widget-icon.bg-warning {
        background-color: var(--warning);
        color: #fff;
        opacity: 1;
    }

    .dash-widget-icon.bg-danger {
        background-color: var(--danger);
        color: #fff;
        opacity: 1;
    }

    .dash-widget-icon.bg-info {
        background-color: var(--info);
        color: #fff;
        opacity: 1;
    }

.dash-widget-content {
    flex-grow: 1;
}

.dash-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.dash-widget-title {
    font-size: 14px;
    color: #777;
    margin: 0;
    font-weight: 500;
}

.dash-count {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin: 0;
}

/* ==========================================================================
   Chart & Table Containers
   ========================================================================== */


.card-header-actions .btn {
    padding: 4px 10px;
    font-size: 12px;
}

/* ==========================================================================
   Sidebar Badge Styling - "Premium Pill"
   ========================================================================== */
.sidebar-menu li a .badge {
    color: var(--primary);
    /* Primary text */
    background-color: rgba(32, 168, 216, 0.1) !important;
    /* Soft backdrop */
    font-weight: 600;
    font-size: 12px;
    padding: 6px 12px;
    /* Pill padding */
    border-radius: 20px;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    /* Consistent width */
    transition: all 0.3s ease;
}

/* Badge colors are preserved via specific rules in dashboard.css and site.css */

/* ==========================================================================
   Leads Table & Compact Pagination Improvements
   ========================================================================== */

.leads-table-wrapper {
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 12px;
    /* Uniform rounded on all sides for the card look */
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    border: 1px solid #eef2f6;
    min-height: calc(100vh - 200px) !important;
    /* Force it to fill the page height */
    position: relative;
}

    .leads-table-wrapper .table {
        min-width: 1350px !important;
    }

    .leads-table-wrapper .table-responsive {
        flex-grow: 1;
        min-height: auto !important;
        max-height: none !important;
        /* Allow it to collapse if few rows */
    }

    /* Wider Columns for Name and Phone */
    .leads-table-wrapper .table th:nth-child(3),
    .leads-table-wrapper .table td:nth-child(3) {
        min-width: 220px;
        text-align: left !important;
    }

    .leads-table-wrapper .table th:nth-child(4),
    .leads-table-wrapper .table td:nth-child(4) {
        min-width: 200px;
        white-space: nowrap;
    }

/* Handled by global .table-responsive rules */

/* Compact Filter Row for General Search */
.filter-row-compact {
    padding: 15px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.filter-item .form-label-sm {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.filter-item .form-control-sm,
.filter-item .form-select-sm {
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-size: 12.5px;
    background-color: #fff;
}

/* Premium Table Header */
.leads-table-wrapper .table thead th {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
    padding: 16px 12px;
    border-top: none;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

/* Row Hover & Spacing */
.leads-table-wrapper .table tbody tr {
    transition: all 0.2s ease;
}

    .leads-table-wrapper .table tbody tr:hover {
        background-color: #f8fafc !important;
    }

.leads-table-wrapper .table tbody td {
    padding: 14px 12px;
    font-size: 13.5px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

/* Premium Dropdowns (Status & Category) */
.leads-table-wrapper .btn-sm {
    padding: 6px 14px;
    font-weight: 600;
    font-size: 11.5px;
    border-radius: 8px;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.leads-table-wrapper .dropdown-toggle::after {
    margin-left: 8px;
    border-top: 0.35em solid;
    border-right: 0.35em solid transparent;
    border-bottom: 0;
    border-left: 0.35em solid transparent;
}

/* Compact Pagination Row - Made Sticky & Integrated */
.pagination-container-modern {
    background: #fff !important;
    border: none !important;
    border-top: 1px solid #e2e8f0 !important;
    margin: 0 !important;
    padding: 0 15px !important;
    height: 38px !important;
    /* Even more compact */
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-radius: 0 0 12px 12px !important;
    position: sticky;
    bottom: 0;
    z-index: 1001;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05) !important;
    /* Subtler shadow */
}

.pagination-links-compact {
    /* Light background to look like a DIV "inside" */
    padding: 2px 8px;
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.page-info-compact {
    font-size: 11.5px !important;
    color: #64748b !important;
    font-weight: 500 !important;
}

.pagination-links-compact .pagination .page-link {
    width: 24px;
    /* Ultra small */
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-weight: 700;
    font-size: 10.5px;
    padding: 0;
    transition: all 0.2s ease;
    border-radius: 5px !important;
    margin: 0 1px;
    background: #fff;
    border: 1px solid #e2e8f0 !important;
}

    .pagination-links-compact .pagination .page-link:hover {
        background-color: #f1f5f9;
        color: var(--primary);
    }

.pagination-links-compact .pagination .page-item.active .page-link {
    background-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(61, 94, 225, 0.4);
}

.pagination-links-compact .pagination .page-item.disabled .page-link {
    background-color: transparent;
    opacity: 0.3;
    border-color: transparent !important;
    pointer-events: none;
}

/* Pagination Control Refinements */
.pagination-container-modern .btn-sm {
    height: 26px !important;
    padding: 0 12px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    display: flex;
    align-items: center;
}

.pagination-container-modern .form-control-sm,
.pagination-container-modern .form-select-sm {
    height: 26px !important;
    font-size: 12px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.pagination-container-modern .jump-to-compact span,
.pagination-container-modern .size-selector-compact span {
    font-size: 11px !important;
    font-weight: 600 !important;
}

/* Sidebar Toggle Support */
@media (min-width: 992px) {
    .page-wrapper {
        transition: margin-left 0.3s ease;
    }
}

/* Global Support for large data table overflow - Forced internal scroll */
div.table-responsive,
.leads-table-wrapper .table-responsive {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    /* Forces scrollbar ONLY on the table */
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    position: relative !important;
}

.table-responsive .table {
    margin-bottom: 0;
    min-width: 1300px !important;
}

    .table-responsive .table th,
    .table-responsive .table td {
        white-space: nowrap;
        /* Prevent text wrapping to force horizontal scroll when needed */
    }

/* Custom Scrollbar for Table (Wider) */
.table-responsive::-webkit-scrollbar {
    height: 10px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #e2e8f0;
    /* Darker track for better visibility */
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 5px;
    border: 2px solid #f1f5f9;
}

    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }


.required::after {
    content: " *";
    color: red;
    font-weight: bold;
}



/* =========================
   SWEET ALERT PRO THEME
========================= */

.swal2-popup {
    border-radius: 14px !important;
    padding: 2rem !important;
    font-family: 'Segoe UI', Tahoma, sans-serif;
}

.swal2-title {
    font-size: 1.35rem !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
}

.swal2-html-container {
    font-size: 0.95rem !important;
    color: #4b5563 !important;
    line-height: 1.6;
}

/* Buttons */
.swal2-confirm {
    background: linear-gradient(135deg, #0d6efd, #2563eb) !important;
    border-radius: 8px !important;
    padding: 0.5rem 1.4rem !important;
    font-weight: 500 !important;
}

.swal2-cancel {
    background-color: #e5e7eb !important;
    color: #374151 !important;
    border-radius: 8px !important;
    padding: 0.5rem 1.4rem !important;
}

/* Icons */
.swal2-icon {
    margin-top: 0.8rem !important;
}

    .swal2-icon.swal2-warning {
        border-color: #f59e0b !important;
        color: #f59e0b !important;
    }

    .swal2-icon.swal2-success {
        border-color: #10b981 !important;
        color: #10b981 !important;
    }

    .swal2-icon.swal2-error {
        border-color: #ef4444 !important;
        color: #ef4444 !important;
    }

/* Animations */
.swal2-show {
    animation: swalFadeIn 0.25s ease-out;
}

@keyframes swalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* =========================
   Modal
========================= */

.modal-backdrop {
    background-color: rgba(255, 255, 255, 0.3) !important;
    backdrop-filter: blur(1px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    z-index: 1040 !important;
}

    .modal-backdrop.show {
        opacity: 1 !important;
    }

/* تأكيد إن الـ modal فوق الـ backdrop */
.modal {
    z-index: 1050 !important;
}
