@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Outfit:wght@600;700;800&display=swap');

:root {
    --primary: #C62828;
    --primary-dark: #8E0000;
    --primary-light: #FF5F52;
    --accent: #FF8F00;
    --bg: #F8FAFC;
    --card-bg: #FFFFFF;
    --text: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --border-hover: #CBD5E1;
    --success: #16A34A;
    --success-light: #F0FDF4;
    --warning: #EA580C;
    --warning-light: #FFF7ED;
    --info: #2563EB;
    --info-light: #EFF6FF;
    --danger: #DC2626;
    --danger-light: #FEF2F2;
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 76px;
    --header-height: 70px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.03);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ==========================================================================
   1. MODERN CUSTOM SCROLLBARS (احترافي وأنيق بدون الشريط الكلاسيكي)
   ========================================================================== */
* {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 10px;
    transition: var(--transition);
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Dark Sidebar Scrollbar */
.sidebar-menu {
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.sidebar-menu::-webkit-scrollbar {
    width: 5px;
}
.sidebar-menu::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-menu::-webkit-scrollbar-thumb {
    background: #1E293B;
    border-radius: 10px;
}
.sidebar-menu::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

/* Base Body */
body {
    font-family: 'Tajawal', 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--primary-dark);
}

/* App Container */
.app-container {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ==========================================================================
   2. LUXURY DARK SIDEBAR (خلفية احترافية، تمدد وتقلص سلس)
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #111827 0%, #0F172A 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    z-index: 100;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Sidebar Header & Brand */
.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    transition: var(--transition);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #EF4444, #B91C1C);
    color: white;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
    flex-shrink: 0;
}

.sidebar-brand-text {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.sidebar-brand-name {
    font-size: 21px;
    font-weight: 800;
    color: #FFFFFF;
    font-family: 'Outfit', 'Tajawal', sans-serif;
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.sidebar-brand-subtitle {
    font-size: 11px;
    color: #94A3B8;
    font-weight: 600;
    margin-top: 1px;
}

.sidebar-collapse-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94A3B8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
}

/* Sidebar Menu Scrollable Area */
.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-group-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748B;
    text-transform: uppercase;
    padding: 10px 12px 4px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Direct Links */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 9px;
    color: #CBD5E1;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
    white-space: nowrap;
}

.sidebar-link .icon {
    font-size: 17px;
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #FFFFFF;
}
.sidebar-link:hover .icon {
    color: #F87171;
    transform: scale(1.1);
}

.sidebar-link.active {
    background: linear-gradient(135deg, #DC2626, #991B1B);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}
.sidebar-link.active .icon {
    color: #FFFFFF;
}

/* POS Quick Link */
.pos-highlight-link {
    background: linear-gradient(135deg, #EA580C, #C2410C) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3) !important;
}
.pos-highlight-link .icon {
    color: #FFFFFF !important;
}
.pos-highlight-link:hover {
    background: linear-gradient(135deg, #F97316, #EA580C) !important;
    box-shadow: 0 6px 16px rgba(234, 88, 12, 0.4) !important;
    transform: translateY(-1px);
}
.badge-pill {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 12px;
    font-weight: 700;
    margin-right: auto;
}

/* ==========================================================================
   3. ACCORDION / COLLAPSIBLE SUBMENUS (الصفحات الفرعية تظهر وتختفي بسلاسة)
   ========================================================================== */
.sidebar-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 2px;
}

.sidebar-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 9px;
    background: transparent;
    border: none;
    color: #CBD5E1;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: right;
    transition: var(--transition);
    white-space: nowrap;
    user-select: none;
}

.sidebar-group-header .group-icon {
    font-size: 17px;
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94A3B8;
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-group-header .group-title {
    flex: 1;
    text-align: right;
}

.sidebar-group-header .group-arrow {
    font-size: 11px;
    color: #64748B;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.sidebar-group-header:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #FFFFFF;
}
.sidebar-group-header:hover .group-icon {
    color: #F87171;
}

.sidebar-group.open .sidebar-group-header {
    background: rgba(255, 255, 255, 0.05);
    color: #FFFFFF;
}
.sidebar-group.open .sidebar-group-header .group-arrow {
    transform: rotate(180deg);
    color: #F87171;
}

/* Submenu container with smooth height animation */
.sidebar-submenu {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, transform 0.25s ease;
    padding-right: 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-group.open .sidebar-submenu {
    max-height: 380px;
    opacity: 1;
    transform: translateY(0);
    margin-top: 4px;
    margin-bottom: 6px;
}

.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13.5px;
    font-weight: 500;
    color: #94A3B8;
    border-radius: 7px;
    transition: var(--transition);
    white-space: nowrap;
    border-right: 2px solid transparent;
}

.sidebar-sublink .sub-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #475569;
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-sublink:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.05);
    border-right-color: #F87171;
}
.sidebar-sublink:hover .sub-dot {
    background: #F87171;
    transform: scale(1.3);
}

.sidebar-sublink.active {
    color: #FFFFFF;
    background: rgba(220, 38, 38, 0.15);
    border-right-color: #DC2626;
    font-weight: 700;
}
.sidebar-sublink.active .sub-dot {
    background: #DC2626;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.6);
}

/* ==========================================================================
   4. CLEAN LOGOUT FOOTER (زر تسجيل الخروج الاحترافي بدون Profile)
   ========================================================================== */
.sidebar-footer-clean {
    padding: 14px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(11, 15, 25, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: 9px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #F87171;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.sidebar-logout-btn:hover {
    background: #DC2626;
    color: #FFFFFF;
    border-color: #DC2626;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
    transform: translateY(-1px);
}

/* ==========================================================================
   5. COLLAPSED STATE (حالة الشريط المتقلص 76px)
   ========================================================================== */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .main-wrapper {
    margin-right: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
    max-width: calc(100% - var(--sidebar-collapsed-width));
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-collapse-btn,
body.sidebar-collapsed .group-title,
body.sidebar-collapsed .group-arrow,
body.sidebar-collapsed .link-text,
body.sidebar-collapsed .badge-pill,
body.sidebar-collapsed .sidebar-group-label,
body.sidebar-collapsed .sidebar-submenu,
body.sidebar-collapsed .logout-btn-text {
    display: none !important;
}

body.sidebar-collapsed .sidebar-header {
    padding: 0 10px;
    justify-content: center;
}

body.sidebar-collapsed .sidebar-menu {
    padding: 14px 8px;
}

body.sidebar-collapsed .sidebar-link,
body.sidebar-collapsed .sidebar-group-header {
    justify-content: center;
    padding: 12px;
    gap: 0;
}

body.sidebar-collapsed .sidebar-link .icon,
body.sidebar-collapsed .sidebar-group-header .group-icon {
    font-size: 19px;
    width: auto;
    margin: 0;
}

body.sidebar-collapsed .sidebar-footer-clean {
    padding: 12px 8px;
}

body.sidebar-collapsed .sidebar-logout-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 10px;
    margin: 0 auto;
}

/* ==========================================================================
   6. MAIN CONTENT & TOPBAR
   ========================================================================== */
.main-wrapper {
    flex: 1;
    margin-right: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1), max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--bg);
    overflow-x: hidden;
}

.top-header {
    height: var(--header-height);
    background: #FFFFFF;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: #F8FAFC;
    border: 1px solid var(--border);
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
}
.topbar-toggle-btn:hover {
    background: #F1F5F9;
    color: #0F172A;
    border-color: #CBD5E1;
}

.cloud-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ECFDF5;
    color: #059669;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #A7F3D0;
}
.cloud-pulse {
    width: 8px;
    height: 8px;
    background: #059669;
    border-radius: 50%;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

.date-badge {
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #F8FAFC;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* User Profile Navbar Trigger & Dropdown */
.header-profile-wrapper {
    position: relative;
}

.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 14px 5px 6px;
    background: #F8FAFC;
    border: 1.5px solid #E2E8F0;
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    outline: none;
}

.user-profile-trigger:hover,
.user-profile-trigger.active {
    background: #F1F5F9;
    border-color: #CBD5E1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.profile-avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 2px solid #E2E8F0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    padding: 2px;
}

.avatar-online-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 10px;
    height: 10px;
    background: #16A34A;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
}

.profile-user-info {
    display: flex;
    flex-direction: column;
    text-align: right;
    line-height: 1.25;
}

.profile-user-name {
    font-size: 13.5px;
    font-weight: 800;
    color: #0F172A;
    white-space: nowrap;
}

.profile-user-role {
    font-size: 11px;
    font-weight: 600;
    color: #64748B;
    white-space: nowrap;
}

.profile-chevron-icon {
    font-size: 11px;
    color: #94A3B8;
    margin-right: 4px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-profile-trigger.active .profile-chevron-icon {
    transform: rotate(180deg);
    color: #0284C7;
}

/* Luxury Profile Dropdown */
.user-profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 310px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 18px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.16), 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.user-profile-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.content-body {
    padding: 24px 28px;
    flex: 1;
}

/* ==========================================================================
   7. BUTTONS, CARDS & UI COMPONENTS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 10px rgba(198, 40, 40, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #B71C1C, #7F0000);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(198, 40, 40, 0.35);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #E65100);
    color: white;
    box-shadow: 0 4px 10px rgba(255, 143, 0, 0.25);
}
.btn-accent:hover {
    background: #E65100;
    color: white;
}

.btn-secondary {
    background: #F1F5F9;
    color: #475569;
}
.btn-secondary:hover {
    background: #E2E8F0;
    color: #1E293B;
}

.btn-danger {
    background: #FEE2E2;
    color: #DC2626;
}
.btn-danger:hover {
    background: #DC2626;
    color: white;
}

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

.btn-lg {
    padding: 13px 26px;
    font-size: 15.5px;
    border-radius: var(--radius);
}

/* Cards & Layout */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
    transition: var(--transition);
}
.card:hover {
    box-shadow: var(--shadow-md);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

/* Stat Cards */
.stat-card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon-wrapper {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon-red { background: #FFEBEE; color: #C62828; }
.stat-icon-orange { background: #FFF3E0; color: #EF6C00; }
.stat-icon-green { background: #E8F5E9; color: #2E7D32; }
.stat-icon-blue { background: #E3F2FD; color: #1565C0; }
.stat-icon-purple { background: #F3E5F5; color: #7B1FA2; }
.stat-icon-teal { background: #E0F2F1; color: #00897B; }

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    margin-top: 4px;
}
.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Custom Table (Unified Brand Header & Contrasting Column Text) */
.table-container {
    background: #FFFFFF;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
}

.custom-table thead th,
.custom-table th,
table.custom-table thead th,
table thead th {
    background: #0F172A !important;
    color: #FFFFFF !important;
    font-size: 13.5px;
    font-weight: 800;
    padding: 14px 18px;
    border-bottom: 2px solid #1E293B;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.custom-table thead th i,
.custom-table th i {
    color: #38BDF8;
    margin-left: 5px;
}

.custom-table td {
    padding: 13px 18px;
    font-size: 14px;
    border-bottom: 1px solid #F1F5F9;
    color: #1E293B;
    vertical-align: middle;
}

.custom-table tr:hover td {
    background: #F8FAFC;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: #F1F5F9; color: #475569; }

/* Form Controls */
.form-group {
    margin-bottom: 18px;
}
.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 14px;
    background: #FAFAFA;
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

/* ==========================================================================
   8. PRO POS TERMINAL (تصميم كلاسيكي احترافي مطابق لطلب المستخدم)
   ========================================================================== */
.pos-layout-wrapper {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 20px;
    height: calc(100vh - var(--header-height) - 48px);
}

/* --- Left / Cart Side --- */
.pos-cart-section {
    background: #FFFFFF;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.pos-cart-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: #FFFFFF;
}

.pos-customer-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.pos-search-bar {
    position: relative;
}
.pos-search-bar input {
    width: 100%;
    padding: 11px 40px 11px 14px;
    border-radius: 9px;
    border: 1.5px solid var(--border);
    background: #F8FAFC;
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 600;
    transition: var(--transition);
}
.pos-search-bar input:focus {
    outline: none;
    border-color: #2563EB;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.pos-search-bar .search-icon {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: #94A3B8;
    font-size: 14px;
}

.pos-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.cart-item-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #F1F5F9;
    gap: 10px;
    transition: background 0.15s ease;
}
.cart-item-row:hover {
    background: #F8FAFC;
}

.cart-item-index {
    font-size: 13px;
    font-weight: 700;
    color: #94A3B8;
    width: 20px;
    text-align: center;
}

.cart-item-info {
    flex: 1;
    overflow: hidden;
}
.cart-item-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}
.cart-item-stock-tag {
    font-size: 11.5px;
    color: #64748B;
    margin-top: 2px;
}

.cart-qty-ctrl {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #F1F5F9;
    border-radius: 8px;
    padding: 2px 4px;
    border: 1px solid #E2E8F0;
}
.cart-qty-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    color: #1E293B;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}
.cart-qty-btn:hover {
    background: #E2E8F0;
}
.cart-qty-input {
    width: 44px;
    text-align: center;
    font-size: 13.5px;
    font-weight: 700;
    border: none;
    background: transparent;
    color: #1E293B;
}
.cart-qty-input:focus {
    outline: none;
}

.cart-price-input {
    width: 68px;
    padding: 4px 6px;
    border-radius: 6px;
    border: 1px solid #CBD5E1;
    font-size: 13px;
    font-weight: 700;
    color: #1E293B;
    text-align: center;
    background: #FFFFFF;
}
.cart-price-input:focus {
    outline: none;
    border-color: #2563EB;
}

.cart-item-total {
    font-size: 14px;
    font-weight: 800;
    color: #1E293B;
    min-width: 60px;
    text-align: left;
}

.cart-item-del {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: #EFF6FF;
    border: 1px solid #BFDBFE;
    color: #2563EB;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: var(--transition);
}
.cart-item-del:hover {
    background: #FEE2E2;
    border-color: #FCA5A5;
    color: #DC2626;
}

.pos-cart-footer {
    padding: 16px 18px;
    border-top: 1px solid var(--border);
    background: #FFFFFF;
}

.pos-grand-total-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #E2E8F0;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 12px;
}
.pos-grand-total-label {
    font-size: 16px;
    font-weight: 800;
    color: #1E293B;
}
.pos-grand-total-val {
    font-size: 22px;
    font-weight: 900;
    color: #0F172A;
}

.btn-pay-now {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0284C7, #0369A1);
    color: #FFFFFF;
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
    transition: var(--transition);
}
.btn-pay-now:hover {
    background: linear-gradient(135deg, #0369A1, #075985);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.45);
}

/* --- Right / Products Catalog Side --- */
.pos-catalog-section {
    background: #FFFFFF;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    padding: 16px 20px;
}

/* Horizontal Category Slider */
.pos-category-slider {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.category-tab-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    padding: 10px 8px;
    background: #FFFFFF;
    border: 1.5px solid #E2E8F0;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    text-align: center;
}
.category-tab-card:hover {
    border-color: #0284C7;
    background: #F0F9FF;
    transform: translateY(-2px);
}
.category-tab-card.active {
    border-color: #0284C7;
    background: #F0F9FF;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
}

.category-tab-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    object-fit: contain;
    margin-bottom: 6px;
}

.category-tab-title {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    white-space: nowrap;
}
.category-tab-card.active .category-tab-title {
    color: #0284C7;
}

/* 4 Products per row Grid */
.pos-product-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    overflow-y: auto;
    flex: 1;
    padding-right: 4px;
}

.product-item-card-pro {
    background: #FFFFFF;
    border: 1.5px solid #E2E8F0;
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    transition: all 0.25s ease;
}
.product-item-card-pro:hover {
    border-color: #0284C7;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-3px);
}

.product-item-card-pro.is-added {
    border-color: #16A34A;
    background: #F0FDF4;
}

.product-stock-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 12px;
    font-weight: 800;
    color: #0284C7;
    background: #F0F9FF;
    padding: 2px 8px;
    border-radius: 8px;
    border: 1px solid #BAE6FD;
}

.product-image-container {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 12px 0;
}
.product-image-container img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    transition: transform 0.25s ease;
}
.product-item-card-pro:hover .product-image-container img {
    transform: scale(1.06);
}

.product-info-bottom {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.product-name-full {
    font-size: 13.5px;
    font-weight: 700;
    color: #1E293B;
    line-height: 1.3;
    min-height: 36px;
}

.product-price-and-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}
.product-price-dh {
    font-size: 16px;
    font-weight: 800;
    color: #0F172A;
}

.product-added-chip {
    font-size: 11px;
    font-weight: 700;
    color: #FFFFFF;
    background: #16A34A;
    padding: 3px 8px;
    border-radius: 6px;
}

/* Modal Styling */
.pos-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px 16px;
    overflow-y: auto;
}
.pos-modal-overlay.active {
    display: flex;
}
.pos-modal-box {
    background: #FFFFFF;
    border-radius: 18px;
    width: 100%;
    max-width: 680px;
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    margin: auto;
    border: 1px solid rgba(226, 232, 240, 0.9);
}
.pos-modal-header {
    padding: 14px 22px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.pos-modal-body {
    padding: 18px 22px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100vh - 160px);
}
.pos-modal-footer {
    padding: 14px 22px;
    background: #F8FAFC;
    border-top: 1px solid #E2E8F0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

/* Print Invoice */
@media print {
    .sidebar, .top-header, .no-print {
        display: none !important;
    }
    .main-wrapper {
        margin-right: 0 !important;
    }
    .content-body {
        padding: 0 !important;
    }
    body {
        background: white !important;
    }
}

/* ==========================================================================
   9. TOP TOAST & NOTIFICATION SYSTEM (نظام الإشعارات والتنبيهات الاحترافي في الأعلى)
   ========================================================================== */
.toast-container-top {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    width: 100%;
    max-width: 480px;
    padding: 0 16px;
}

.tassire-toast-item {
    pointer-events: auto;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px 14px 16px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 14px;
    box-shadow: 0 18px 40px -8px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    animation: toastSlideDown 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: all 0.25s ease;
    font-family: inherit;
    direction: rtl;
    text-align: right;
}

.tassire-toast-item:hover {
    box-shadow: 0 22px 48px -6px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.tassire-toast-item.toast-closing {
    animation: toastSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Accent Strip */
.toast-accent-pill {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    border-radius: 0 14px 14px 0;
}

/* Icon Box */
.toast-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Content */
.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 14.5px;
    font-weight: 800;
    color: #0F172A;
    line-height: 1.3;
    margin-bottom: 3px;
}

.toast-message {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    line-height: 1.45;
    word-break: break-word;
}

/* Close Button */
.toast-close-btn {
    background: transparent;
    border: none;
    color: #94A3B8;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
    transition: var(--transition);
}
.toast-close-btn:hover {
    background: #F1F5F9;
    color: #334155;
}

/* Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0.85;
    transform-origin: left;
    animation: toastProgress linear forwards;
}

/* Variants */
.toast-success .toast-accent-pill { background: linear-gradient(180deg, #10B981, #059669); }
.toast-success .toast-icon-box { background: #ECFDF5; color: #059669; border: 1px solid #A7F3D0; }
.toast-success .toast-progress { background: #10B981; }

.toast-error .toast-accent-pill { background: linear-gradient(180deg, #EF4444, #DC2626); }
.toast-error .toast-icon-box { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.toast-error .toast-progress { background: #EF4444; }

.toast-warning .toast-accent-pill { background: linear-gradient(180deg, #F59E0B, #D97706); }
.toast-warning .toast-icon-box { background: #FFFBEB; color: #D97706; border: 1px solid #FDE68A; }
.toast-warning .toast-progress { background: #F59E0B; }

.toast-info .toast-accent-pill { background: linear-gradient(180deg, #0284C7, #0369A1); }
.toast-info .toast-icon-box { background: #EFF6FF; color: #0284C7; border: 1px solid #BFDBFE; }
.toast-info .toast-progress { background: #0284C7; }

/* Keyframes */
@keyframes toastSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-28px) scale(0.92);
    }
    60% {
        transform: translateY(3px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-24px) scale(0.92);
    }
}

@keyframes toastProgress {
    0% {
        width: 100%;
    }
    100% {
        width: 0%;
    }
}

/* ==========================================================================
   14. LUXURY TABLE & HORIZONTAL SCROLLING
   ========================================================================== */
.table-container {
    background: #FFFFFF;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    margin-bottom: 24px;
    position: relative;
}

.table-container::-webkit-scrollbar {
    height: 8px;
}
.table-container::-webkit-scrollbar-track {
    background: #F1F5F9;
    border-radius: 4px;
}
.table-container::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
    transition: background 0.2s;
}
.table-container::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.custom-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: separate;
    border-spacing: 0;
    text-align: right;
    font-size: 14px;
}

.custom-table thead th,
.custom-table th {
    background: #0F172A !important;
    color: #FFFFFF !important;
    font-weight: 800;
    font-size: 13.5px;
    padding: 14px 18px;
    border-bottom: 2px solid #1E293B;
    white-space: nowrap;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.custom-table thead tr th:first-child {
    border-top-right-radius: 12px;
}

.custom-table thead tr th:last-child {
    border-top-left-radius: 12px;
}

.custom-table thead th i,
.custom-table th i {
    color: #38BDF8 !important;
    margin-left: 6px;
    font-size: 13px;
}

.custom-table tbody tr {
    transition: background 0.15s ease;
}

.custom-table tbody tr:hover {
    background: #F8FAFC;
}

.custom-table tbody td {
    padding: 13px 18px;
    border-bottom: 1px solid #F1F5F9;
    color: #1E293B;
    vertical-align: middle;
    white-space: nowrap;
}

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

/* ==========================================================================
   15. SEARCHABLE SELECT DROPDOWN COMPONENT (تصنيف ووحدة القياس بالبحث)
   ========================================================================== */
.searchable-select {
    position: relative;
    user-select: none;
    width: 100%;
}

.searchable-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #FFFFFF;
    border: 1.5px solid #CBD5E1;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: #1E293B;
    cursor: pointer;
    transition: all 0.2s ease;
}

.searchable-select-trigger:hover {
    border-color: #94A3B8;
}

.searchable-select.active .searchable-select-trigger {
    border-color: #0284C7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.searchable-select-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.15);
    z-index: 1050;
    overflow: hidden;
    animation: selectMenuFade 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.searchable-select.active .searchable-select-dropdown {
    display: block;
}

@keyframes selectMenuFade {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.searchable-select-search-box {
    padding: 10px 12px;
    background: #F8FAFC;
    border-bottom: 1px solid #E2E8F0;
    position: relative;
}

.searchable-select-search-input {
    width: 100%;
    padding: 8px 34px 8px 12px;
    border-radius: 8px;
    border: 1px solid #CBD5E1;
    background: #FFFFFF;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.searchable-select-search-input:focus {
    border-color: #0284C7;
}

.searchable-select-search-icon {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
    font-size: 12px;
    pointer-events: none;
}

.searchable-select-options {
    max-height: 220px;
    overflow-y: auto;
    padding: 6px 0;
}

.searchable-select-option {
    padding: 9px 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s;
}

.searchable-select-option:hover {
    background: #F0F9FF;
    color: #0284C7;
}

.searchable-select-option.selected {
    background: #EFF6FF;
    color: #0284C7;
    font-weight: 700;
}

.searchable-select-no-results {
    padding: 16px;
    text-align: center;
    color: #94A3B8;
    font-size: 13px;
    font-weight: 600;
}

/* Universal Form Controls & Inputs */
input, select, textarea, button {
    font-family: 'Tajawal', 'Outfit', sans-serif;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    font-family: 'Tajawal', sans-serif;
    font-size: 13.5px;
    color: #1e293b;
    background-color: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

select.form-control {
    appearance: auto;
    -webkit-appearance: menulist;
}

