/* Design Token System & CSS Variables */
:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Premium Warm Emerald & Golden Teal Color Palette */
  --bg-app: #080f0c;             /* Dark teal-black base */
  --bg-sidebar: #0b1511;         /* Deep spruce green sidebar */
  --bg-panel: rgba(16, 29, 23, 0.7); /* Translucent panel */
  --bg-card: #14241d;            /* Rich dark forest card background */
  --bg-card-hover: #1b3026;      /* Lighter highlight */
  --border-color: #243d31;       /* Structured boundary green */
  --border-light: rgba(255, 255, 255, 0.05);

  --text-main: #f0fdf4;          /* Soft mint white */
  --text-muted: #a3b899;         /* Sage grey */
  --text-dark: #627b6c;          /* Deep moss grey */

  /* Interactive States */
  --primary: #00e699;            /* Neon mint emerald */
  --primary-hover: #00b377;      /* Vivid forest green */
  --primary-glow: rgba(0, 230, 153, 0.15);
  
  --success: #22d3ee;            /* Clear cyan */
  --success-hover: #0891b2;
  --success-glow: rgba(34, 211, 238, 0.15);

  --warning: #f59e0b;            /* Warm honey amber */
  --warning-hover: #d97706;
  --warning-glow: rgba(245, 158, 11, 0.15);

  --danger: #f43f5e;             /* Coral red */
  --danger-hover: #e11d48;
  --danger-glow: rgba(244, 63, 94, 0.15);

  /* Transitions & Shadows */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.15), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -4px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 20px rgba(0, 230, 153, 0.2);

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

/* Base Resets */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  outline: none;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--text-main);
}

a {
  text-decoration: none;
  color: inherit;
}

ul {
  list-style: none;
}

/* App Layout Structure */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 40px;
  padding: 0 10px;
}

.brand-icon {
  background: linear-gradient(135deg, var(--primary), #00b377);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 230, 153, 0.3);
}

.brand-details h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.brand-details span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-nav {
  flex-grow: 1;
}

.sidebar-nav ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-nav li {
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
}

.sidebar-nav li a i {
  font-size: 18px;
  transition: var(--transition-fast);
}

.sidebar-nav li:hover a {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.03);
}

.sidebar-nav li.active {
  background-color: var(--primary-glow);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.sidebar-nav li.active a {
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-dark);
}

.sidebar-footer p {
  margin-bottom: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.status-badge i {
  font-size: 8px;
}

.status-badge.online {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  height: 100vh;
  overflow-y: auto;
  padding: 30px 40px;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
}

.header-title h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.header-title p {
  font-size: 14px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.date-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-card);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 14px;
  color: var(--text-main);
  font-weight: 500;
}

.date-display i {
  color: var(--primary);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(0, 230, 153, 0.2);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
}

/* Views & Dynamic Tabs Container */
.view-container {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.tab-view {
  display: none;
  animation: fadeIn 0.4s ease;
  flex-grow: 1;
}

.tab-view.active {
  display: flex;
  flex-direction: column;
}

/* 1. DASHBOARD VIEW STYLING */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 25px;
  margin-bottom: 35px;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.kpi-card:hover {
  transform: translateY(-4px);
}

.kpi-clickable {
  cursor: pointer;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-clickable:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.kpi-clickable:active {
  transform: translateY(-2px);
}

.kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.kpi-info h3 {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.kpi-val {
  font-family: var(--font-heading);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-subtext {
  font-size: 11px;
  color: var(--text-dark);
  font-weight: 500;
  display: block;
}

/* Card Variations */
.kpi-card.violet {
  border-left: 5px solid var(--primary);
}
.kpi-card.violet .kpi-icon {
  background-color: var(--primary-glow);
  color: var(--primary);
}

.kpi-card.warning {
  border-left: 5px solid var(--warning);
}
.kpi-card.warning .kpi-icon {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}
.kpi-card.warning.active-alert {
  animation: pulseWarning 2s infinite;
  border-color: var(--warning);
}

.kpi-card.danger {
  border-left: 5px solid var(--danger);
}
.kpi-card.danger .kpi-icon {
  background-color: rgba(244, 63, 94, 0.1);
  color: var(--danger);
}
.kpi-card.danger.active-alert {
  animation: pulseDanger 2s infinite;
  border-color: var(--danger);
}

.kpi-card.success {
  border-left: 5px solid var(--success);
}
.kpi-card.success .kpi-icon {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

/* Dashboard Bottom Grid */
.dashboard-sections-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 25px;
  flex-grow: 1;
}

.dash-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-header h3 i {
  color: var(--primary);
}

.panel-body {
  padding: 20px;
  flex-grow: 1;
  overflow-y: auto;
  max-height: 420px;
}

/* Urgent Notification List */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 13px;
  animation: slideInLeft 0.3s ease;
}

.alert-item.stock-alert {
  background-color: rgba(245, 158, 11, 0.05);
  border-color: rgba(245, 158, 11, 0.15);
  color: #fef08a;
}

.alert-item.stock-alert i {
  color: var(--warning);
  margin-top: 3px;
}

.alert-item.expiry-alert {
  background-color: rgba(244, 63, 94, 0.05);
  border-color: rgba(244, 63, 94, 0.15);
  color: #fecdd3;
}

.alert-item.expiry-alert i {
  color: var(--danger);
  margin-top: 3px;
}

.alert-info p {
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-info span {
  font-size: 11px;
  color: var(--text-muted);
}

/* Common Components: Tables */
.compact-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.compact-table th {
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.compact-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.compact-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

.quick-stock-table-wrapper {
  overflow-x: auto;
}

/* 2. CATALOG ACTION BAR & TABLE */
.view-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  gap: 20px;
}

.filters-group {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-grow: 1;
  max-width: 650px;
}

.search-box {
  position: relative;
  flex-grow: 1;
}

.search-box i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dark);
  font-size: 15px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px 12px 48px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.select-box {
  position: relative;
  width: 200px;
}

.select-box i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dark);
  font-size: 14px;
  pointer-events: none;
}

.select-box select {
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px 12px 42px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  appearance: none;
  transition: border-color var(--transition-fast);
}

.select-box select:focus {
  border-color: var(--primary);
}

.select-box::after {
  content: '\f107';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dark);
  pointer-events: none;
  font-size: 14px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.btn-primary {
  background-color: var(--primary);
  color: #080f0c; /* High contrast text on neon green */
  box-shadow: 0 4px 12px rgba(0, 230, 153, 0.2);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.03);
  border-color: var(--text-muted);
}

.btn-success {
  background-color: var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover:not(:disabled) {
  background-color: var(--success-hover);
}

.btn-success:disabled {
  background-color: var(--border-color);
  color: var(--text-dark);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-danger-outline {
  background-color: transparent;
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--danger);
}

.btn-danger-outline:hover {
  background-color: rgba(244, 63, 94, 0.08);
  border-color: var(--danger);
}

.btn-block {
  width: 100%;
}

/* Master Data Table Container */
.table-container {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex-grow: 1;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.data-table th {
  padding: 18px 24px;
  background-color: rgba(15, 23, 42, 0.4);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.015);
}

/* Utility alignments and text colors */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }

.badges-row {
  display: flex;
  gap: 8px;
}

/* Status Pill Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.success {
  background-color: rgba(16, 185, 129, 0.1);
  color: #a7f3d0;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge.warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: #fef08a;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge.danger {
  background-color: rgba(244, 63, 94, 0.1);
  color: #fecdd3;
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.badge.info {
  background-color: rgba(99, 102, 241, 0.1);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Action Icon Buttons */
.action-btns {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  background-color: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-icon:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-icon.edit:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-icon.delete:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.table-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  color: var(--text-muted);
  text-align: center;
  gap: 16px;
}

.table-empty-state i {
  font-size: 48px;
  color: var(--text-dark);
}

/* 3. POS VIEW LAYOUT */
.pos-grid {
  display: grid;
  grid-template-columns: 1.6fr 1.4fr;
  gap: 30px;
  flex-grow: 1;
  min-height: 0; /* Important for flex-child scrolling */
}

.pos-search-panel, .pos-cart-panel {
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 180px);
}

.pos-panel-header {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.pos-panel-header h3 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-panel-header h3 i {
  color: var(--primary);
}

.pos-panel-header.pos-cart-panel {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

/* Cart panel top row (title + clear btn) */
.pos-panel-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.pos-panel-header-row h3 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-panel-header-row h3 i {
  color: var(--primary);
}

/* Customer Details Bar in Cart Panel */
.customer-details-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 14px;
  background-color: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.customer-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  background-color: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: border-color var(--transition-fast);
}

.customer-field i {
  color: var(--primary);
  font-size: 13px;
  flex-shrink: 0;
}

.customer-field input {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 13px;
  width: 100%;
  padding: 0;
}

.customer-field input::placeholder {
  color: var(--text-dark);
}

.customer-field:focus-within {
  border-color: var(--primary);
}

/* POS qty input in search results */
.pos-qty-input {
  width: 65px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 13px;
  text-align: center;
  transition: border-color var(--transition-fast);
}

.pos-qty-input:focus {
  border-color: var(--primary);
}

.pos-search-results {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

/* POS Interactive suggestion rows */
.interactive-table tbody tr {
  cursor: pointer;
}

.interactive-table tbody tr:hover {
  background-color: rgba(99, 102, 241, 0.08);
}

/* POS Cart specific stylings */
.cart-items-wrapper {
  flex-grow: 1;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  background-color: rgba(15, 23, 42, 0.2);
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cart-table th {
  padding: 12px 16px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.cart-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  vertical-align: middle;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  overflow: hidden;
}

.qty-control button {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  font-weight: bold;
  font-size: 14px;
  transition: var(--transition-fast);
}

.qty-control button:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--primary);
}

.qty-control span {
  width: 32px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
}

.cart-summary {
  background-color: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.summary-row.total {
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
  margin-top: 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 20px;
}

.summary-row.total span:last-child {
  color: var(--success);
}

/* 4. MODALS STYLING */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 600px;
  max-width: 90%;
  max-height: 90vh;
  z-index: 1;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
  animation: slideInDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.modal-close:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--danger);
}

#medicine-form {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input, .form-group select, .form-group textarea {
  background-color: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color var(--transition-fast);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
}

.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 6; }

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

/* Receipt Modal & Print Area Styling */
.invoice-content {
  width: 480px;
}

.printable-invoice {
  padding: 30px;
  background-color: white;
  color: #1e293b;
  font-family: 'Courier New', Courier, monospace;
}

.invoice-header {
  text-align: center;
  margin-bottom: 25px;
  border-bottom: 2px dashed #cbd5e1;
  padding-bottom: 15px;
}

.invoice-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #0f172a;
}

.invoice-brand h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.invoice-brand i {
  font-size: 20px;
  color: #ef4444; /* Standard Red medical cross on print */
}

.invoice-header .sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
}

.invoice-header .phone {
  font-size: 11px;
  color: #64748b;
}

.invoice-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 12px;
  color: #334155;
}

/* Customer info on receipt */
.invoice-customer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0 12px 0;
  border-bottom: 1px dashed #cbd5e1;
  margin-bottom: 14px;
  font-size: 12px;
  color: #334155;
}

.customer-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-row i {
  color: #64748b;
  width: 14px;
  text-align: center;
}

.invoice-items-table-wrapper {
  margin-bottom: 20px;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.invoice-table th {
  padding: 8px 0;
  border-bottom: 1px solid #94a3b8;
  color: #475569;
  font-weight: bold;
}

.invoice-table td {
  padding: 10px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.invoice-totals {
  border-top: 2px dashed #cbd5e1;
  padding-top: 15px;
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  width: 220px;
  font-size: 12px;
  color: #475569;
}

.totals-row.grand-total {
  border-top: 1px solid #1e293b;
  padding-top: 6px;
  font-weight: bold;
  font-size: 14px;
  color: #0f172a;
}

.invoice-footer {
  text-align: center;
  font-size: 11px;
  color: #64748b;
  border-top: 1px solid #cbd5e1;
  padding-top: 15px;
}

.invoice-footer .message {
  font-weight: bold;
  color: #334155;
  margin-bottom: 4px;
}

.invoice-footer .alert-note {
  font-style: italic;
  font-size: 9px;
  margin-bottom: 12px;
}

.barcode-sim {
  font-size: 16px;
  letter-spacing: 2px;
  margin-top: 8px;
  opacity: 0.6;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  font-size: 14px;
  min-width: 300px;
  max-width: 400px;
  animation: slideInLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.toast.success {
  border-left: 4px solid var(--success);
}
.toast.success i {
  color: var(--success);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}
.toast.warning i {
  color: var(--warning);
}

.toast.error {
  border-left: 4px solid var(--danger);
}
.toast.error i {
  color: var(--danger);
}

/* Print CSS */
@media print {
  body * {
    visibility: hidden;
  }
  .printable-invoice, .printable-invoice * {
    visibility: visible;
  }
  .printable-invoice {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
  }
  .hide-on-print {
    display: none !important;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInLeft {
  from { transform: translateX(50px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes pulseWarning {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes pulseDanger {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .sidebar {
    width: 220px;
    padding: 20px 10px;
  }
  .brand-details h1 {
    font-size: 16px;
  }
  .main-content {
    padding: 20px;
  }
  .pos-grid {
    grid-template-columns: 1fr;
  }
  .pos-search-panel, .pos-cart-panel {
    max-height: none;
  }
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  .sidebar-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
  }
  .sidebar-nav li a {
    padding: 8px 12px;
    font-size: 13px;
  }
  .main-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .dashboard-sections-grid {
    grid-template-columns: 1fr;
  }
  .view-actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .filters-group {
    flex-direction: column;
    max-width: none;
  }
  .select-box {
    width: 100%;
  }
}

/* Returns System & Rebranding Theme Styles */
.btn-danger {
  background-color: var(--danger);
  color: white;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--danger-hover);
  transform: translateY(-1px);
}

.btn-danger:disabled {
  background-color: var(--border-color);
  color: var(--text-dark);
  cursor: not-allowed;
  box-shadow: none;
}

.return-qty-input {
  width: 70px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 6px;
  text-align: center;
  font-family: var(--font-body);
}

.return-qty-input:focus {
  border-color: var(--danger);
}

#return-modal .modal-content {
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 25px rgba(244, 63, 94, 0.1);
}
