/* QuickQR Modern Native-like Stylesheet */
:root {
  --primary-teal: #00897b;
  --primary-teal-dark: #00695c;
  --primary-teal-light: #26a69a;
  --accent-amber: #ff9800;
  --accent-orange: #f57c00;
  --bg-dark: #0d1117;
  --bg-card-dark: #161b22;
  --bg-light: #f8fafc;
  --bg-card-light: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --scanner-corner: #ff9800;
  --laser-color: #00e676;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-family);
  user-select: none;
}

body {
  background-color: #0a0e14;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow-x: hidden;
}

/* App Shell container */
.app-container {
  width: 100%;
  max-width: 440px;
  height: 100dvh;
  height: 100vh; /* fallback */
  background-color: var(--bg-card-light);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

@media (min-width: 768px) {
  .app-container {
    border-radius: 28px;
    height: 90vh;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* Header & Status Bar */
.app-header {
  background: linear-gradient(135deg, var(--primary-teal), var(--primary-teal-dark));
  color: #ffffff;
  padding: 12px 16px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.status-bar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding-bottom: 4px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

.brand-badge img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

/* Navigation Tabs */
.tabs-navigation {
  display: flex;
  justify-content: space-around;
  position: relative;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 10px 4px 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.tab-btn svg {
  width: 22px;
  height: 22px;
  stroke-width: 2;
  transition: transform 0.2s ease;
}

.tab-btn.active {
  color: #ffffff;
  font-weight: 700;
}

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

.tab-indicator {
  position: absolute;
  bottom: 0;
  height: 3px;
  width: 25%;
  background-color: var(--accent-amber);
  border-radius: 3px 3px 0 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* App Content Area */
.app-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  background-color: #ffffff;
}

.tab-view {
  display: none;
  height: 100%;
  flex-direction: column;
}

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

/* --- SCAN TAB --- */
.scan-container {
  height: 100%;
  background-color: #000000;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.scan-top-actions {
  display: flex;
  justify-content: space-around;
  padding: 20px 16px;
  z-index: 5;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
}

.action-tool-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.action-tool-btn:hover {
  opacity: 1;
}

.action-tool-btn svg {
  width: 24px;
  height: 24px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
}

.action-tool-btn.active svg {
  background: var(--accent-amber);
  color: #000;
}

/* Camera Viewport */
.camera-viewport {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Viewfinder overlay & Brackets */
.viewfinder-frame {
  position: absolute;
  width: 250px;
  height: 250px;
  z-index: 4;
}

.corner {
  position: absolute;
  width: 36px;
  height: 36px;
  border-color: var(--accent-amber);
  border-style: solid;
}

.top-left {
  top: 0;
  left: 0;
  border-width: 4px 0 0 4px;
  border-top-left-radius: 8px;
}

.top-right {
  top: 0;
  right: 0;
  border-width: 4px 4px 0 0;
  border-top-right-radius: 8px;
}

.bottom-left {
  bottom: 0;
  left: 0;
  border-width: 0 0 4px 4px;
  border-bottom-left-radius: 8px;
}

.bottom-right {
  bottom: 0;
  right: 0;
  border-width: 0 4px 4px 0;
  border-bottom-right-radius: 8px;
}

/* Animated Laser Scan Line */
.laser-beam {
  position: absolute;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--laser-color), transparent);
  box-shadow: 0 0 8px var(--laser-color);
  animation: laserScan 2.4s ease-in-out infinite;
}

@keyframes laserScan {
  0% { top: 0%; opacity: 0.2; }
  50% { top: 98%; opacity: 1; }
  100% { top: 0%; opacity: 0.2; }
}

/* Bottom Zoom Slider on Scanner */
.scan-bottom-controls {
  padding: 16px 24px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
}

.zoom-slider {
  flex: 1;
  accent-color: var(--accent-amber);
  cursor: pointer;
  height: 4px;
}

.zoom-icon {
  color: #ffffff;
  opacity: 0.8;
  display: flex;
}

/* --- CREATE TAB --- */
.create-list {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}

.create-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease;
}

.create-item:hover, .create-item:active {
  background-color: #f8fafc;
}

.create-item-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #ffffff;
  flex-shrink: 0;
}

.bg-slate { background-color: #64748b; }
.bg-amber { background-color: #f59e0b; }
.bg-orange { background-color: #f97316; }
.bg-teal { background-color: #0d9488; }
.bg-emerald { background-color: #059669; }
.bg-blue { background-color: #3b82f6; }
.bg-indigo { background-color: #6366f1; }

.create-item-title {
  font-size: 15px;
  font-weight: 500;
  color: #1e293b;
  flex: 1;
}

.create-item-arrow {
  color: #cbd5e1;
}

/* --- HISTORY TAB --- */
.history-subhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.history-count-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.history-action-btn {
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.history-action-btn:hover {
  color: var(--primary-teal);
}

.history-search-bar {
  padding: 8px 16px;
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.history-search-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
  outline: none;
}

.history-search-input:focus {
  border-color: var(--primary-teal);
}

.history-list {
  flex: 1;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
}

.history-item:hover {
  background-color: #f8fafc;
}

.history-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: #f1f5f9;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #334155;
  flex-shrink: 0;
}

.history-item-details {
  flex: 1;
  overflow: hidden;
}

.history-item-text {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

/* --- SETTINGS TAB --- */
.settings-section {
  padding: 16px 0;
}

.settings-group-title {
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-teal);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
}

.settings-label {
  font-size: 14px;
  font-weight: 500;
  color: #1e293b;
}

.settings-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Switch Toggle */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider-round {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: 0.3s;
  border-radius: 24px;
}

.slider-round:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider-round {
  background-color: var(--primary-teal);
}

input:checked + .slider-round:before {
  transform: translateX(20px);
}

/* --- BOTTOM PERSISTENT GOOGLE AD BANNER --- */
.ad-banner-container {
  background-color: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 8px 12px;
  gap: 12px;
  z-index: 20;
  flex-shrink: 0;
  min-height: 60px;
}

.ad-badge {
  font-size: 10px;
  background-color: #e2e8f0;
  color: #475569;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 700;
  align-self: flex-start;
}

.ad-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
}

.ad-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ad-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.ad-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.ad-btn {
  background-color: #00897b;
  color: #ffffff;
  border: none;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}

/* --- MODAL DIALOGS --- */
.modal-overlay {
  display: none;
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 50;
  justify-content: center;
  align-items: flex-end;
  backdrop-filter: blur(2px);
}

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

.modal-sheet {
  background-color: #ffffff;
  width: 100%;
  max-height: 85%;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.modal-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #64748b;
}

.qr-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-color: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.qr-canvas {
  max-width: 200px;
  max-height: 200px;
  border-radius: 8px;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.form-input, .form-textarea {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  outline: none;
}

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

.btn-primary {
  background-color: var(--primary-teal);
  color: #ffffff;
  border: none;
  padding: 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
