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

:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* HSL Color System */
  --bg-base: hsl(224, 25%, 8%);
  --bg-surface: hsla(223, 20%, 12%, 0.65);
  --bg-sidebar: hsla(224, 25%, 10%, 0.85);
  --border-glow: hsla(263, 60%, 55%, 0.15);
  --border-light: hsla(224, 15%, 22%, 0.45);
  
  --text-primary: hsl(210, 40%, 98%);
  --text-secondary: hsl(215, 20%, 80%);
  --text-muted: hsl(215, 15%, 60%);
  
  /* Accent Colors */
  --primary: hsl(263, 85%, 65%);       /* Neon Purple */
  --primary-hover: hsl(263, 90%, 72%);
  --primary-glow: hsla(263, 85%, 65%, 0.3);
  
  --success: hsl(150, 80%, 42%);       /* Emerald Green */
  --success-hover: hsl(150, 85%, 48%);
  --success-glow: hsla(150, 80%, 42%, 0.3);
  
  --warning: hsl(35, 90%, 52%);        /* Warm Gold */
  
  --danger: hsl(350, 80%, 55%);        /* Neon Coral */
  --danger-glow: hsla(350, 80%, 55%, 0.3);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px 5px var(--primary-glow);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

:root.light-mode {
  --bg-base: hsl(210, 25%, 95%);
  --bg-surface: hsla(0, 0%, 100%, 0.85);
  --bg-sidebar: hsla(0, 0%, 100%, 0.98);
  --border-glow: hsla(212, 60%, 55%, 0.15);
  --border-light: hsla(210, 15%, 85%, 1);
  
  --text-primary: hsl(224, 25%, 15%);
  --text-secondary: hsl(220, 15%, 40%);
  --text-muted: hsl(220, 10%, 60%);
  
  --primary: hsl(212, 100%, 48%);       /* Blue */
  --primary-hover: hsl(212, 90%, 42%);
  --primary-glow: hsla(212, 100%, 48%, 0.15);
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.05);
}

body.light-theme {
  --bg-base: hsl(210, 20%, 98%);
  --bg-surface: hsla(0, 0%, 100%, 0.85);
  --bg-sidebar: hsla(0, 0%, 100%, 0.95);
  --border-glow: hsla(263, 60%, 55%, 0.1);
  --border-light: hsla(210, 15%, 85%, 0.6);
  
  --text-primary: hsl(220, 30%, 15%);
  --text-secondary: hsl(215, 20%, 35%);
  --text-muted: hsl(215, 12%, 50%);
  
  --shadow-glow: 0 0 15px 3px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  background-image: 
    radial-gradient(at 10% 20%, hsla(263, 50%, 40%, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 80%, hsla(150, 50%, 40%, 0.05) 0px, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseLowStock {
  0% { box-shadow: 0 0 0 0 hsla(350, 80%, 55%, 0.4); }
  70% { box-shadow: 0 0 0 8px hsla(350, 80%, 55%, 0); }
  100% { box-shadow: 0 0 0 0 hsla(350, 80%, 55%, 0); }
}

@keyframes pulseOpenShift {
  0% { box-shadow: 0 0 0 0 hsla(150, 80%, 42%, 0.4); }
  70% { box-shadow: 0 0 0 8px hsla(150, 80%, 42%, 0); }
  100% { box-shadow: 0 0 0 0 hsla(150, 80%, 42%, 0); }
}

@keyframes cartBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.animate-fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Layout SPA */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 24px;
  flex-shrink: 0;
  backdrop-filter: blur(10px);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), hsl(280, 85%, 65%));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--primary-glow);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(to right, var(--text-primary), hsl(210, 30%, 80%));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.user-badge-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.user-name-sidebar {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-sidebar {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  background: var(--border-light);
  border-radius: 4px;
  align-self: flex-start;
  color: var(--text-secondary);
}

/* ================= NAV LINKS & ACCORDION ================= */
.nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  overflow-y: auto;
}

.nav-group-title {
  padding: 12px 20px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  user-select: none;
}
.nav-group-title:hover {
  background-color: hsla(0,0%,50%,0.05);
}
.nav-group-title.active {
  color: var(--primary);
}
.nav-group-title .chevron {
  transition: transform 0.3s ease;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}
.nav-group-title.expanded .chevron {
  transform: rotate(180deg);
}

.nav-group-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.nav-group-content.expanded {
  max-height: 500px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px 10px 45px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: linear-gradient(90deg, var(--primary-glow) 0%, transparent 100%);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--primary-glow) 0%, transparent 100%);
  color: var(--primary);
  border-left: 3px solid var(--primary);
  font-weight: 600;
}

.logout-button {
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  transition: background-color 0.3s ease;
}

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

.view-title h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.view-title p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* Glassmorphic Components */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: hsla(263, 85%, 65%, 0.25);
}

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

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  font-family: var(--font-family);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-primary);
  box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px var(--primary-glow);
}

.btn-success {
  background-color: var(--success);
  color: var(--text-primary);
  box-shadow: 0 4px 10px var(--success-glow);
}

.btn-success:hover {
  background-color: var(--success-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px var(--success-glow);
}

.btn-danger {
  background-color: var(--danger);
  color: var(--text-primary);
  box-shadow: 0 4px 10px var(--danger-glow);
}

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

.btn-secondary {
  background-color: transparent;
  border-color: var(--border-light);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background-color: hsla(224, 15%, 22%, 0.4);
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

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

/* Shift Info Banner */
.shift-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: hsla(150, 80%, 42%, 0.06);
  border: 1px solid hsla(150, 80%, 42%, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.shift-banner.no-shift {
  background: hsla(350, 80%, 55%, 0.05);
  border-color: hsla(350, 80%, 55%, 0.25);
}

.shift-banner-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pulse-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--success);
  animation: pulseOpenShift 2s infinite;
}

.pulse-indicator.no-shift {
  background-color: var(--danger);
  animation: pulseLowStock 2s infinite;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-input {
  width: 100%;
  background-color: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  transition: border-color 0.2s ease, background-color 0.3s ease, color 0.3s ease;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--primary-glow);
}

.form-select {
  background: hsla(224, 25%, 8%, 0.6);
  border: 1px solid var(--border-light);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

/* Data Tables */
.table-container {
  overflow-x: auto;
  margin-top: 16px;
}

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

.data-table th {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
  color: var(--text-primary);
}

.data-table tr:hover td {
  background-color: hsla(224, 15%, 22%, 0.2);
}

/* Dashboard Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  margin-top: 8px;
  color: var(--text-primary);
}

.stat-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.dashboard-charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .dashboard-charts {
    grid-template-columns: 1fr;
  }
}

/* POS Layout */
.pos-layout {
  display: grid;
  grid-template-columns: 1.8fr 1.2fr;
  gap: 24px;
  height: calc(100vh - 180px);
}

.products-catalog {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pos-search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0 14px;
  margin-bottom: 14px;
  height: 46px;
  gap: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pos-search-bar:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px hsla(263, 85%, 65%, 0.15);
}

.pos-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.pos-search-divider {
  width: 1px;
  height: 22px;
  background: var(--border-light);
  margin: 0 14px;
  flex-shrink: 0;
}

.pos-search-input {
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
  min-width: 0;
}

.pos-search-input::placeholder {
  color: var(--text-muted);
}


.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 4px;
}

.product-item {
  display: flex;
  flex-direction: column;
  padding: 16px;
  cursor: pointer;
  min-height: 160px;
  justify-content: space-between;
}

.product-item.low-stock {
  border-color: var(--danger-glow);
}

.product-item-barcode {
  font-size: 11px;
  color: var(--text-muted);
}

.product-item-name {
  font-weight: 600;
  font-size: 15px;
  margin-top: 4px;
  flex-grow: 1;
}

.product-item-stock {
  font-size: 12px;
  margin-top: 10px;
  color: var(--success);
}

.product-item.low-stock .product-item-stock {
  color: var(--danger);
  font-weight: 600;
}

.product-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.product-item-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* POS Multiple Tickets Tabs */
.pos-tickets-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ticket-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: hsla(224, 25%, 8%, 0.4);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  border-bottom: none;
}

.ticket-tab.active {
  background: var(--bg-surface);
  color: var(--primary);
  border-color: var(--primary);
  border-bottom: 2px solid var(--bg-surface);
  margin-bottom: -1px;
  z-index: 2;
  position: relative;
  box-shadow: 0 -4px 15px var(--primary-glow);
}

.ticket-tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
}

.ticket-tab-close:hover {
  background: var(--danger-glow);
  color: var(--danger);
  opacity: 1;
}

.ticket-tab-add {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  transition: all 0.2s ease;
}

.ticket-tab-add:hover {
  background: var(--primary);
  color: #fff;
}

.cart-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.cart-items {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding-right: 4px;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: hsla(224, 25%, 8%, 0.4);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-item-details {
  flex-grow: 1;
  margin-right: 12px;
}

.cart-item-name {
  font-size: 14px;
  font-weight: 600;
}

.cart-item-price {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.cart-item-qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 16px;
}

.cart-item-qty {
  font-size: 14px;
  font-weight: 600;
  width: 24px;
  text-align: center;
}

.cart-item-subtotal {
  font-size: 14px;
  font-weight: 700;
  margin-right: 16px;
}

.cart-summary {
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.summary-row.total {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  border-top: 1px dashed var(--border-light);
  padding-top: 8px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-close {
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
}

/* Badges */
.badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary { background: hsla(263, 85%, 65%, 0.15); color: hsl(263, 85%, 65%); border: 1px solid hsla(263, 85%, 65%, 0.3); }
.badge-success { background: hsla(150, 80%, 42%, 0.15); color: hsl(150, 80%, 42%); border: 1px solid hsla(150, 80%, 42%, 0.3); }
.badge-danger { background: hsla(350, 80%, 55%, 0.15); color: hsl(350, 80%, 55%); border: 1px solid hsla(350, 80%, 55%, 0.3); }
.badge-warning { background: hsla(35, 90%, 52%, 0.15); color: hsl(35, 90%, 52%); border: 1px solid hsla(35, 90%, 52%, 0.3); }

/* Login Container */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100vw;
  background: radial-gradient(circle at 50% -20%, var(--bg-surface), var(--bg-base));
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  top: -20%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: var(--primary-glow);
  filter: blur(100px);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

.login-container::after {
  content: '';
  position: absolute;
  bottom: -20%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background: var(--success-glow);
  filter: blur(100px);
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  background: var(--bg-surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 1;
  position: relative;
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.login-logo-text {
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(to right, var(--text-primary), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.demo-credentials {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
  text-align: center;
}

.demo-credentials h4 {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 600;
  text-transform: uppercase;
}

.demo-account-chip {
  display: inline-block;
  font-size: 11px;
  padding: 4px 8px;
  background: hsla(224, 25%, 8%, 0.5);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  margin: 4px 4px 0 0;
  cursor: pointer;
  transition: border-color 0.2s;
}

.demo-account-chip:hover {
  border-color: var(--primary);
}

/* Concurrency Panel styling */
.concurrency-test-panel {
  margin-top: 24px;
}

.concurrency-threads {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.thread-item {
  padding: 8px 12px;
  background: hsla(224, 25%, 8%, 0.5);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.thread-status {
  font-weight: 600;
}

.thread-idle { color: var(--text-muted); }
.thread-running { color: var(--primary); }
.thread-success { color: var(--success); }
.thread-error { color: var(--danger); }

/* Timeline styling for Product History */
.audit-timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.timeline-item {
  display: flex;
  gap: 16px;
  position: relative;
}

.timeline-item::after {
  content: '';
  position: absolute;
  top: 24px;
  left: 20px;
  bottom: -24px;
  width: 2px;
  background-color: var(--border-light);
}

.timeline-item:last-child::after {
  display: none;
}

.timeline-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-surface);
  border: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
}

.timeline-dot.creacion { border-color: var(--success); color: var(--success); }
.timeline-dot.modificacion { border-color: var(--primary); color: var(--primary); }
.timeline-dot.ajuste_stock { border-color: var(--warning); color: var(--warning); }

.timeline-content {
  flex-grow: 1;
  background-color: hsla(224, 15%, 22%, 0.15);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.timeline-desc {
  font-size: 14px;
  line-height: 1.4;
}

.timeline-delta {
  margin-top: 8px;
  padding: 8px;
  background-color: hsla(224, 25%, 8%, 0.6);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 11px;
}

.delta-del { color: var(--danger); text-decoration: line-through; margin-right: 8px; }
.delta-add { color: var(--success); }

/* Collapsible details styling */
.timeline-delta-details summary:hover {
  color: var(--primary-hover) !important;
  text-decoration: underline;
}
.timeline-delta-details[open] summary {
  color: var(--text-secondary) !important;
  margin-bottom: 4px;
}

/* --- RESPONSIVE DESIGN (Celulares y Tablets) --- */

/* Por defecto (PC), la hamburger-topbar actúa como un contenedor superior derecho para acciones globales */
.hamburger-topbar {
  display: flex !important;
  justify-content: flex-end;
  align-items: center;
  padding: 16px 32px;
  background: transparent;
  border-bottom: none;
}

/* Ocultar el botón de menú y el logo en PC */
.hamburger-topbar .hamburger-btn,
.hamburger-topbar #topbar-brand-title {
  display: none !important;
}

@media (max-width: 1024px) {
  /* En Tablets y Celulares: Mostrar Hamburguesa y Ocultar Sidebar */
  .app-container {
    flex-direction: column;
  }
  
  .hamburger-topbar {
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9997;
    height: 60px;
  }

  /* Mostrar el botón de menú y el logo en móviles */
  .hamburger-topbar .hamburger-btn,
  .hamburger-topbar #topbar-brand-title {
    display: flex !important;
  }

  .main-content {
    padding-top: 60px; /* Espacio para el topbar */
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -280px;
    z-index: 9999;
    transition: left 0.3s ease;
    box-shadow: 4px 0 15px rgba(0,0,0,0.5);
    overflow-y: hidden; /* Scroll is handled by .nav-links now */
    overflow-x: hidden;
  }

  .sidebar.open {
    left: 0;
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    backdrop-filter: blur(3px);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .hamburger-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  /* En Celulares: Ajustar Módulo POS y Grillas */
  
  .main-content {
    padding: 16px;
    padding-top: 76px; /* 60px topbar + 16px padding */
  }

  /* El layout del POS pasa a ser una columna (Flex vertical) */
  .pos-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px);
    gap: 16px;
  }

  /* Los productos toman el espacio disponible arriba */
  .products-catalog {
    flex: 1;
    min-height: 0; /* Permite que el flex child encoja y habilita el scroll interno */
  }

  /* El panel de cobro se queda fijo abajo, ocupando máximo 40% de la pantalla */
  .checkout-panel {
    flex-shrink: 0;
    height: auto;
    max-height: 45vh;
    border-left: none;
    border-top: 2px solid var(--border-light);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    overflow-y: auto;
  }

  /* La grilla de productos se reduce a 2 columnas */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding-right: 2px;
  }
  
  .product-card {
    padding: 12px;
  }
  
  .product-img-placeholder {
    height: 90px;
  }

  /* Formularios y Modales ocupan el ancho completo */
  .modal-content {
    width: 95%;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  /* Celulares muy pequeños */
  .products-grid {
    grid-template-columns: 1fr; /* 1 sola columna de productos */
  }
}

