/* c:\mynewapp\frontend-pwa\css\components.css */

/* Top Navigation Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-accent);
  margin: 0;
}

 /* Glassmorphism Utilities */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
  color: #f8fafc;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Neon Glassmorphism Panels */
.neon-glass-panel {
  background: var(--glass-bg); /* Dark base for neon */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  color: var(--text-primary);
}

/* Neon Borders & Glows */
.neon-border-primary { border: 1px solid rgba(56, 189, 248, 0.4); box-shadow: 0 0 15px rgba(56, 189, 248, 0.2), inset 0 0 10px rgba(56, 189, 248, 0.1); }
.neon-border-success { border: 1px solid rgba(52, 211, 153, 0.4); box-shadow: 0 0 15px rgba(52, 211, 153, 0.2), inset 0 0 10px rgba(52, 211, 153, 0.1); }
.neon-border-warning { border: 1px solid rgba(245, 158, 11, 0.4); box-shadow: 0 0 15px rgba(245, 158, 11, 0.2), inset 0 0 10px rgba(245, 158, 11, 0.1); }
.neon-border-danger  { border: 1px solid rgba(248, 113, 113, 0.4); box-shadow: 0 0 15px rgba(248, 113, 113, 0.2), inset 0 0 10px rgba(248, 113, 113, 0.1); }
.neon-border-purple  { border: 1px solid rgba(192, 132, 252, 0.4); box-shadow: 0 0 15px rgba(192, 132, 252, 0.2), inset 0 0 10px rgba(192, 132, 252, 0.1); }

/* Glow Text */
.neon-text-primary { color: #38bdf8; text-shadow: 0 0 8px rgba(56, 189, 248, 0.8); }
.neon-text-success { color: #34d399; text-shadow: 0 0 8px rgba(52, 211, 153, 0.8); }
.neon-text-warning { color: #fbbf24; text-shadow: 0 0 8px rgba(251, 191, 36, 0.8); }
.neon-text-danger  { color: #f87171; text-shadow: 0 0 8px rgba(248, 113, 113, 0.8); }
.neon-text-purple  { color: #c084fc; text-shadow: 0 0 8px rgba(192, 132, 252, 0.8); }

.theme-toggle-btn {
  background: var(--surface-color);
  border: none;
  padding: 10px;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  color: var(--text-primary);
}

/* Dynamic Cloud Ad Banner */
.ad-banner-container {
  padding: 0 20px;
  margin-bottom: 20px;
}
.ad-banner {
  width: 100%;
  height: 120px;
  border-radius: var(--border-radius);
  background: linear-gradient(135deg, var(--primary-accent), #38bdf8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 1.2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

/* Dashboard Action Grid - No Scroll, Fit Screen */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* Default 3 columns for mobile */
  gap: 12px;
  padding: 0 15px;
  /* Make sure it fits the remaining viewport height without scrolling */
  height: calc(100vh - 220px); 
  align-content: start;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: repeat(4, 1fr); /* 4 columns for tablets/desktop */
    gap: 20px;
    height: calc(100vh - 200px);
  }
}

.action-card {
  padding: 10px 5px;
  text-align: center;
  border-radius: 18px; 
  text-decoration: none;
  color: white; /* Changed to white for better contrast with gradients */
  font-weight: 800;
  font-size: 0.8rem; 
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy hover transition */
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  position: relative;
  overflow: hidden;
  /* Default dark gradient, but we will override per module */
  background: linear-gradient(135deg, #1e293b, #0f172a); 
}

/* Sophisticated Hover Effects */
.action-card:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 15px 25px rgba(0,0,0,0.2);
  z-index: 10;
  border-color: rgba(255,255,255,0.3);
}

.action-card::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  transition: all 0.5s;
}

.action-card:hover::before {
  left: 150%;
}

.action-card:active {
  transform: scale(0.95);
  box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}

.action-icon {
  font-size: 2.2rem; /* Slightly smaller to prevent scrolling */
  color: white; /* Icons should be white to contrast with the vibrant card backgrounds */
  margin-bottom: 2px;
  filter: drop-shadow(0px 4px 6px rgba(0,0,0,0.2));
  transition: transform 0.3s ease;
}

.action-card:hover .action-icon {
  transform: scale(1.15) rotate(5deg);
}

/* Professional Gradients for each specific module */
.module-cash { background: linear-gradient(135deg, #10b981, #059669); } /* Green */
.module-payment { background: linear-gradient(135deg, #f43f5e, #e11d48); } /* Rose/Red */
.module-inventory { background: linear-gradient(135deg, #8b5cf6, #7c3aed); } /* Violet */
.module-sales { background: linear-gradient(135deg, #3b82f6, #2563eb); } /* Blue */
.module-statement { background: linear-gradient(135deg, #64748b, #475569); } /* Slate */
.module-purchase { background: linear-gradient(135deg, #f59e0b, #d97706); } /* Amber */
.module-analytics { background: linear-gradient(135deg, #0ea5e9, #0284c7); } /* Light Blue */
.module-audit { background: linear-gradient(135deg, #334155, #1e293b); } /* Dark Slate */
.module-partners { background: linear-gradient(135deg, #14b8a6, #0d9488); } /* Teal */
.module-payroll { background: linear-gradient(135deg, #a855f7, #9333ea); } /* Purple */
.module-settings { background: linear-gradient(135deg, #94a3b8, #64748b); } /* Gray */


/* Layout Modifiers */
.dashboard-grid.layout-list { grid-template-columns: 1fr; }
.dashboard-grid.layout-list .action-card {
  flex-direction: row; justify-content: flex-start; padding: 15px 20px; gap: 20px; font-size: 1.1rem; text-align: right; border-radius: 12px;
}
.dashboard-grid.layout-list .action-icon { margin-bottom: 0; font-size: 2rem; }

.dashboard-grid.layout-compact { grid-template-columns: repeat(4, 1fr); gap: 10px; }
.dashboard-grid.layout-compact .action-card { padding: 10px 2px; border-radius: 12px; font-size: 0.65rem; }
.dashboard-grid.layout-compact .action-icon { font-size: 1.8rem; }

.dashboard-grid.layout-large { grid-template-columns: repeat(2, 1fr); gap: 20px; }
.dashboard-grid.layout-large .action-card { padding: 30px 10px; font-size: 1.1rem; border-radius: 24px; }
.dashboard-grid.layout-large .action-icon { font-size: 3.5rem; margin-bottom: 10px; }

.dashboard-grid.layout-metro { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 2px; }
.dashboard-grid.layout-metro .action-card { border-radius: 0 !important; border: none; }
.dashboard-grid.layout-metro .action-card.module-workflow { grid-column: span 100%; }

/* Shape Modifiers */
.action-card.shape-square { border-radius: 8px; }
.action-card.shape-circle { border-radius: 50%; aspect-ratio: 1/1; justify-content: center; padding: 5px; }

/* Prevent banners from breaking when shapes change */
.action-card.module-workflow {
  aspect-ratio: auto !important;
  border-radius: 18px !important;
}

/* One-Handed Workflow Layout (Cash Receipt) */
.one-handed-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.display-area {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 40px;
}

.amount-display {
  font-size: 3.5rem;
  font-weight: 900;
  text-align: right;
  color: var(--primary-accent);
  margin: 0;
  word-break: break-all;
}

.amount-label {
  text-align: right;
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 5px;
}

/* Bottom Numpad (Optimized for Thumbs) */
.bottom-sheet {
  background: var(--surface-color);
  padding: 20px;
  border-radius: 30px 30px 0 0;
  box-shadow: 0 -10px 20px rgba(0,0,0,0.05);
}

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

.numpad-btn {
  background: var(--bg-color);
  border: none;
  border-radius: 15px;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 20px 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.numpad-btn:active {
  background: var(--glass-border);
}

.action-row {
  display: flex;
  gap: 15px;
}

.btn-primary {
  flex: 2;
  background: var(--primary-accent);
  color: white;
  border: none;
  padding: 20px;
  border-radius: 15px;
  font-size: 1.2rem;
  font-weight: bold;
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.btn-secondary {
  flex: 1;
  background: var(--danger-color);
  color: white;
  border: none;
  padding: 20px;
  border-radius: 15px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
}

/* =========================================================
   Professional Executive Dashboard (dashboard-pro.html)
   ========================================================= */

.pro-dashboard-body {
    display: flex;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-base);
}

/* Sidebar */
.pro-sidebar {
    width: 260px;
    background: var(--surface-color);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

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

.sidebar-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header .brand-title {
    font-size: 1.2rem;
    white-space: nowrap;
}

.pro-sidebar.collapsed .brand-title {
    display: none;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.sidebar-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border-right: 4px solid transparent;
}

.sidebar-menu a:hover, .sidebar-menu li.active a {
    background: rgba(15, 76, 129, 0.05); /* very light primary */
    color: var(--primary-accent);
    border-right-color: var(--primary-accent);
}

.sidebar-menu .icon {
    font-size: 1.3rem;
    margin-left: 15px;
}

.pro-sidebar.collapsed .text {
    display: none;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    background: none;
    border: none;
    color: var(--danger-color);
    font-weight: bold;
    cursor: pointer;
    padding: 10px 0;
}

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

/* Sidebar Submenu */
.sidebar-menu .has-submenu {
    position: relative;
}

.sidebar-menu .submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background: rgba(0,0,0,0.02);
    border-radius: 8px;
    margin-right: 15px;
    margin-left: 15px;
}

.sidebar-menu .submenu.open {
    display: block;
    animation: fadeInSlideDown 0.3s ease-out forwards;
}

.sidebar-menu .submenu a {
    padding: 10px 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: none;
}

.sidebar-menu .submenu a:hover {
    background: rgba(15, 76, 129, 0.05);
    color: var(--primary-accent);
}

.sidebar-menu .arrow {
    margin-right: auto;
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.sidebar-menu .has-submenu.open .arrow {
    transform: rotate(180deg);
}

@keyframes fadeInSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Main Content Area */
.pro-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: all 0.3s ease;
}

/* Header */
.pro-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 99;
}

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

.menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px 12px 40px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: var(--surface-color);
    color: var(--text-primary);
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.search-box .search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    position: relative;
}

.icon-btn .badge {
    position: absolute;
    top: -5px;
    right: -8px;
    background: var(--danger-color);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name { font-weight: bold; font-size: 0.9rem; }
.user-role { font-size: 0.75rem; color: var(--text-secondary); }

/* Dashboard Wrapper */
.dashboard-wrapper {
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.dashboard-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 30px;
}

.page-title {
    margin: 0 0 5px 0;
    font-size: 1.8rem;
    color: var(--text-primary);
}

.page-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.quick-actions-bar {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    text-decoration: none;
    color: white;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}

.btn-action:hover { transform: translateY(-2px); }
.btn-primary { background: var(--primary-accent); }
.btn-success { background: var(--success-color); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; border-radius: 5px; color: white; border: none; cursor: pointer;}

/* KPI Grid */
.kpi-grid-pro {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    padding: 20px;
    border-radius: 16px;
    border-right: 4px solid transparent; /* Arabic RTL */
}

.border-primary { border-right-color: var(--primary-accent); }
.border-success { border-right-color: var(--success-color); }
.border-warning { border-right-color: #f59e0b; }
.border-danger { border-right-color: var(--danger-color); }

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.kpi-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}
.bg-primary { background: var(--primary-accent); }
.bg-success { background: var(--success-color); }
.bg-warning { background: #f59e0b; }
.bg-danger { background: var(--danger-color); }

.kpi-value {
    margin: 0 0 5px 0;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-primary);
}

.kpi-trend {
    font-size: 0.8rem;
    font-weight: 600;
}
.positive { color: var(--success-color); }
.negative { color: var(--danger-color); }
.neutral { color: var(--text-secondary); }

/* Charts Grid */
.charts-grid-pro {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    padding: 20px;
    border-radius: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
}

.filter-select {
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: var(--surface-color);
    color: var(--text-primary);
}

/* Bottom Grid */
.bottom-grid-pro {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.table-card, .list-card {
    padding: 20px;
    border-radius: 16px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--primary-accent);
    font-weight: bold;
    cursor: pointer;
}

.table-responsive {
    overflow-x: auto;
}

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

.pro-table th {
    text-align: right;
    padding: 12px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--glass-border);
    font-weight: 600;
    position: relative; /* For column resizers */
}

/* Global Table Column Resizers */
.resizer {
    position: absolute;
    left: -4px;
    top: 0;
    bottom: 0;
    width: 10px;
    cursor: col-resize;
    background: transparent;
    z-index: 10;
    user-select: none;
}
.resizer:hover, .resizer.resizing {
    background: var(--primary-accent, #3b82f6);
    opacity: 0.8;
}

/* Dual-Side Resizer Handles */
.resize-handle-left, .resize-handle-right {
    position: absolute;
    top: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
    transition: all 0.2s;
    background: transparent;
    user-select: none;
}
.resize-handle-left {
    left: 0;
    border-left: 2px solid rgba(255, 255, 255, 0.15);
}
.resize-handle-right {
    right: 0;
    border-right: 2px solid rgba(255, 255, 255, 0.15);
}
.resize-handle-left:hover, .resize-handle-left:active,
.resize-handle-right:hover, .resize-handle-right:active {
    background: var(--primary-accent, #3b82f6);
    opacity: 0.8;
}

.pro-table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-weight: 500;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
}
.badge-success { background: rgba(1, 135, 134, 0.1); color: var(--success-color); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge-danger { background: rgba(197, 42, 26, 0.1); color: var(--danger-color); }

/* Pro List */
.pro-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--glass-border);
}
.list-item:last-child { border-bottom: none; }

.item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    margin-left: 15px;
}

.item-info {
    flex: 1;
}

.item-info h4 {
    margin: 0 0 4px 0;
    font-size: 0.95rem;
}

.item-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 992px) {
    .charts-grid-pro, .bottom-grid-pro {
        grid-template-columns: 1fr;
    }
    
    .pro-sidebar {
        position: fixed;
        height: 100%;
        left: -260px; /* Hidden by default on small screens */
    }
    
    .pro-sidebar.expanded {
        left: 0;
    }
    
    .menu-btn { display: block; }
    
    .search-box { display: none; }
    
    .user-info { display: none; }
}

@media (max-width: 768px) {
    .dashboard-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* Neon Inputs & Forms */
.select-input, .text-input, input[type='text'], input[type='number'], input[type='password'], input[type='date'], .modern-context-menu {
    background: var(--surface-color) !important;
    color: var(--text-primary) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;
    padding: 12px 15px;
    font-family: var(--font-base);
    transition: all 0.3s ease;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.select-input:focus, .text-input:focus, input[type='text']:focus, input[type='number']:focus, input[type='password']:focus, input[type='date']:focus, textarea:focus {
    border-color: #38bdf8 !important;
    box-shadow: 0 0 15px rgba(56, 189, 248, 0.3), inset 0 0 5px rgba(56, 189, 248, 0.2) !important;
    background: var(--surface-active) !important;
}

.label, label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary) !important;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Scrollbar formatting for WebKit */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-color); }
::-webkit-scrollbar-thumb { background: rgba(56, 189, 248, 0.5); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(56, 189, 248, 0.8); }

/* ═══════════════════════════════════════════════════════
   GLOBAL SMART SIDEBAR — Clean RTL Flexbox Design
   ═══════════════════════════════════════════════════════ */

:root {
    --sb-collapsed: 62px;
    --sb-expanded:  240px;
    --sb-bg:        rgba(5, 7, 16, 0.97);
    --sb-border:    rgba(56, 189, 248, 0.15);
    --sb-item-h:    52px;
}

body.has-sidebar {
    margin-right: var(--sb-collapsed) !important;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Ensure content never scrolls behind the sidebar */
    overflow-x: hidden;
}
body.has-sidebar.sidebar-open {
    margin-right: var(--sb-expanded) !important;
}

/* Prevent ANY element from accidentally going behind the sidebar */
body.has-sidebar > *:not(.global-sidebar) {
    max-width: 100%;
    box-sizing: border-box;
}

/* ── Sidebar Container ── */
.global-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sb-collapsed);
    height: 100vh;
    background: var(--sb-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--sb-border);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 30px rgba(0,0,0,0.7);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* NO overflow, NO direction hack - icon is absolute positioned */
}

.global-sidebar:hover {
    width: var(--sb-expanded);
    border-left-color: rgba(56, 189, 248, 0.35);
}

/* ── Header ── */
.sidebar-header {
    position: relative;
    height: 64px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Logo icon: always at far right */
.sidebar-logo-icon {
    position: absolute;
    right: 0;
    top: 0;
    width: var(--sb-collapsed);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px rgba(56,189,248,0.8));
    z-index: 1;
}

.sidebar-logo-text {
    font-size: 1rem;
    font-weight: 800;
    color: #e2e8f0;
    padding-right: 10px;
    opacity: 0;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: max-width 0.3s ease, opacity 0.2s ease;
}

.global-sidebar:hover .sidebar-logo-text {
    max-width: 180px;
    opacity: 1;
    transition-delay: 0.05s;
}

/* ── Nav ── */
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Hide scrollbar for sidebar nav */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* ── Items ── */
.sidebar-item {
    position: relative;   /* anchor for absolute icon */
    display: block;
    height: var(--sb-item-h);
    text-decoration: none;
    color: rgba(203, 213, 225, 0.85);
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.04);
    color: #fff;
}

.sidebar-item.active {
    background: rgba(56,189,248,0.08);
    color: #fff;
    font-weight: 600;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: #38bdf8;
    box-shadow: 0 0 10px #38bdf8;
}

/* ── ICON: ALWAYS at far right, zero gap ── */
.sidebar-icon {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: var(--sb-collapsed);
    height: var(--sb-item-h);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.sidebar-item:hover .sidebar-icon {
    transform: translateY(-50%) scale(1.12);
}

/* ── TEXT: beside the icon (right:62px), hidden when collapsed ── */
.sidebar-text {
    position: absolute;
    right: var(--sb-collapsed);  /* starts just left of the icon */
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(226, 232, 240, 0.9);
    white-space: nowrap;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.3s ease, opacity 0.2s ease;
}

.global-sidebar:hover .sidebar-text {
    max-width: 180px;
    opacity: 1;
    transition-delay: 0.05s;
}

/* ── Footer ── */
.sidebar-footer {
    flex-shrink: 0;
    padding: 10px 0;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.sidebar-logout {
    color: #f87171;
}
.sidebar-logout:hover {
    background: rgba(248,113,113,0.05);
}

/* --- Professional Motion Effects (Animations) --- */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes neonPulse {
    0% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
    }
    50% {
        box-shadow: 0 8px 32px rgba(56, 189, 248, 0.2), inset 0 0 5px rgba(56, 189, 248, 0.3);
    }
    100% {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
    }
}

/* Base Animation Classes */
.animate-fade-in-up {
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Staggered animation for grid children globally */
.dashboard-grid > * {
    opacity: 0;
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.dashboard-grid > *:nth-child(1) { animation-delay: 0.05s; }
.dashboard-grid > *:nth-child(2) { animation-delay: 0.1s; }
.dashboard-grid > *:nth-child(3) { animation-delay: 0.15s; }
.dashboard-grid > *:nth-child(4) { animation-delay: 0.2s; }
.dashboard-grid > *:nth-child(5) { animation-delay: 0.25s; }
.dashboard-grid > *:nth-child(6) { animation-delay: 0.3s; }
.dashboard-grid > *:nth-child(7) { animation-delay: 0.35s; }
.dashboard-grid > *:nth-child(8) { animation-delay: 0.4s; }
.dashboard-grid > *:nth-child(9) { animation-delay: 0.45s; }
.dashboard-grid > *:nth-child(10) { animation-delay: 0.5s; }
.dashboard-grid > *:nth-child(n+11) { animation-delay: 0.55s; }

/* Action Card Hover & Motion Details */
.action-card {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, border-color 0.3s ease;
    will-change: transform, box-shadow;
}

.action-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(56, 189, 248, 0.3);
    border-color: rgba(56, 189, 248, 0.5);
    z-index: 10;
}

/* Make glass panels pulse optionally */
.pulse-glow {
    animation: neonPulse 3s infinite alternate ease-in-out;
}

/* ═══════════════════════════════════════════════════════
   🎨 GLOBAL COLOR VIBRANCY ENHANCEMENT PATCH v2.0
   More vivid, readable, and professional UI colors
   ═══════════════════════════════════════════════════════ */

/* ── Stronger accent colors ── */
:root {
    --primary-accent:   #38bdf8;   /* Sky Blue — brighter */
    --success-color:    #22c55e;   /* Green — more vivid */
    --warning-color:    #f59e0b;   /* Amber */
    --danger-color:     #f43f5e;   /* Rose Red — stronger */
    --purple-color:     #c084fc;   /* Violet — vibrant */
    --primary-glow:     rgba(56, 189, 248, 0.45);
    --success-glow:     rgba(34, 197, 94, 0.45);
    --danger-glow:      rgba(244, 63, 94, 0.45);
}

/* ── Brighter neon text ── */
.neon-text-primary { color: #38bdf8; text-shadow: 0 0 12px rgba(56,189,248,1), 0 0 30px rgba(56,189,248,0.5); }
.neon-text-success { color: #4ade80; text-shadow: 0 0 12px rgba(74,222,128,1), 0 0 30px rgba(74,222,128,0.5); }
.neon-text-warning { color: #fcd34d; text-shadow: 0 0 12px rgba(252,211,77,1),  0 0 30px rgba(252,211,77,0.5); }
.neon-text-danger  { color: #fb7185; text-shadow: 0 0 12px rgba(251,113,133,1), 0 0 30px rgba(251,113,133,0.5); }
.neon-text-purple  { color: #d8b4fe; text-shadow: 0 0 12px rgba(216,180,254,1), 0 0 30px rgba(216,180,254,0.5); }

/* ── Stronger neon borders ── */
.neon-border-primary { border: 1px solid rgba(56,189,248,0.6);  box-shadow: 0 0 20px rgba(56,189,248,0.3),  inset 0 0 15px rgba(56,189,248,0.08); }
.neon-border-success { border: 1px solid rgba(74,222,128,0.6);  box-shadow: 0 0 20px rgba(74,222,128,0.3),  inset 0 0 15px rgba(74,222,128,0.08); }
.neon-border-warning { border: 1px solid rgba(252,211,77,0.6);  box-shadow: 0 0 20px rgba(252,211,77,0.3),  inset 0 0 15px rgba(252,211,77,0.08); }
.neon-border-danger  { border: 1px solid rgba(251,113,133,0.6); box-shadow: 0 0 20px rgba(251,113,133,0.3), inset 0 0 15px rgba(251,113,133,0.08); }
.neon-border-purple  { border: 1px solid rgba(192,132,252,0.6); box-shadow: 0 0 20px rgba(192,132,252,0.3), inset 0 0 15px rgba(192,132,252,0.08); }

/* ── Better action buttons ── */
.btn-success, .qa-success {
    background: linear-gradient(135deg, #16a34a, #15803d) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(22,163,74,0.5) !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px;
}
.btn-success:hover, .qa-success:hover {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    box-shadow: 0 6px 25px rgba(34,197,94,0.7) !important;
    transform: translateY(-2px) !important;
}

/* ── Quick action buttons — more vivid ── */
.quick-action-btn {
    text-shadow: none !important;
    letter-spacing: 0.3px;
    font-size: 0.95rem !important;
}
.quick-action-btn:hover {
    background: rgba(255,255,255,0.08) !important;
    border-color: rgba(255,255,255,0.3) !important;
    transform: translateX(-3px) !important;
}
.qa-primary   { background: linear-gradient(135deg, rgba(56,189,248,0.15), rgba(56,189,248,0.05)) !important; border-color: rgba(56,189,248,0.5) !important; color: #7dd3fc !important; }
.qa-warning   { background: linear-gradient(135deg, rgba(245,158,11,0.15), rgba(245,158,11,0.05)) !important;  border-color: rgba(245,158,11,0.5) !important;  color: #fcd34d !important; }
.qa-success   { background: linear-gradient(135deg, rgba(34,197,94,0.15), rgba(34,197,94,0.05)) !important;   border-color: rgba(34,197,94,0.5) !important;   color: #86efac !important; }
.qa-danger    { background: linear-gradient(135deg, rgba(244,63,94,0.15), rgba(244,63,94,0.05)) !important;   border-color: rgba(244,63,94,0.5) !important;   color: #fda4af !important; }

/* ── Module gradient refresh on home ── */
.module-cash      { background: linear-gradient(145deg, #059669, #047857) !important; box-shadow: 0 6px 20px rgba(5,150,105,0.5) !important; }
.module-payment   { background: linear-gradient(145deg, #e11d48, #be123c) !important; box-shadow: 0 6px 20px rgba(225,29,72,0.5) !important; }
.module-inventory { background: linear-gradient(145deg, #7c3aed, #6d28d9) !important; box-shadow: 0 6px 20px rgba(124,58,237,0.5) !important; }
.module-sales     { background: linear-gradient(145deg, #2563eb, #1d4ed8) !important; box-shadow: 0 6px 20px rgba(37,99,235,0.5) !important; }
.module-statement { background: linear-gradient(145deg, #7c3aed, #5b21b6) !important; box-shadow: 0 6px 20px rgba(124,58,237,0.5) !important; }
.module-purchase  { background: linear-gradient(145deg, #d97706, #b45309) !important; box-shadow: 0 6px 20px rgba(217,119,6,0.5) !important; }
.module-analytics { background: linear-gradient(145deg, #0284c7, #0369a1) !important; box-shadow: 0 6px 20px rgba(2,132,199,0.5) !important; }
.module-partners  { background: linear-gradient(145deg, #0d9488, #0f766e) !important; box-shadow: 0 6px 20px rgba(13,148,136,0.5) !important; }
.module-payroll   { background: linear-gradient(145deg, #9333ea, #7e22ce) !important; box-shadow: 0 6px 20px rgba(147,51,234,0.5) !important; }
.module-settings  { background: linear-gradient(145deg, #475569, #334155) !important; box-shadow: 0 6px 20px rgba(71,85,105,0.5) !important; }
.module-audit     { background: linear-gradient(145deg, #1e40af, #1e3a8a) !important; box-shadow: 0 6px 20px rgba(30,64,175,0.5) !important; }

/* ── Background deeper glow ── */
body {
    background-image:
        radial-gradient(ellipse at 15% 15%, rgba(56,189,248,0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 85%, rgba(168,85,247,0.07) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 0%, rgba(34,197,94,0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 100%, rgba(244,63,94,0.04) 0%, transparent 40%) !important;
}

/* ── Labels more readable ── */
.label {
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
    letter-spacing: 0.3px;
}

/* ── KPI numbers bigger and glowing ── */
.neon-text-primary, .neon-text-success, .neon-text-warning, .neon-text-danger {
    font-weight: 900 !important;
}


/* Ensure a without href have pointer cursor */
a[data-href], a[onclick] { cursor: pointer; }

/* Custom Searchable Select */
.custom-select-container { position: relative; width: 100%; font-family: inherit; }
.custom-select-input {
    width: 100%; padding: 12px; border-radius: 8px; 
    border: 1px solid rgba(255,255,255,0.1); 
    background: rgba(0,0,0,0.2); color: #fff; 
    font-family: inherit; font-size: 1rem;
    outline: none; transition: border-color 0.2s;
}
.custom-select-input:focus { border-color: var(--primary); }
.custom-select-input::placeholder { color: rgba(255,255,255,0.4); }
.custom-select-dropdown {
    position: absolute; top: 100%; right: 0; left: 0;
    margin-top: 5px; background: #1e293b; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; max-height: 300px; overflow-y: auto;
    z-index: 1000; display: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
.custom-select-dropdown.active { display: block; }
.cs-group { padding: 8px 12px; font-size: 0.8rem; color: var(--primary); font-weight: bold; background: rgba(0,0,0,0.2); }
.cs-option { padding: 10px 15px; cursor: pointer; transition: background 0.2s; color: #f8fafc; font-size: 0.95rem; border-bottom: 1px solid rgba(255,255,255,0.02); }
.cs-option:last-child { border-bottom: none; }
.cs-option:hover { background: rgba(255,255,255,0.05); }
.cs-option-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; }

/* Smart Select Dropdown Component */
.custom-select-container { position: relative; width: 100%; font-family: inherit; }
.custom-select-input {
    width: 100%; padding: 12px; border-radius: 8px; 
    border: 1px solid rgba(255,255,255,0.1); 
    background: rgba(0,0,0,0.2); color: #fff; 
    font-family: inherit; font-size: 1rem;
    outline: none; transition: border-color 0.2s;
}
.custom-select-input:focus { border-color: #38bdf8; }
.custom-select-input::placeholder { color: rgba(255,255,255,0.4); }
.custom-select-dropdown {
    position: absolute; top: 100%; right: 0; left: 0;
    margin-top: 5px; background: #1e293b; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px; max-height: 300px; overflow-y: auto;
    z-index: 9999; display: none;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}
.custom-select-dropdown.active { display: block; }
.cs-group { padding: 8px 12px; font-size: 0.8rem; color: #38bdf8; font-weight: bold; background: rgba(0,0,0,0.2); }
.cs-option { padding: 10px 15px; cursor: pointer; transition: background 0.2s; color: #f8fafc; font-size: 0.95rem; border-bottom: 1px solid rgba(255,255,255,0.02); }
.cs-option:last-child { border-bottom: none; }
.cs-option:hover { background: rgba(255,255,255,0.05); }
.cs-option-desc { font-size: 0.75rem; color: #94a3b8; margin-top: 3px; }

/* Athkar Ticker */
.islamic-ticker-container { overflow: hidden; white-space: nowrap; max-width: 400px; margin-top: 5px; position: relative; display: flex; align-items: center; border-radius: 8px; background: rgba(0,0,0,0.2); padding: 5px 10px; border: 1px solid rgba(255,255,255,0.05); }
.islamic-ticker { display: inline-block; font-weight: 700; font-size: 0.95rem; color: transparent; background: linear-gradient(90deg, #f59e0b, #10b981, #3b82f6, #a855f7, #f59e0b); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; animation: gradientMove 3s linear infinite, scrollTicker 20s linear infinite; text-shadow: 0 0 10px rgba(245, 158, 11, 0.2); white-space: nowrap; padding-left: 100%; }
@keyframes scrollTicker { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes gradientMove { 0% { background-position: 0% center; } 100% { background-position: 200% center; } }

/* Header Page Title */
.header-page-title { margin:0; font-size:1.5rem; font-weight:900; white-space:nowrap; display:flex; align-items:center; justify-content:center; gap:10px; background: linear-gradient(135deg, #10b981, #38bdf8, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 2px 8px rgba(56, 189, 248, 0.4)); animation: titleGlow 3s ease-in-out infinite alternate; }
.header-page-title-icon { font-size: 1.6rem; -webkit-text-fill-color: initial; filter: none; }
@keyframes titleGlow { from { filter: drop-shadow(0 2px 5px rgba(56, 189, 248, 0.3)); } to { filter: drop-shadow(0 5px 15px rgba(139, 92, 246, 0.6)); } }

/* ═══════════════════════════════════════════════════════
   PREMIUM GLASSMORPHISM CONTEXT MENUS (Unified Style)
   ═══════════════════════════════════════════════════════ */
.context-menu:not(#contextMenu), 
.custom-context-menu, 
#columnContextMenu, 
#col-context-menu,
#rowContextMenu {
    position: absolute;
    background: var(--surface-color) !important;
    backdrop-filter: blur(var(--glass-blur)) !important;
    -webkit-backdrop-filter: blur(var(--glass-blur)) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: var(--border-radius-sm) !important;
    box-shadow: var(--shadow-lg), var(--shadow-neon) !important;
    padding: 10px 8px !important;
    min-width: 220px !important;
    z-index: 999999 !important;
    color: var(--text-primary) !important;
    font-family: var(--font-base) !important;
    display: none;
    flex-direction: column;
    gap: 6px;
}

/* For active/show states - with smooth pop-in animation */
.context-menu:not(#contextMenu).active, 
.context-menu:not(#contextMenu).show, 
.custom-context-menu.show, 
#columnContextMenu.show,
#rowContextMenu.show {
    display: flex !important;
    animation: premiumMenuIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}

@keyframes premiumMenuIn {
    from { 
        opacity: 0; 
        transform: scale(0.92) translateY(-8px); 
        filter: blur(4px);
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
        filter: blur(0);
    }
}

/* Header style inside context menus */
.context-menu:not(#contextMenu) .menu-title,
.context-menu:not(#contextMenu) div[style*="fbbf24"], 
#columnContextMenu div[style*="font-weight:900"],
#sys-number-format-menu div[style*="fbbf24"] {
    color: var(--primary-accent) !important;
    font-weight: 800 !important;
    font-size: 0.9rem !important;
    text-align: center;
    border-bottom: 1px solid var(--glass-border) !important;
    padding-bottom: 8px !important;
    margin-bottom: 6px !important;
}

/* Target ID label for numeric preference context menu */
#sys-num-target-id {
    color: var(--text-muted) !important;
    font-size: 0.75rem !important;
    text-align: center;
    margin-bottom: 8px !important;
    word-break: break-all;
}

/* Context Menu Items */
.context-menu-item, 
.col-toggle-item, 
#columnContextMenu .context-menu-item {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    color: var(--text-primary) !important;
    padding: 8px 12px !important;
    border-radius: var(--border-radius-sm) !important;
    cursor: pointer !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    transition: var(--transition-fast) !important;
    background: transparent !important;
    border: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.context-menu-item:hover, 
.col-toggle-item:hover, 
#columnContextMenu .context-menu-item:hover {
    background: var(--surface-hover) !important;
    color: var(--primary-accent) !important;
    transform: translateX(-4px); /* smooth micro-animation for RTL */
}

/* Input elements inside context menu */
.context-menu:not(#contextMenu) input[type="text"],
.context-menu:not(#contextMenu) input[type="number"],
.context-menu:not(#contextMenu) select,
#columnContextMenu select,
#sys-number-format-menu select {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px !important;
    padding: 6px 10px !important;
    font-size: 0.85rem !important;
    outline: none !important;
    transition: var(--transition-fast) !important;
}

.context-menu:not(#contextMenu) input[type="text"]:focus,
.context-menu:not(#contextMenu) input[type="number"]:focus,
.context-menu:not(#contextMenu) select:focus {
    border-color: var(--primary-accent) !important;
    box-shadow: 0 0 10px var(--primary-glow) !important;
}

/* Buttons inside context menu */
.context-menu:not(#contextMenu) button,
#columnContextMenu button,
#sys-number-format-menu button {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    transition: var(--transition-fast) !important;
}

.context-menu:not(#contextMenu) button:hover,
#columnContextMenu button:hover,
#sys-number-format-menu button:hover {
    background: var(--surface-hover) !important;
    border-color: var(--primary-accent) !important;
    color: var(--primary-accent) !important;
}

/* Active buttons state (like bold/decimals selections in column customization) */
.context-menu:not(#contextMenu) button.active,
#columnContextMenu button.active-btn,
#columnContextMenu button[style*="cbd5e1"] {
    background: var(--primary-accent) !important;
    color: var(--bg-secondary) !important;
    border-color: var(--primary-accent) !important;
}

/* Checkboxes inside context menus */
.context-menu:not(#contextMenu) input[type="checkbox"],
#columnContextMenu input[type="checkbox"],
#sys-number-format-menu input[type="checkbox"] {
    accent-color: var(--primary-accent) !important;
    width: 16px !important;
    height: 16px !important;
    cursor: pointer !important;
}

/* Color inputs */
.context-menu:not(#contextMenu) input[type="color"],
#columnContextMenu input[type="color"] {
    width: 32px !important;
    height: 28px !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 6px !important;
    background: transparent !important;
    padding: 0 !important;
    cursor: pointer !important;
}

/* Column Customizer Specific Overrides */
#columnContextMenu div {
    background: transparent !important;
    border-color: var(--glass-border) !important;
    color: var(--text-primary) !important;
}
#columnContextMenu div[id^="config-panel-"] {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 8px !important;
    margin-top: 5px !important;
    padding: 12px !important;
}
#columnContextMenu label {
    color: var(--text-primary) !important;
}
#columnContextMenu span {
    color: var(--text-secondary) !important;
}

/* Rotating multicolored border glow for context menus */
.context-menu:not(#contextMenu)::before, 
.custom-context-menu::before, 
#columnContextMenu::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
    border-radius: inherit !important;
    padding: 2px !important; /* border thickness */
    background: linear-gradient(135deg, #3b82f6, #10b981, #f59e0b, #a855f7, #ec4899, #3b82f6) !important;
    background-size: 300% 300% !important;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0) !important;
    -webkit-mask-composite: xor !important;
    mask-composite: exclude !important;
    pointer-events: none !important;
    z-index: 100 !important;
    animation: borderGlow 6s linear infinite !important;
}

@keyframes borderGlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Sweeping shiny liquid glass reflection */
.context-menu:not(#contextMenu)::after, 
.custom-context-menu::after, 
#columnContextMenu::after {
    content: '' !important;
    position: absolute !important;
    top: 0 !important; left: -150% !important;
    width: 100% !important; height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05), transparent) !important;
    transform: skewX(-25deg) !important;
    pointer-events: none !important;
    z-index: 99 !important;
    animation: menuShine 6s infinite ease-in-out !important;
}

@keyframes menuShine {
    0% { left: -150%; }
    25% { left: 150%; }
    100% { left: 150%; }
}

/* Column Toggles List Premium Styling */
.toggle-item-wrapper {
    background: rgba(15, 23, 42, 0.45) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 10px !important;
    margin-bottom: 8px !important;
    overflow: hidden !important;
    transition: all 0.25s ease !important;
    position: relative !important;
}

.toggle-item-wrapper:hover {
    border-color: var(--primary-accent) !important;
    box-shadow: 0 0 12px var(--primary-glow) !important;
    background: rgba(15, 23, 42, 0.6) !important;
}

.toggle-item-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 10px 14px !important;
    cursor: pointer !important;
}

.drag-handle {
    font-size: 1.1rem !important;
    color: var(--text-muted) !important;
    cursor: grab !important;
    padding: 0 6px !important;
    transition: color 0.2s !important;
    user-select: none !important;
}

.drag-handle:hover {
    color: var(--primary-accent) !important;
}

.drag-handle:active {
    cursor: grabbing !important;
}

.toggle-item-label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    font-size: 0.9rem !important;
    margin: 0 !important;
    flex-grow: 1 !important;
    color: var(--text-primary) !important;
    user-select: none !important;
}

.gear-btn {
    font-size: 0.95rem !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    transition: transform 0.3s ease, color 0.2s !important;
    padding: 4px !important;
}

.gear-btn:hover {
    color: var(--primary-accent) !important;
    transform: rotate(45deg) !important;
}

.toggle-config-panel {
    padding: 12px 14px !important;
    background: rgba(10, 17, 40, 0.5) !important;
    border-top: 1px solid var(--glass-border) !important;
    animation: configSlideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes configSlideDown {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.config-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 10px !important;
}

.config-row:last-child {
    margin-bottom: 0 !important;
}

.config-label {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: var(--text-secondary) !important;
}

.btn-group {
    display: flex !important;
    gap: 4px !important;
}

/* Sortable Ghost drag effect */
.toggle-item-ghost {
    opacity: 0.4 !important;
    background: var(--primary-glow) !important;
    border: 2px dashed var(--primary-accent) !important;
}

/* --- GLOBAL PRINT STYLES --- */
@media screen {
    .print-only { display: none !important; }
}
@media print {
    /* Reset colors and backgrounds for printers */
    body, html { 
        background: #fff !important; 
        color: #000 !important; 
        height: auto !important; 
        min-height: auto !important;
        overflow: visible !important;
    }
    * { 
        color: #000 !important; 
        box-shadow: none !important; 
        text-shadow: none !important; 
        background-color: transparent !important; 
        background-image: none !important;
    }
    
    /* Ensure inputs are visible */
    input, textarea, select { 
        border: 1px solid #999 !important; 
        background: transparent !important; 
        color: #000 !important;
    }

    /* Print visibility helpers */
    .no-print { display: none !important; }
    .print-only { display: block !important; }
    #global-print-header { display: flex !important; border-bottom: 2px solid #000 !important; }
    #global-print-header * { color: #000 !important; }

    /* Fix flex/grid issues in print */
    .main-panel, .glass-panel, .app-container {
        display: block !important;
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        backdrop-filter: none !important;
    }

    /* Hide known non-printable UI elements globally if not already tagged with no-print */
    .header-controls, .premium-header, .footer-actions, .side-panel, button, .ambient-bg, .orb {
        display: none !important;
    }
}

/* ==========================================================================
   PWA & Responsive Layout Utilities
   ========================================================================== */

/* Mobile Only (Hidden on Desktop) */
@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
}

/* Desktop Only (Hidden on Mobile) */
@media (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }
}

/* Base PWA Card styling */
.pwa-card {
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pwa-card:active {
    transform: scale(0.98);
}

/* Color Coding for Mobile Cards */
/* Emerald Green for Sales (المبيعات) */
.pwa-sales-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-left: 5px solid #10b981;
}
.pwa-sales-card .pwa-icon {
    color: #34d399;
    background: rgba(16, 185, 129, 0.2);
}

/* Crimson Red for Purchases (المشتريات) */
.pwa-purchases-card {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.15) 0%, rgba(225, 29, 72, 0.05) 100%);
    border-left: 5px solid #f43f5e;
}
.pwa-purchases-card .pwa-icon {
    color: #fb7185;
    background: rgba(244, 63, 94, 0.2);
}

/* Indigo Blue for Reports (التقارير) */
.pwa-reports-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.05) 100%);
    border-left: 5px solid #3b82f6;
}
.pwa-reports-card .pwa-icon {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.2);
}

/* Amber/Orange for Inventory (المخزون) */
.pwa-inventory-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.05) 100%);
    border-left: 5px solid #f59e0b;
}
.pwa-inventory-card .pwa-icon {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.2);
}

.pwa-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.pwa-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.pwa-card-title {
    font-family: 'Tajawal', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.pwa-card-value {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 5px;
    font-family: 'Inter', sans-serif;
}

/* PWA Standalone Notch & Padding Adjustments for iOS/Android */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top, 20px);
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }
}

/* =======================================================
   PREMIUM MOBILE DESIGN SYSTEM & LAYOUTS (iOS/Android Native Style)
   ======================================================= */
@media (max-width: 768px) {
    /* Hide desktop headers and sidebars on mobile if necessary */
    .premium-header {
        padding: 8px 12px !important;
        border-radius: 12px !important;
        margin-bottom: 8px !important;
    }
    
    .header-brand .brand-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 1rem !important;
    }
    
    .header-brand .brand-text h1 {
        font-size: 0.95rem !important;
    }

    .header-controls .clock-container,
    .header-controls .user-info,
    .header-controls .header-center,
    .header-center {
        display: none !important;
    }

    /* Fixed Bottom Navigation Bar for Mobile */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 12px;
        left: 3%;
        width: 94%;
        height: 60px;
        background: rgba(10, 8, 16, 0.88);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 20px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 999999;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.1);
        padding: 0 8px;
        box-sizing: border-box;
        direction: rtl;
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        color: #94a3b8;
        text-decoration: none !important;
        font-size: 0.65rem;
        font-weight: 700;
        gap: 3px;
        transition: all 0.25s ease;
        cursor: pointer;
        flex: 1;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-item .icon {
        font-size: 1.15rem;
        transition: transform 0.25s ease, filter 0.25s ease;
    }

    .mobile-nav-item.active {
        color: #38bdf8 !important;
    }

    .mobile-nav-item.active .icon {
        transform: translateY(-3px) scale(1.1);
        filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.5));
    }

    /* Padding body so content is not hidden behind the fixed bottom nav */
    body {
        padding-bottom: 85px !important;
    }

    /* Transform Tables into Clean Card Layouts on Mobile */
    .table-container, .modern-table-container {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    table.modern-table, table.modern-table tbody, table.modern-table tr, table.modern-table td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    table.modern-table thead {
        display: none !important; /* Hide header columns on mobile */
    }

    table.modern-table tr {
        background: rgba(20, 16, 28, 0.6) !important;
        border: 1px solid rgba(255, 255, 255, 0.06) !important;
        border-radius: 16px !important;
        margin-bottom: 12px !important;
        padding: 12px 15px !important;
        box-shadow: 0 4px 10px rgba(0,0,0,0.2) !important;
        transition: all 0.25s ease !important;
        position: relative !important;
    }

    table.modern-table tr:hover {
        background: rgba(28, 24, 38, 0.8) !important;
        border-color: rgba(56, 189, 248, 0.3) !important;
        transform: translateY(-2px) !important;
    }

    table.modern-table td {
        border: none !important;
        padding: 6px 0 !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        font-size: 0.85rem !important;
    }

    /* Force labels on right and value on left */
    table.modern-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #94a3b8;
        text-align: right;
        display: block;
        margin-left: 10px;
    }

    /* Custom Mobile Bottom Sheet Dialogs (iOS Style Modals) */
    .modal-content, .premium-modal, .sweet-alert, .swal2-modal {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 24px 24px 0 0 !important;
        transform: translateY(100%) !important;
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
        margin: 0 !important;
        max-height: 85vh !important;
        overflow-y: auto !important;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.6) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-bottom: none !important;
        background: #0d0b13 !important;
    }

    .modal.show .modal-content, .modal.active .modal-content, .premium-modal.active {
        transform: translateY(0) !important;
    }

    /* Drag handle indicator on bottom sheet */
    .modal-content::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.18);
        border-radius: 10px;
        margin: 8px auto 12px auto;
    }

    /* Inputs optimization for mobile tapping */
    .select-input, .text-input, input[type='text'], input[type='number'], input[type='password'], input[type='date'], textarea {
        padding: 13px 15px !important;
        font-size: 0.95rem !important;
        border-radius: 12px !important;
        min-height: 44px !important;
    }

    /* Larger interactive action buttons */
    .btn, button, .action-btn {
        padding: 11px 18px !important;
        font-size: 0.9rem !important;
        border-radius: 12px !important;
        min-height: 44px !important; /* Ensure min touch target height */
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* =======================================================
   LANDSCAPE ORIENTATION OPTIMIZATION (Fills entire screen)
   ======================================================= */
@media (orientation: landscape) and (max-device-width: 950px) {
    /* Hide mobile bottom navigation bar in landscape to maximize vertical space */
    .mobile-bottom-nav {
        display: none !important;
    }
    
    body {
        padding-bottom: 0 !important;
    }

    /* Expand main containers to cover the entire viewport width (no margins on right/left) */
    .dash-main, .container, .main-content, .app-container {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 8px !important;
        box-sizing: border-box !important;
    }

    /* Revert table cards back to standard desktop tabular layout for wide screen usage */
    table.modern-table {
        display: table !important;
    }
    table.modern-table thead {
        display: table-header-group !important;
    }
    table.modern-table tbody {
        display: table-row-group !important;
    }
    table.modern-table tr {
        display: table-row !important;
        background: rgba(20, 16, 28, 0.4) !important;
        border: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-radius: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
    table.modern-table td {
        display: table-cell !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        padding: 10px 12px !important;
        text-align: right !important;
    }
    table.modern-table td::before {
        display: none !important; /* Hide mobile cards label prefix */
    }

    /* Form rows should display side-by-side to save vertical scrolling */
    .form-row, .row {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
    }
    .form-group, .col-md-6, .col-md-4, .col-xs-12 {
        flex: 1 !important;
        margin-bottom: 8px !important;
    }
}

