/**
 * VURMZ Enterprise Inventory - Main Stylesheet
 * Black & White Minimal Theme
 */

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
  --primary: #000000;
  --primary-hover: #333333;
  --primary-light: rgba(0, 0, 0, 0.1);
  --bg: #ffffff;
  --bg-secondary: #f5f5f5;
  --card: #ffffff;
  --border: #e0e0e0;
  --text: #000000;
  --text-secondary: #666666;
  --text-muted: #999999;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --primary: #ffffff;
  --primary-hover: #e0e0e0;
  --primary-light: rgba(255, 255, 255, 0.1);
  --bg: #0a0a0a;
  --bg-secondary: #1a1a1a;
  --card: #1a1a1a;
  --border: #333333;
  --text: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #666666;
}

/* ============================================
   BASE STYLES
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  height: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { margin: 0 0 0.5rem; font-weight: 600; }
p { margin: 0 0 1rem; }

.hidden { display: none !important; }

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.login-screen.fade-out {
  opacity: 0;
  transform: scale(1.02);
}

.main-app {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.main-app.fade-in {
  opacity: 1;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  text-align: center;
}

.login-logo {
  margin-bottom: 24px;
  text-align: center;
  display: flex;
  justify-content: center;
}
.logo-large {
  width: 150px;
  height: auto;
  display: block;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.auth-form { text-align: left; }

.auth-form h2 {
  font-size: 20px;
  text-align: center;
  margin-bottom: 8px;
}

.form-hint {
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 12px;
  background: var(--bg);
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
}

.auth-tab:hover {
  background: var(--bg-secondary);
}

.auth-tab.active {
  background: var(--primary);
  color: var(--bg);
}

.form-error {
  color: var(--error);
  font-size: 13px;
  margin-bottom: 16px;
  padding: 10px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
}

.login-footer {
  margin-top: 32px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ============================================
   MAIN APP LAYOUT
   ============================================ */
.main-app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand-info h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.brand-info p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  text-align: left;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.nav-item:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.nav-item.active {
  background: var(--primary);
  color: var(--bg);
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

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

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-top: 8px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-details span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg-secondary);
}

.panel {
  display: none;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.panel.active { display: block; }

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

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
}

.panel-header h2 {
  font-size: 24px;
  margin: 0;
}

.subtitle {
  color: var(--text-secondary);
  margin: 4px 0 0;
}

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

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

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

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

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

.btn-outline:hover {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
}

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

.demo-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.demo-divider::before,
.demo-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.demo-divider::before { margin-right: 12px; }
.demo-divider::after { margin-left: 12px; }

.btn-icon {
  background: transparent;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

.btn-icon svg { width: 20px; height: 20px; }

.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: 16px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
}

.form-row .form-group { margin-bottom: 0; }

.form-select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

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

.form-group.checkbox input { width: auto; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.search-box svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  min-width: 150px;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

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

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr:hover td {
  background: var(--bg-secondary);
}

.data-table tr:last-child td { border-bottom: none; }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px !important;
}

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard-grid {
  display: grid;
  gap: 24px;
}

.kpi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.kpi-card {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}

.kpi-card.warning .kpi-icon { color: var(--warning); }

.kpi-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon svg { width: 24px; height: 24px; color: var(--primary); }

.kpi-content { flex: 1; }

.kpi-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}

.kpi-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.chart-card {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.chart-card h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.chart-card canvas {
  max-height: 250px;
}

/* ============================================
   REPORTS
   ============================================ */
.reports-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.report-card {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}

.report-card h4 {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.report-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
}

.report-card.warning .report-value {
  color: var(--warning);
}

.report-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.report-table-section {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.report-table-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.quick-actions-card {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.quick-actions-card h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.quick-action:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.quick-action svg { width: 24px; height: 24px; }
.quick-action span { font-size: 13px; }

.recent-card {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.recent-card h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

/* ============================================
   BARCODES
   ============================================ */
.barcodes-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.barcode-generator,
.barcode-preview,
.barcode-scanner {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.barcode-generator h3,
.barcode-preview h3,
.barcode-scanner h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.preview-area {
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

.preview-area canvas { max-width: 100%; height: auto; }

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

.scanner-area {
  min-height: 200px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}

#scannerRegion {
  width: 100%;
  min-height: 300px;
}

#scannerRegion video {
  width: 100% !important;
  border-radius: var(--radius);
}

#scannerRegion.scan-success {
  animation: scanFlash 0.5s ease;
}

@keyframes scanFlash {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 30px var(--success); }
}

.scanner-status {
  text-align: center;
  padding: 12px;
  font-weight: 500;
  border-radius: var(--radius);
  margin-top: 12px;
  background: var(--bg-secondary);
}

.scanner-status.success {
  background: var(--success);
  color: white;
}

.scanner-status.error {
  background: var(--danger);
  color: white;
}

.scanner-controls {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
}

.scanner-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 250px;
  height: 150px;
  border: 3px solid var(--primary);
  border-radius: 8px;
  pointer-events: none;
  z-index: 10;
}

.scanner-overlay::before,
.scanner-overlay::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--primary);
  border-style: solid;
}

.scanner-overlay::before {
  top: -3px;
  left: -3px;
  border-width: 3px 0 0 3px;
}

.scanner-overlay::after {
  bottom: -3px;
  right: -3px;
  border-width: 0 3px 3px 0;
}

.manual-entry-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.manual-entry-section h4 {
  font-size: 14px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.manual-entry-form {
  display: flex;
  gap: 8px;
}

.manual-entry-form input {
  flex: 1;
}

.scan-result {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.scan-result.success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--success);
}

.scan-result.not-found {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--warning);
}

.scan-result h4 {
  margin-bottom: 8px;
}

.scan-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ============================================
   LABELS
   ============================================ */
.labels-container {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
}

.label-templates,
.label-preview-area {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.templates-list { display: flex; flex-direction: column; gap: 8px; }

.label-preview {
  min-height: 300px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   REPORTS
   ============================================ */
.reports-container {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 24px;
}

.report-types,
.report-output {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.report-list { display: flex; flex-direction: column; gap: 8px; }

.report-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.report-item:hover { background: var(--bg-secondary); }
.report-item.active { border-color: var(--primary); background: var(--primary-light); }
.report-item svg { width: 18px; height: 18px; flex-shrink: 0; }

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

.report-content { min-height: 300px; }

/* ============================================
   SETTINGS
   ============================================ */
.settings-container {
  max-width: 600px;
}

.settings-section {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.settings-actions { margin-top: 20px; }

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.2s ease;
}

.modal-sm { max-width: 400px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 { margin: 0; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

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

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 250px;
  max-width: 400px;
  animation: toastIn 0.3s ease;
  transition: var(--transition);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--error); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info { border-left: 4px solid var(--info); }

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast:not(.show) {
  opacity: 0;
  transform: translateX(100%);
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
}

.toast.success .toast-icon { background: var(--success); color: white; }
.toast.error .toast-icon { background: var(--error); color: white; }
.toast.warning .toast-icon { background: var(--warning); color: white; }
.toast.info .toast-icon { background: var(--info); color: white; }

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.toast-close:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

/* ============================================
   UTILITIES
   ============================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Admin only elements */
.admin-only { display: none; }
[data-role="admin"] .admin-only { display: block; }
[data-role="admin"] button.admin-only { display: flex; }

/* ============================================
   SIMPLIFIED SCAN PANEL
   ============================================ */
.scan-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
  max-width: 900px;
}

.scanner-section {
  background: var(--card);
  padding: 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.scanner-region {
  background: #000;
  border-radius: var(--radius);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
}

.scanner-placeholder {
  text-align: center;
  color: #666;
}

.scanner-placeholder .scanner-icon {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.scanner-status {
  text-align: center;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 14px;
}

.scanner-status.success { background: var(--success); color: white; }
.scanner-status.error { background: var(--error); color: white; }

.scanner-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.manual-entry-section,
.scan-result-section,
.not-found-section {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.manual-entry-section h3,
.scan-result-section h3 {
  margin-bottom: 16px;
  font-size: 16px;
}

.scanned-item-card {
  background: var(--bg-secondary);
  padding: 16px;
  border-radius: var(--radius);
}

.scanned-item-info h4 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.scanned-item-info p {
  margin: 4px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.scanned-item-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.not-found-card {
  text-align: center;
  padding: 24px;
}

.not-found-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: var(--warning);
}

.not-found-card h4 {
  margin: 0 0 8px 0;
}

.not-found-card p {
  margin: 0 0 16px 0;
  color: var(--text-muted);
}

/* ============================================
   SIMPLIFIED SETTINGS
   ============================================ */
.section-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.categories-list {
  margin-bottom: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 6px;
}

.category-item span {
  font-size: 14px;
}

.category-item button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.category-item button:hover {
  color: var(--error);
}

.data-limits-info {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.data-limits-info p {
  margin: 4px 0;
  font-size: 14px;
}

.form-static {
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  font-weight: 500;
}

/* ============================================
   LOCATIONS
   ============================================ */
.location-count {
  font-size: 14px;
  color: var(--text-muted);
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.locations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.location-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.location-card:hover {
  border-color: var(--primary);
}

.location-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.location-icon svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.location-info {
  flex: 1;
  min-width: 0;
}

.location-info h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
}

.location-info p {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.location-info small {
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================
   LOW STOCK ALERTS
   ============================================ */
.alerts-card {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.alerts-card h3 {
  margin-bottom: 16px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alerts-card h3::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--warning);
  border-radius: 50%;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
}

.alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border-left: 3px solid var(--warning);
}

.alert-item.critical {
  border-left-color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

.alert-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.alert-info strong {
  font-size: 14px;
}

.alert-qty {
  font-size: 12px;
  color: var(--text-muted);
}

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

/* ============================================
   PRINT LABELS
   ============================================ */
.print-preview {
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.label-preview-item {
  background: white;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  min-width: 200px;
}

.label-barcode {
  margin-bottom: 8px;
}

.label-barcode img {
  max-width: 180px;
  height: auto;
}

.label-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.label-sku {
  font-size: 12px;
  color: var(--text-muted);
}

/* Category tags in settings */
.category-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin: 4px;
  font-size: 13px;
}

.category-tag .btn-icon-sm {
  width: 18px;
  height: 18px;
  padding: 0;
  font-size: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-tag .btn-icon-sm:hover {
  color: var(--error);
}

/* Modal open state fix */
.modal-overlay.open {
  display: flex;
}

/* ============================================
   HELP BOT
   ============================================ */
.help-bot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

.help-bot-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.help-bot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.help-bot-toggle svg {
  width: 28px;
  height: 28px;
}

.help-bot-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 320px;
  max-height: 450px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: helpBotIn 0.2s ease;
}

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

.help-bot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--primary);
  color: var(--bg);
  font-weight: 600;
}

.help-bot-header .btn-icon-sm {
  background: none;
  border: none;
  color: var(--bg);
  font-size: 20px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-bot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  max-height: 320px;
}

.bot-message {
  background: var(--bg-secondary);
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.bot-message p {
  margin: 0 0 8px 0;
}

.bot-message p:last-child {
  margin-bottom: 0;
}

.bot-message ul {
  margin: 8px 0;
  padding-left: 20px;
}

.bot-message li {
  margin: 4px 0;
}

.help-topics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-topic-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.help-topic-btn:hover {
  background: var(--primary);
  color: var(--bg);
  border-color: var(--primary);
}

.help-bot-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ============================================
   EXPORT DROPDOWN
   ============================================ */
.export-dropdown {
  position: relative;
}

.export-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
}

.export-dropdown.open .export-menu {
  display: block;
}

.export-option {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
}

.export-option:hover {
  background: var(--bg-secondary);
}

.export-option:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

/* ============================================
   WEBHOOKS
   ============================================ */
.webhooks-list {
  margin-bottom: 16px;
}

.webhook-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.webhook-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.webhook-info strong {
  font-size: 14px;
}

.webhook-info small {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.webhook-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================================
   BILLING & PRICING
   ============================================ */
.billing-status {
  margin-bottom: 20px;
}

.current-plan {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
}

.plan-badge {
  padding: 4px 12px;
  background: var(--primary);
  color: var(--bg);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.plan-badge.pro { background: #3b82f6; }
.plan-badge.enterprise { background: #8b5cf6; }

.pricing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.pricing-card {
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.pricing-card.featured {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pricing-card h4 {
  margin: 0 0 12px 0;
  font-size: 18px;
}

.pricing-card .price {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 16px;
}

.pricing-card .price span {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.pricing-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  text-align: left;
}

.pricing-card li {
  padding: 6px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.pricing-card li:last-child {
  border-bottom: none;
}

.pricing-card li::before {
  content: '✓ ';
  color: var(--success);
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 768px) {
  /* Layout */
  .main-app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    z-index: 100;
    flex-direction: row;
    padding: 0;
    border-top: 1px solid var(--border);
    border-right: none;
  }

  .sidebar-header,
  .sidebar-footer .user-info {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    justify-content: space-around;
    flex: 1;
    padding: 8px 0;
  }

  .nav-item {
    flex-direction: column;
    padding: 8px;
    font-size: 10px;
    gap: 4px;
  }

  .nav-item .nav-icon {
    width: 20px;
    height: 20px;
  }

  .nav-divider {
    display: none;
  }

  .sidebar-footer {
    position: absolute;
    top: -50px;
    right: 10px;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-bottom: 80px; /* Space for bottom nav */
  }

  /* Panels */
  .panel-header {
    flex-direction: column;
    gap: 12px;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  /* Scan page */
  .scan-container {
    grid-template-columns: 1fr;
  }

  .scanner-controls {
    flex-direction: column;
  }

  .scanned-item-actions {
    flex-direction: column;
  }

  /* Tables */
  .table-container {
    overflow-x: auto;
  }

  .data-table {
    font-size: 14px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
  }

  /* Buttons */
  .btn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .btn-icon {
    width: 40px;
    height: 40px;
  }

  /* Forms */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
    padding: 12px;
  }

  /* Modals */
  .modal {
    max-height: 85vh;
    margin: 10px;
  }

  /* Dashboard */
  .kpi-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Settings */
  .settings-container {
    max-width: 100%;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .kpi-cards {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
  }

  .form-row .form-group {
    width: 100%;
  }
}

/* PWA standalone mode */
@media (display-mode: standalone) {
  .login-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
