/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;

  /* Sleek Color Palette */
  --bg-primary: #0a0714;
  --bg-secondary: #120e24;
  --bg-tertiary: #191433;
  
  --glass-bg: rgba(18, 14, 36, 0.65);
  --glass-bg-hover: rgba(25, 20, 51, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-focus: rgba(162, 155, 254, 0.4);

  --accent-purple: #8e44ad;
  --accent-purple-glow: rgba(142, 68, 173, 0.4);
  --accent-cyan: #00cec9;
  --accent-cyan-glow: rgba(0, 206, 201, 0.3);
  
  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #b2bec3;
  --text-muted: #636e72;

  /* Status Colors */
  --color-success: #00b894;
  --color-success-bg: rgba(0, 184, 148, 0.15);
  --color-warning: #fdcb6e;
  --color-warning-bg: rgba(253, 203, 110, 0.15);
  --color-danger: #ff7675;
  --color-danger-bg: rgba(255, 118, 117, 0.15);
  --color-info: #0984e3;
  
  /* Layout */
  --sidebar-width: 260px;
  --header-height: 80px;
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
  --border-radius-sm: 6px;
  --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --box-shadow-neon: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* ==========================================================================
   BASE STYLES & RESET
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-purple);
}

/* Background Glowing Orbs */
.glow-bg {
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}
.glow-1 {
  background: var(--accent-purple);
  top: -100px;
  right: -100px;
}
.glow-2 {
  background: var(--accent-cyan);
  bottom: -100px;
  left: -100px;
}

/* Helper styles */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-success { color: var(--color-success) !important; }
.margin-top { margin-top: 24px; }
.required { color: var(--color-danger); }
.error-text {
  color: var(--color-danger);
  font-size: 0.875rem;
  margin-top: 6px;
  min-height: 1.25rem;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-primary);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 10px 20px;
  border-radius: var(--border-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.btn-block { width: 100%; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), #a29bfe);
  color: white;
  box-shadow: 0 4px 15px var(--accent-purple-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(142, 68, 173, 0.6);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: linear-gradient(135deg, var(--accent-cyan), #00cec9);
  color: #0c0022;
  font-weight: 600;
  box-shadow: 0 4px 15px var(--accent-cyan-glow);
}
.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 206, 201, 0.5);
}
.btn-secondary:active { transform: translateY(0); }

.btn-outline {
  background: transparent;
  border-color: var(--glass-border);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

.btn-danger {
  background: var(--color-danger-bg);
  border-color: rgba(255, 118, 117, 0.3);
  color: var(--color-danger);
}
.btn-danger:hover {
  background: var(--color-danger);
  color: white;
}

.btn-success {
  background: var(--color-success-bg);
  border-color: rgba(0, 184, 148, 0.3);
  color: var(--color-success);
}
.btn-success:hover {
  background: var(--color-success);
  color: white;
}

.btn-icon {
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--border-radius-sm);
}
.btn-icon:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* ==========================================================================
   LOGIN MODULE
   ========================================================================== */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 40px;
  box-shadow: var(--box-shadow-neon);
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.logo-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 16px auto;
  color: white;
  box-shadow: 0 8px 20px rgba(142, 68, 173, 0.3);
}
.login-header h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.login-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.input-group {
  margin-bottom: 20px;
}
.input-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}
.password-input-wrapper {
  position: relative;
  display: flex;
}
input[type="text"],
input[type="password"],
input[type="number"],
textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(18, 14, 36, 0.4);
  color: white;
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: var(--transition-smooth);
}
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-purple);
  box-shadow: 0 0 10px rgba(142, 68, 173, 0.25);
  background: rgba(18, 14, 36, 0.7);
}

.password-input-wrapper input {
  padding-right: 45px;
}
.toggle-pwd-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
}
.toggle-pwd-btn:hover {
  color: var(--text-primary);
}

/* ==========================================================================
   APP CONTAINER & LAYOUT
   ========================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
}
.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--glass-border);
}
.brand-icon {
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-text h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.brand-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-nav {
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--border-radius-md);
  transition: var(--transition-smooth);
  position: relative;
}
.nav-item i {
  font-size: 1.1rem;
  width: 20px;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}
.nav-item.active {
  background: rgba(142, 68, 173, 0.12);
  color: var(--accent-purple);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 4px;
  background: var(--accent-purple);
  border-radius: 0 4px 4px 0;
}

.badge {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}
.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid var(--glass-border);
}
.btn-logout-link {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px;
  transition: var(--transition-smooth);
}
.btn-logout-link:hover {
  color: var(--color-danger);
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  padding: 40px;
  min-height: 100vh;
}
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
}
.header-title h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.header-title p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.header-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}
.profile-info {
  text-align: right;
}
.profile-name {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}
.profile-role {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.5px;
}
.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--accent-purple);
}

/* Card glass */
.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow-neon);
}
.card-glass.no-padding {
  padding: 0;
}
.card-glass .card-header {
  padding: 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-glass .card-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-glass .card-body {
  padding: 24px;
}
.card-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ==========================================================================
   VIEW: DASHBOARD
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition-smooth);
}
.stat-card:hover {
  transform: translateY(-4px);
  background: var(--glass-bg-hover);
}
.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.stat-info h3 {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
}

.card-purple { border-top: 4px solid var(--accent-purple); }
.card-purple .stat-icon { background: var(--accent-purple-glow); color: #a29bfe; }
.card-yellow { border-top: 4px solid var(--color-warning); }
.card-yellow .stat-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.card-green { border-top: 4px solid var(--color-success); }
.card-green .stat-icon { background: var(--color-success-bg); color: var(--color-success); }
.card-cyan { border-top: 4px solid var(--accent-cyan); }
.card-cyan .stat-icon { background: var(--accent-cyan-glow); color: var(--accent-cyan); }

.dashboard-row {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}
.dashboard-col {
  flex-direction: column;
}
.col-6 { width: 50%; }
.col-12 { width: 100%; }

/* Drag & Drop Zone */
.drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius-md);
  padding: 36px 20px;
  text-align: center;
  background: rgba(18, 14, 36, 0.2);
  cursor: pointer;
  transition: var(--transition-smooth);
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent-purple);
  background: rgba(142, 68, 173, 0.05);
}
.drop-icon {
  font-size: 2.2rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  transition: var(--transition-smooth);
}
.drop-zone:hover .drop-icon {
  color: var(--accent-purple);
  transform: translateY(-2px);
}
.drop-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.drop-text span {
  color: #a29bfe;
  font-weight: 600;
  text-decoration: underline;
}

.csv-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}
.upload-status {
  font-size: 0.85rem;
  margin-top: 10px;
  font-weight: 500;
}

/* Status list */
.status-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}
.status-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.status-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.status-badge.active { color: var(--color-success); }
.status-badge.inactive { color: var(--color-danger); }

.webhook-url-wrapper {
  display: flex;
  gap: 8px;
}
.webhook-url-wrapper input {
  font-family: monospace;
  font-size: 0.85rem;
  background: rgba(0, 0, 0, 0.25);
  border-color: var(--glass-border);
}

.shortcut-buttons {
  display: flex;
  gap: 14px;
  margin-top: 32px;
}

/* ==========================================================================
   VIEW: MATERIALS & TABLES
   ========================================================================== */
.view-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.search-box {
  position: relative;
  width: 320px;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.search-box input {
  padding-left: 40px;
}
.button-group {
  display: flex;
  gap: 12px;
}

.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius-lg);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--glass-border);
}
.data-table th {
  background: rgba(25, 20, 51, 0.5);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}
.data-table tbody tr {
  transition: var(--transition-smooth);
}
.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges for approval */
.user-status-tag {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}
.status-pending { background: var(--color-warning-bg); color: var(--color-warning); }
.status-approved { background: var(--color-success-bg); color: var(--color-success); }
.status-rejected { background: var(--color-danger-bg); color: var(--color-danger); }

.table-loading-icon {
  font-size: 1.2rem;
  margin-right: 8px;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 3, 10, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.25s ease-out;
}
.modal-card {
  width: 100%;
  max-width: 600px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}
.modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}
.modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}
.modal-close:hover {
  color: var(--accent-cyan);
}

.modal-body {
  padding: 24px;
}
.modal-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.form-row {
  display: flex;
  gap: 16px;
}
.form-group {
  margin-bottom: 20px;
  flex-grow: 1;
}
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  background: var(--bg-tertiary);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleUp {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Responsive Styles */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 900px) {
  .sidebar {
    width: 70px;
  }
  .sidebar-brand .brand-text, 
  .sidebar-nav span,
  .sidebar-footer span,
  .badge {
    display: none;
  }
  .main-content {
    margin-left: 70px;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-row {
    flex-direction: column;
  }
  .col-6 {
    width: 100%;
  }
}

/* =========================================
   Warehouse Tablet Board View
========================================= */
.warehouse-filter-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 5px;
  margin-right: auto;
  margin-left: 20px;
}

.zone-tab {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #aaa;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.zone-tab:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.zone-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

.warehouse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 10px 0;
}

.warehouse-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  min-height: 180px;
}

.warehouse-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.warehouse-card.stock-warning {
  background: rgba(231, 76, 60, 0.1);
  border: 2px solid #e74c3c;
  box-shadow: 0 0 15px rgba(231, 76, 60, 0.3);
}

.wh-card-header {
  margin-bottom: 15px;
}

.wh-card-code {
  font-size: 0.85rem;
  color: #aaaaaa;
  margin-bottom: 5px;
  display: block;
}

.wh-card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.3;
  margin: 0;
  word-break: break-word;
}

.warehouse-card.stock-warning .wh-card-title {
  color: #ffcccc;
}

.wh-card-body {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
}

.wh-stock-info {
  display: flex;
  flex-direction: column;
}

.wh-stock-label {
  font-size: 0.85rem;
  color: #888888;
  margin-bottom: 2px;
}

.wh-stock-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: #2ecc71; /* Green for normal stock */
  line-height: 1;
}

.warehouse-card.stock-warning .wh-stock-label {
  color: #ff9999;
}

.warehouse-card.stock-warning .wh-stock-value {
  color: #ff4d4d; /* Red for warning stock */
}

.wh-min-stock {
  font-size: 0.9rem;
  color: #aaaaaa;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 8px;
  border-radius: 6px;
}

.warehouse-card.stock-warning .wh-min-stock {
  color: #ffcccc;
  background: rgba(231, 76, 60, 0.2);
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
  body, .modal-body, .printable-area {
    background: white !important;
    color: black !important;
  }
  
  .hide-print {
    display: none !important;
  }

  .print-table th, .print-table td {
    border: 1px solid black !important;
    color: black !important;
  }

  /* Force variables to light mode for printing */
  :root {
    --bg-primary: #ffffff !important;
    --bg-secondary: #ffffff !important;
    --bg-tertiary: #ffffff !important;
    --text-primary: #000000 !important;
    --text-secondary: #333333 !important;
    --text-muted: #555555 !important;
    --danger: #000000 !important;
    --primary: #000000 !important;
    --accent-cyan: #000000 !important;
  }

  /* Sales detail printing */
  body.printing-sales-detail * {
    visibility: hidden !important;
  }
  body.printing-sales-detail #sales-detail-section,
  body.printing-sales-detail #sales-detail-section * {
    visibility: visible !important;
  }
  body.printing-sales-detail .stats-grid,
  body.printing-sales-detail .dashboard-row,
  body.printing-sales-detail .dashboard-controls,
  body.printing-sales-detail #btn-close-sales-detail,
  body.printing-sales-detail #btn-print-sales-detail,
  body.printing-sales-detail .fa-circle-info,
  body.printing-sales-detail .card-body > p {
    display: none !important;
  }
  body.printing-sales-detail #sales-detail-section {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    border: none;
    background: white;
    color: black;
    box-shadow: none;
  }
  body.printing-sales-detail table {
    width: 100%;
    border-collapse: collapse;
  }

  /* Sales dashboard printing */
  body.printing-sales-dashboard * {
    visibility: hidden !important;
  }
  body.printing-sales-dashboard #view-sales,
  body.printing-sales-dashboard #view-sales * {
    visibility: visible !important;
  }
  body.printing-sales-dashboard .sales-controls,
  body.printing-sales-dashboard #sales-detail-section {
    display: none !important;
  }
  body.printing-sales-dashboard #view-sales {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    border: none;
    background: white;
    color: black;
    box-shadow: none;
  }
  body.printing-sales-dashboard .card {
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
  }
  body.printing-sales-dashboard canvas {
    max-width: 100% !important;
  }
  body.printing-sales-detail table th,
  body.printing-sales-detail table td {
    border: 1px solid #ccc !important;
    padding: 8px !important;
    color: black !important;
  }
  body.printing-sales-detail table th {
    background-color: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
  }
  body.printing-sales-detail tr[style*="background-color"] {
    background-color: #ffcccc !important;
    -webkit-print-color-adjust: exact;
  }
}
