/* Store Room Styles - Dark Theme (Current Admin Standard) */
/* Base: AdminNew/styles.css + Store-specific additions */

:root {
  --bg: #141414;
  --panel: #1c1c1c;
  --panel-hover: #242424;
  --border: #262626;
  --border-light: #333333;
  --muted: #737373;
  --text: #d4d4d4;
  --text-bright: #f5f5f5;
  --primary: #22c55e;
  --primary-dark: #16a34a;
  --accent: #38bdf8;
  --danger: #ef4444;
  --warn: #f59e0b;
  --info: #3b82f6;
  --success: #22c55e;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, "Noto Sans", sans-serif;

  /* Status Filter Colors (Soft) */
  --status-active: #60a5fa;
  --status-active-bg: rgba(96, 165, 250, 0.15);
  --status-active-border: rgba(96, 165, 250, 0.3);

  --status-pending: #fbbf24;
  --status-pending-bg: rgba(251, 191, 36, 0.15);
  --status-pending-border: rgba(251, 191, 36, 0.3);

  --status-completed: #4ade80;
  --status-completed-bg: rgba(74, 222, 128, 0.15);
  --status-completed-border: rgba(74, 222, 128, 0.3);

  --status-cancelled: #f87171;
  --status-cancelled-bg: rgba(248, 113, 113, 0.15);
  --status-cancelled-border: rgba(248, 113, 113, 0.3);

  --status-all: #a78bfa;
  --status-all-bg: rgba(167, 139, 250, 0.15);
  --status-all-border: rgba(167, 139, 250, 0.3);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}

.app-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-bright);
  flex-shrink: 0;
}

.session-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Container */
.app-container {
  max-width: 1920px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  box-sizing: border-box;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Sub-tab buttons (inside listTitle h2 for Items tab) */
.sub-tab-group { display: inline-flex; gap: 2px; align-items: center; }
.sub-tab-btn {
  padding: 3px 10px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 0.875rem; font-family: inherit; font-weight: 500; transition: all 0.15s;
}
.sub-tab-btn:hover { background: var(--panel-hover); color: var(--text); }
.sub-tab-btn.active { background: var(--panel-hover); color: var(--text-bright); border-color: var(--border-light); }
body.light-mode .sub-tab-btn { color: #6b7280; }
body.light-mode .sub-tab-btn:hover { background: #f1f5f9; color: #374151; }
body.light-mode .sub-tab-btn.active { background: #e5e7eb; color: #111827; border-color: #9ca3af; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.tab {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tab:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.tab.active {
  color: var(--text-bright);
  background: var(--panel-hover);
  border-color: var(--accent);
}

/* Panel & Card */
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.card h2 {
  margin: 0 0 20px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card h2 .title-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card h2 small {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}

/* Status Filter Tabs (in card header) */
.status-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.status-filter-tab {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-filter-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.status-filter-tab.active-status {
  background: var(--status-active-bg);
  border-color: var(--status-active-border);
  color: var(--status-active);
}

.status-filter-tab.pending-status {
  background: var(--status-pending-bg);
  border-color: var(--status-pending-border);
  color: var(--status-pending);
}

.status-filter-tab.completed-status {
  background: var(--status-completed-bg);
  border-color: var(--status-completed-border);
  color: var(--status-completed);
}

.status-filter-tab.cancelled-status {
  background: var(--status-cancelled-bg);
  border-color: var(--status-cancelled-border);
  color: var(--status-cancelled);
}

.status-filter-tab.all-status {
  background: var(--status-all-bg);
  border-color: var(--status-all-border);
  color: var(--status-all);
}

.status-filter-tab .count {
  font-size: 11px;
  opacity: 0.8;
}

.card .content {
  padding: 0;
}

/* Two-Pane Grid System */
.grid {
  display: grid;
  grid-template-columns: 1fr 0fr;
  grid-auto-rows: 1fr;
  gap: 16px;
  margin-top: 14px;
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.grid.split-view {
  grid-template-columns: 1fr 1fr;
}

/* List card (listCard) - first column */
#listCard {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#listCard > .content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* Form card (formCard) - second column, hidden by default */
#formCard {
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.grid.split-view #formCard {
  opacity: 1;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.grid.split-view #formCard > .content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.tab-slot, .form-slot {
  min-height: 0;
}

.close-form-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  padding: 4px 8px;
  line-height: 1;
  transition: all 0.2s ease;
}

.close-form-btn:hover {
  color: var(--danger);
  background: var(--panel-hover);
  border-radius: 6px;
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* Filter Panel */
.filter-panel {
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
}

.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filter-row:last-child {
  margin-bottom: 0;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

/* Buttons */
.btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 16px;
  background: var(--panel-hover);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--border-light);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--primary);
  color: #052e16;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.danger:hover {
  background: #dc2626;
}

.btn.good {
  background: var(--success);
  color: #052e16;
}

.btn.good:hover {
  background: var(--primary-dark);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.create-toggle {
  background: var(--accent);
  color: #0c4a6e;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn.create-toggle:hover {
  background: #0ea5e9;
}

.btn.create-toggle::before {
  content: '+';
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.btn-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 32px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.btn-close:hover {
  background: var(--panel-hover);
  color: var(--text);
}

.btn-icon {
  background: transparent;
  border: 0;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 16px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.btn-icon:hover {
  background: var(--panel-hover);
}

/* Inputs */
.input, select, textarea, input {
  background: #111111;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
}

.input:focus, select:focus, textarea:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

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

select {
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--sans);
  line-height: 1.5;
}

/* Checkbox Label */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

/* Form Row */
.form-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Override .row inside forms */
.card .content .row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  grid-template-columns: unset;
  padding: 0;
  background: transparent;
  border: none;
  cursor: default;
}

.card .content .row:hover {
  background: transparent;
  border-color: transparent;
}

.card .content .row:focus {
  outline: none;
}

/* Column layout for forms */
.col {
  flex: 1;
  min-width: 320px;
}

/* Split layout */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

/* List/Table */
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-header {
  display: grid;
  grid-template-columns: 100px 1fr 1fr 120px 120px 180px 180px 140px;
  gap: 12px;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.row {
  display: grid;
  grid-template-columns: 100px 1fr 1fr 120px 120px 180px 180px 140px;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #111111;
  border: 1px solid var(--border);
  transition: all 0.15s ease;
  cursor: pointer;
}

.row:hover {
  background: var(--panel-hover);
  border-color: var(--border-light);
}

.row:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Table wrapper with scroll */
.table-scroll-wrapper {
  overflow-x: auto;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
}

.table-scroll-wrapper::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-scroll-wrapper::-webkit-scrollbar-track {
  background: var(--panel);
  border-radius: 5px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 5px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.table-scroll-wrapper table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
}

/* Table styles */
table {
  width: 100%;
  border-collapse: collapse;
}

tr.inactive-row {
  opacity: 0.6;
  background: rgba(156, 163, 175, 0.1) !important;
}

th, td {
  text-align: left;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #111111;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--panel-hover);
}

tbody tr.selected {
  background: rgba(56, 189, 248, 0.15);
}

.table-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--border-light);
  color: var(--text);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  gap: 6px;
}

/* Status Badges */
.badge.status-active {
  background: var(--success);
  color: #052e16;
}

.badge.status-inactive {
  background: var(--border-light);
  color: var(--muted);
}

.badge.variant-badge {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  font-size: 11px;
  padding: 2px 7px;
  margin-left: 6px;
}

.badge.status-in_progress {
  background: var(--warn);
  color: #1f2937;
}

.badge.status-completed {
  background: var(--success);
  color: #052e16;
}

.badge.status-cancelled {
  background: var(--danger);
  color: #fff;
}

.badge.status-draft {
  background: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.badge.status-approved {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge.status-partial {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

/* form-static: read-only display field */
.form-static {
  padding: 6px 0;
  color: var(--text);
  font-size: 0.9rem;
  min-height: 32px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
  line-height: 1;
  color: var(--text-bright);
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Empty State */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-bright);
}

.modal-body {
  padding: 24px;
}

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

/* Form */
.form-section {
  margin-bottom: 24px;
}

.form-section:last-child {
  margin-bottom: 0;
}

.form-section h3 {
  margin: 0 0 18px 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}

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

.section-header-row h3 {
  margin: 0;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text);
  font-size: 15px;
}

.form-group.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.calc-display {
  padding: 8px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: not-allowed;
  min-height: 38px;
  display: flex;
  align-items: center;
}

.hint {
  margin: 6px 0 0 0;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Utility Classes */
.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--mono);
}

.tiny {
  font-size: 12px;
}

.right {
  text-align: right;
}

/* Notifications */
.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 2000;
  min-width: 300px;
  max-width: 500px;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}

.notification.show {
  transform: translateY(0);
  opacity: 1;
}

.notification-success {
  border-left: 4px solid var(--success);
}

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

.notification-info {
  border-left: 4px solid var(--info);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .grid.split-view {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .app-header {
    flex-wrap: wrap;
  }

  .tabs {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
  }

  .grid.split-view {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 600px) {
  .app-header {
    padding: 8px 12px;
  }

  .app-title {
    font-size: 16px;
  }

  .tabs {
    gap: 2px;
  }

  .tab {
    padding: 6px 12px;
    font-size: 12px;
  }

  .session-actions {
    gap: 4px;
  }

  .session-actions .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .app-container {
    padding: 12px;
  }

  .panel,
  .card {
    padding: 16px;
  }

  .toolbar,
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar .btn,
  .toolbar .input,
  .toolbar select {
    width: 100%;
  }

  .notification {
    left: 20px;
    right: 20px;
    min-width: auto;
  }
}

/* Accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  .app-header,
  .app-container,
  .toolbar,
  .tabs,
  .notification,
  .session-actions,
  #main-grid {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* ========================================
   STORE-SPECIFIC STYLES
   ======================================== */

/* Low stock row highlighting */
tr.low-stock td {
  color: var(--danger);
}

tr.out-of-stock td {
  color: var(--danger);
  font-weight: 700;
}

/* Variant row styling */
tr.variant-row {
  border-left: 3px solid var(--accent);
  background: rgba(56, 189, 248, 0.05);
}

tr.variant-row td:first-child {
  padding-left: 28px;
}

/* Count status badges */
.badge.count-in_progress {
  background: var(--status-pending-bg);
  border: 1px solid var(--status-pending-border);
  color: var(--status-pending);
}

.badge.count-completed {
  background: var(--status-completed-bg);
  border: 1px solid var(--status-completed-border);
  color: var(--status-completed);
}

.badge.count-cancelled {
  background: var(--status-cancelled-bg);
  border: 1px solid var(--status-cancelled-border);
  color: var(--status-cancelled);
}

/* Report placeholder cards */
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.report-card {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  transition: all 0.2s ease;
}

.report-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.report-card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bright);
}

.report-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* Color swatch display */
.color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
  vertical-align: middle;
  margin-right: 6px;
}

/* Variance highlighting in stock count */
td.variance-positive {
  color: var(--success);
}

td.variance-negative {
  color: var(--danger);
}

/* Editable count input in stock count detail */
.count-input {
  width: 80px;
  padding: 6px 10px;
  text-align: right;
}

/* ========================================
   ENHANCED MODEL STYLES (2026-02-09)
   ======================================== */

/* Hierarchical Category Tree */
.category-tree-container {
  padding: 16px;
  background: var(--panel);
  border-radius: 8px;
  border: 1px solid var(--border);
  max-height: calc(100vh - 300px);
  overflow-y: auto;
}

.category-tree {
  font-size: 14px;
}

.category-tree-item {
  margin-bottom: 2px;
}

.category-tree-item.level-0 .category-row {
  background: linear-gradient(to right, rgba(255, 255, 255, 0.02), var(--panel));
  font-size: 15px;
}

.category-tree-item.level-1 .category-row {
  background: rgba(255, 255, 255, 0.01);
  font-size: 14px;
}

.category-tree-item.level-2 .category-row {
  font-size: 13px;
  opacity: 0.95;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
  margin-bottom: 4px;
}

.category-row:hover {
  background: var(--panel-hover);
  border-color: var(--border-light);
  transform: translateX(2px);
}

.category-row.selected {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.item-count-badge {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.expand-icon {
  width: 20px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.expand-icon:hover {
  color: var(--text);
}

.expand-icon.expanded {
  transform: rotate(0deg);
}

.expand-icon-placeholder {
  width: 20px;
  display: inline-block;
}

.category-name {
  font-weight: 600;
  color: var(--text-bright);
  min-width: 150px;
}

.category-path {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

.add-subcategory {
  margin-left: auto;
  padding: 4px 8px;
  font-size: 11px;
  background: rgba(34, 197, 94, 0.1);
  color: var(--primary);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-subcategory:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--primary);
}

/* Alternate Suppliers Editor */
.alt-supplier-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1fr 0.8fr auto;
  gap: 8px;
  margin-bottom: 8px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  align-items: center;
}

.alt-supplier-row:hover {
  border-color: var(--border-light);
}

.alt-sup-select,
.alt-sup-sku,
.alt-sup-cost,
.alt-sup-lead {
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
}

.alt-sup-select:focus,
.alt-sup-sku:focus,
.alt-sup-cost:focus,
.alt-sup-lead:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--panel);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.btn.secondary {
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.btn.secondary:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: var(--accent);
}

/* Enhanced Badges */
.badge.interchangeable-badge {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
  font-size: 11px;
  padding: 3px 8px;
  font-weight: 600;
}

.badge.brand-specific-badge {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warn);
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 11px;
  padding: 3px 8px;
  font-weight: 600;
}

.badge.alt-suppliers-badge {
  background: rgba(59, 130, 246, 0.15);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.3);
  font-size: 10px;
  padding: 2px 6px;
  font-weight: 600;
}

.badge.variant-badge {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.3);
  font-size: 10px;
  padding: 2px 6px;
  font-weight: 600;
}

.badge.brand-badge {
  background: rgba(96, 165, 250, 0.15);
  color: var(--status-active);
  border: 1px solid rgba(96, 165, 250, 0.3);
  font-size: 11px;
  padding: 3px 8px;
  font-weight: 500;
}

/* Small button variant */
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  min-width: auto;
  height: auto;
}

/* Checkbox group enhancements */
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* Form hints */
.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* Alternate Suppliers Container */
#altSuppliersContainer {
  margin-bottom: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

#altSuppliersContainer::-webkit-scrollbar {
  width: 8px;
}

#altSuppliersContainer::-webkit-scrollbar-track {
  background: var(--bg);
  border-radius: 4px;
}

#altSuppliersContainer::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

#altSuppliersContainer::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Section header row enhancements */
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.toggle-label {
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  margin-right: 6px;
}

/* View Mode - Disabled Input Styling */
input:disabled,
textarea:disabled,
select:disabled {
  background: #1a1a1a;
  border-color: #333;
  color: #e5e7eb;
  cursor: not-allowed;
  opacity: 0.85;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive adjustments for alternate suppliers */
@media (max-width: 1200px) {
  .alt-supplier-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .btn-icon {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================
   STOCK COUNT REDESIGN - PROGRESS UI
   ======================================== */

.stock-count-progress {
  background: var(--panel);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

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

.progress-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text-bright);
}

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

.progress-bar {
  height: 24px;
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.3s ease;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.progress-stat {
  text-align: center;
  padding: 8px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.progress-stat .stat-value {
  display: block;
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 4px;
}

.progress-stat .stat-value.exact {
  color: var(--success);
}

.progress-stat .stat-value.over {
  color: var(--warn);
}

.progress-stat .stat-value.under {
  color: var(--danger);
}

.progress-stat .stat-value.remaining {
  color: var(--muted);
}

.progress-stat .stat-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Count Item Details Modal */
.count-item-details {
  background: var(--bg);
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row label {
  font-weight: 500;
  color: var(--muted);
}

.detail-row .detail-value {
  font-weight: 600;
  color: var(--text-bright);
}

/* Variance Colors */
.variance-positive {
  color: var(--warn);
  font-weight: bold;
}

.variance-negative {
  color: var(--danger);
  font-weight: bold;
}

.variance-zero {
  color: var(--success);
  font-weight: bold;
}

/* Info Message */
.info-message {
  background: rgba(59, 130, 246, 0.1);
  border-left: 3px solid var(--primary);
  padding: 12px;
  margin-top: 16px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text);
}

.info-message strong {
  color: var(--text-bright);
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: 14px;
}

/* Small Button for Count Actions */
.btn-sm {
  padding: 4px 12px;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sm:hover {
  background: var(--panel-hover);
  border-color: var(--border-light);
}

.btn-sm.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-sm.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* Toolbar (for search and filter) */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--panel);
  border-radius: 6px;
  border: 1px solid var(--border);
}

.toolbar .input {
  flex: 1;
  min-width: 250px;
}

/* Success button variant */
.btn.success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn.success:hover {
  background: #16a34a;
  border-color: #16a34a;
}

/* Responsive adjustments for Stock Count */
@media (max-width: 768px) {
  .progress-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar {
    flex-direction: column;
  }

  .toolbar .input {
    width: 100%;
  }
}

/* =============================================
   MEDIA GALLERY — item images component
   ============================================= */

.media-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 20px;
}

.media-thumb {
  position: relative;
  width: 96px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}

.media-thumb-img {
  width: 96px;
  height: 96px;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-thumb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-thumb-icon {
  font-size: 32px;
  opacity: 0.6;
}

.media-thumb-name {
  font-size: 10px;
  color: #888;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-primary-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #f59e0b;
  color: #000;
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 700;
}

.media-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}

.media-thumb:hover .media-delete-btn {
  opacity: 1;
}

/* Item primary thumbnail (top-right of Details header) */
.item-primary-thumb {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-primary-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

/* Media lightbox */
#mediaLightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
}

#mediaLightbox.active {
  display: flex;
}

.media-lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.media-lb-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.media-lb-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.media-lb-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-lb-close:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.media-lb-name {
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Searchable item dropdown */
.item-search-drop li:hover {
  background: var(--panel-hover);
  border-left: 3px solid var(--accent);
  padding-left: 9px !important;
  cursor: pointer;
}

/* =====================================================
   Light Mode Overrides — Slate Clean
   Applied when body.light-mode class is present
   ===================================================== */
body.light-mode {
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-hover: #f1f5f9;
  --border: #d1d5db;
  --border-light: #9ca3af;
  --muted: #6b7280;
  --text: #374151;
  --text-bright: #111827;
  --accent: #0284c7;
}

/* Inputs */
body.light-mode input,
body.light-mode select,
body.light-mode textarea {
  background: #ffffff;
  color: #111827;
  border-color: #d1d5db;
}

body.light-mode input:focus,
body.light-mode select:focus,
body.light-mode textarea:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
}

body.light-mode input:disabled,
body.light-mode select:disabled,
body.light-mode textarea:disabled {
  background: #f1f5f9;
  color: #6b7280;
}

/* Table rows + headers (override hardcoded dark bg) */
body.light-mode .row {
  background: #ffffff;
  border-color: #d1d5db;
}

body.light-mode .row:hover {
  background: #f1f5f9;
  border-color: #9ca3af;
}

body.light-mode .app-header {
  background: #c8cdd5;
  border-bottom-color: #b0b7c3;
}

body.light-mode th {
  background: #c8cdd5;
  color: #374151;
}

body.light-mode tbody tr:hover {
  background: #f1f5f9;
}

/* Status filter tabs (rgba(255,255,255,x) is invisible on white panels) */
body.light-mode .status-filter-tab {
  background: rgba(0, 0, 0, 0.04);
  color: #6b7280;
}

body.light-mode .status-filter-tab:hover {
  background: rgba(0, 0, 0, 0.07);
  color: #374151;
}

/* Alt supplier sub-inputs */
body.light-mode .alt-sup-select,
body.light-mode .alt-sup-sku,
body.light-mode .alt-sup-cost,
body.light-mode .alt-sup-lead {
  background: #f8fafc;
  border-color: #d1d5db;
  color: #374151;
}

/* Calendar picker icon — visible in dark mode */
input[type=date]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
  opacity: 0.8;
}
body.light-mode input[type=date]::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.6;
}

/* ========================================
   POS Hardware Bridge — status indicator
   (Phase A plumbing; see docs/context/apps/STORE_POS_BRIDGE_INTEGRATION.md)
   ======================================== */
.hardware-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.hardware-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.hardware-status.online {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.25);
}
.hardware-status.offline {
  background: rgba(239, 68, 68, 0.10);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.22);
}
.hardware-status.connecting {
  background: rgba(234, 179, 8, 0.12);
  color: #ca8a04;
  border-color: rgba(234, 179, 8, 0.25);
}
body.light-mode .hardware-status.online {
  background: #dcfce7;
  color: #15803d;
}
body.light-mode .hardware-status.offline {
  background: #fee2e2;
  color: #b91c1c;
}
