/* ==========================================================================
   SmartFridge PWA (Shared Webhosting Variant) - Design System
   ========================================================================== */

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: rgba(26, 38, 62, 0.75);
  --bg-card-hover: rgba(36, 52, 84, 0.85);
  --bg-glass: rgba(19, 27, 46, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(16, 185, 129, 0.3);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-emerald: #10b981;
  --accent-emerald-light: #34d399;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  --status-fresh-bg: rgba(16, 185, 129, 0.15);
  --status-fresh-text: #34d399;
  --status-fresh-border: rgba(16, 185, 129, 0.35);

  --status-warning-bg: rgba(245, 158, 11, 0.15);
  --status-warning-text: #fbbf24;
  --status-warning-border: rgba(245, 158, 11, 0.35);

  --status-expired-bg: rgba(244, 63, 94, 0.15);
  --status-expired-text: #fb7185;
  --status-expired-border: rgba(244, 63, 94, 0.35);

  --header-height: 60px;
  --nav-height: 68px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-emerald-glow);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  user-select: none;
}

h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  font-size: 1.5rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(59, 130, 246, 0.2));
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-highlight);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  background: linear-gradient(90deg, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-badge.online {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.online::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent-emerald-light);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--accent-emerald-light);
}

.status-badge.offline {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.offline::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent-amber);
  border-radius: 50%;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.btn-icon:hover, .btn-icon:active {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(0.96);
}

.badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent-rose);
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-primary);
}

/* Main Container & Views */
.main-content {
  flex: 1;
  padding: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.view-section {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.view-section.active {
  display: block;
}

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

/* Stats Overview Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: transform 0.2s ease;
}

.stat-card:active {
  transform: scale(0.97);
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 2px;
}

.stat-card.fresh .stat-value { color: var(--accent-emerald-light); }
.stat-card.warning .stat-value { color: var(--accent-amber); }
.stat-card.expired .stat-value { color: var(--accent-rose); }

/* Quick Action Banner */
.action-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(59, 130, 246, 0.1));
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.action-banner-text h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.action-banner-text p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Search & Filter Bar */
.filter-container {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 11px 14px 11px 38px;
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 0.95rem;
  color: var(--text-muted);
  pointer-events: none;
}

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.category-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip.active {
  background: var(--accent-emerald);
  color: #0b0f19;
  border-color: var(--accent-emerald-light);
  font-weight: 700;
  box-shadow: 0 0 12px var(--accent-emerald-glow);
}

/* Items List */
.items-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
}

.item-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

.item-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.item-card.status-fresh::before { background: var(--accent-emerald); }
.item-card.status-warning::before { background: var(--accent-amber); }
.item-card.status-expired::before { background: var(--accent-rose); }
.item-card.status-normal::before { background: var(--text-muted); }

.item-icon-box {
  width: 48px;
  height: 48px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.item-icon-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 3px;
  flex-wrap: wrap;
}

.stock-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.stock-badge.in-stock {
  background: var(--status-fresh-bg);
  color: var(--status-fresh-text);
  border-color: var(--status-fresh-border);
}

.brand-tag {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
}

/* Multi-Select & Bulk Actions for Articles */
.bulk-toolbar {
  display: none;
  position: sticky;
  top: var(--header-height);
  z-index: 35;
  background: rgba(19, 27, 46, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-highlight);
  padding: 10px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  animation: slideDown 0.2s ease-out;
  margin: -16px -16px 16px -16px;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.bulk-toolbar.active {
  display: flex;
}

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

.bulk-count {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-emerald-light);
}

.bulk-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-bulk-delete {
  background: var(--accent-rose);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-bulk-delete:active {
  transform: scale(0.95);
}

.btn-bulk-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

/* Article Card Selection States */
.item-card.selectable {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.2s ease;
}

.item-card.selected {
  background: rgba(16, 185, 129, 0.18);
  border-color: var(--accent-emerald);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.select-indicator {
  display: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  align-items: center;
  justify-content: center;
  margin-right: 6px;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: transparent;
  transition: all 0.2s ease;
}

.selection-mode-active .select-indicator {
  display: flex;
}

.item-card.selected .select-indicator {
  background: var(--accent-emerald);
  border-color: var(--accent-emerald-light);
  color: #0b0f19;
  font-weight: 900;
}

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

.btn-qty-action {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-qty-action:active {
  transform: scale(0.9);
}

.btn-qty-action.btn-consume {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-qty-action.btn-consume:hover {
  background: var(--accent-rose);
  color: white;
}

.btn-qty-action.btn-add {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald-light);
  border-color: rgba(16, 185, 129, 0.3);
}

.btn-qty-action.btn-add:hover {
  background: var(--accent-emerald);
  color: #0b0f19;
}

.btn-qty-action.btn-edit {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
  font-size: 0.95rem;
}

.btn-qty-action.btn-edit:hover {
  background: #3b82f6;
  color: white;
}

.quantity-badge {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
  min-width: 28px;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
  margin-top: 10px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.7;
}

.empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 280px;
  margin: 0 auto 18px;
}

/* Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  max-width: 600px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  padding: 0 2px;
  height: 100%;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  border: none;
  white-space: nowrap;
}

.nav-icon {
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.nav-item.active {
  color: var(--accent-emerald-light);
}

.nav-item.active .nav-icon {
  transform: translateY(-2px);
}

/* Modals & Bottom Sheets */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 20px calc(24px + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
}

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

.sheet-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.btn-close-sheet {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

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

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 0 3px var(--accent-emerald-glow);
}

.input-with-action {
  display: flex;
  gap: 8px;
}

.input-with-action .form-control {
  flex: 1;
}

.btn-input-action {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-input-action:hover, .btn-input-action:active {
  background: var(--accent-emerald);
  color: #0b0f19;
  transform: scale(0.97);
}

.btn-input-action.btn-lookup {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

.btn-input-action.btn-lookup:hover {
  background: #3b82f6;
  color: #ffffff;
}

/* Open Food Facts Live Preview Box */
.api-preview-card {
  display: none;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.25s ease-out;
}

.api-preview-card.active {
  display: flex;
}

.api-preview-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

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

.api-preview-badge {
  font-size: 0.68rem;
  color: var(--accent-emerald-light);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.api-preview-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-preview-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Modal Scanner Viewfinder Overlay */
.modal-scanner-box {
  display: none;
  position: relative;
  width: 100%;
  height: 220px;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--accent-emerald);
}

.modal-scanner-box.active {
  display: block;
}

.modal-scanner-box video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-scanner-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-emerald), #059669);
  color: #0b0f19;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px var(--accent-emerald-glow);
  transition: all 0.2s ease;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  width: 100%;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

/* Scanner */
.scanner-container {
  position: relative;
  width: 100%;
  height: 280px;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  border: 2px solid var(--border-highlight);
}

.scanner-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-viewfinder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.scanner-target-box {
  width: 240px;
  height: 150px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scanner-target-box.detected {
  border-color: var(--accent-emerald);
  box-shadow: 0 0 24px var(--accent-emerald-glow), 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scanner-laser {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, #10b981, transparent);
  box-shadow: 0 0 10px #10b981;
  animation: laserScan 2s ease-in-out infinite alternate;
}

@keyframes laserScan {
  0% { top: 5%; opacity: 0.3; }
  50% { opacity: 1; }
  100% { top: 95%; opacity: 0.3; }
}

.scanner-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.scanner-mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.scanner-mode-btn {
  padding: 10px;
  text-align: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.scanner-mode-btn.active {
  background: var(--accent-emerald);
  color: #0b0f19;
}

.scanner-mode-btn.active.mode-out {
  background: var(--accent-rose);
  color: white;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 400px;
}

.toast {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease-out;
}

.toast.success { border-color: var(--accent-emerald); }
.toast.error { border-color: var(--accent-rose); }
.toast.warning { border-color: var(--accent-amber); }

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

.hidden {
  display: none !important;
}

.syncing {
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   Splash Screen
   ========================================================================== */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at 50% 35%, #16243b 0%, #0b0f19 80%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 40px 20px calc(28px + var(--safe-bottom));
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.6s ease;
  user-select: none;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: 30px;
}

.splash-icon-wrapper {
  position: relative;
  width: 110px;
  height: 110px;
  margin-bottom: 24px;
}

.splash-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 26px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 25px rgba(16, 185, 129, 0.3);
  position: relative;
  z-index: 2;
  border: 2px solid rgba(16, 185, 129, 0.4);
  animation: splashPulse 2.4s ease-in-out infinite alternate;
}

.splash-glow {
  position: absolute;
  inset: -10px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, transparent 70%);
  border-radius: 36px;
  z-index: 1;
  filter: blur(10px);
}

@keyframes splashPulse {
  0% { transform: scale(0.96); }
  100% { transform: scale(1.04); }
}

.splash-title {
  font-size: 1.85rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 30%, #34d399 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  letter-spacing: -0.03em;
}

.splash-subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 500;
  max-width: 260px;
}

.splash-loader {
  width: 140px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  margin-top: 32px;
  overflow: hidden;
  position: relative;
}

.splash-loader-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 45%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 4px;
  box-shadow: 0 0 10px #10b981;
  animation: splashProgress 1.4s ease-in-out infinite;
}

@keyframes splashProgress {
  0% { left: -45%; }
  100% { left: 100%; }
}

.splash-footer {
  text-align: center;
  padding-bottom: 8px;
}

.splash-copyright {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

/* ==============================================================================
   Settings View & Toggle Switch Styles
   ============================================================================== */
/* Settings Hero Header */
.settings-hero-header {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(15, 23, 42, 0.75));
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 20px;
  backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.settings-hero-header::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 90px;
  height: 90px;
  background: radial-gradient(circle, var(--accent-emerald-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.6;
}

.settings-hero-icon-box {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(59, 130, 246, 0.15));
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.settings-gear-icon {
  display: inline-block;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.settings-hero-header:hover .settings-gear-icon {
  transform: rotate(90deg);
}

.settings-hero-text {
  flex: 1;
  min-width: 0;
}

.settings-hero-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0;
}

.settings-hero-subtitle {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.3;
}

.settings-hero-badge {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--accent-emerald-light);
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 20px;
  padding: 3px 9px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  align-self: center;
}

.settings-group {
  margin-bottom: 24px;
}

.settings-group-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-left: 4px;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-info {
  flex: 1;
}

.settings-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.settings-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.settings-action-row {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

.btn-test-tts {
  width: auto;
  padding: 8px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-highlight);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-test-tts:hover {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--accent-emerald);
  color: var(--accent-emerald-light);
}

/* iOS/Material Style Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  transition: 0.25s ease;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  transition: 0.25s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

input:checked + .slider {
  background-color: var(--accent-emerald);
  border-color: var(--accent-emerald-light);
  box-shadow: 0 0 10px var(--accent-emerald-glow);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--accent-emerald);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* App Info & Copyright Bottom Card (unten bündig) */
#view-settings.active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 150px);
}

.settings-app-info-card {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.7), rgba(30, 41, 59, 0.5));
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  text-align: center;
  margin-top: auto;
  margin-bottom: 10px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
}

.app-info-icon {
  font-size: 2.4rem;
  margin-bottom: 8px;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.app-info-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.app-info-badge {
  display: inline-block;
  margin: 6px auto 10px;
  padding: 4px 12px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--accent-emerald);
  color: var(--accent-emerald-light);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 20px;
  letter-spacing: 0.03em;
}

.app-info-copyright {
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  opacity: 0.95;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.app-info-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 320px;
  margin: 0 auto;
}

