/* Modern Glassmorphic Dark Aesthetics for Web QR Scanner Pro */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #0b0f19;
  --bg-card: rgba(26, 34, 52, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --accent-primary: #10b981;
  --accent-primary-hover: #059669;
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-danger: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.2);
}

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

body {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.12) 0px, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.app-container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

/* Header Navbar */
header {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

.brand-icon {
  font-size: 28px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.auto-open-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.6);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
}

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

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

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

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

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

.platform-badge {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

/* Main Grid Layout */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  flex: 1;
}

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

/* Card Styling */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: #1e293b;
  color: var(--accent-cyan);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Drop Zone */
.tab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

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

.drop-zone {
  border: 2px dashed #334155;
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.4);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 280px;
}

.drop-zone.dragover {
  border-color: var(--accent-primary);
  background: rgba(16, 185, 129, 0.08);
  transform: scale(1.01);
  box-shadow: var(--shadow-glow);
}

.drop-icon {
  font-size: 54px;
  color: var(--accent-cyan);
  transition: transform 0.3s ease;
}

.drop-zone:hover .drop-icon {
  transform: translateY(-4px);
}

.drop-title {
  font-size: 18px;
  font-weight: 600;
}

.drop-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.kbd-badge {
  background: #334155;
  color: #f1f5f9;
  font-family: monospace;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* Camera Scanner */
.camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.camera-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 30px solid rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.reticle-box {
  width: 200px;
  height: 200px;
  border: 3px solid var(--accent-primary);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.6);
  position: relative;
}

.scan-line {
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--accent-primary);
  box-shadow: 0 0 10px var(--accent-primary);
  top: 0;
  animation: scanMove 2s infinite ease-in-out;
}

@keyframes scanMove {
  0% { top: 0; }
  50% { top: 100%; }
  100% { top: 0; }
}

/* Buttons */
.btn {
  background: var(--accent-blue);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-primary));
  color: #000;
  font-weight: 700;
}

.btn-danger {
  background: var(--accent-danger);
}

/* Scan Result & History */
.result-card {
  border-left: 4px solid var(--accent-primary);
}

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

.url-badge {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.result-text-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-all;
  min-height: 80px;
  color: var(--text-main);
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Toast Banner */
.toast-banner {
  background: linear-gradient(135deg, #065f46, #047857);
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeIn 0.3s ease;
}

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

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 350px;
  overflow-y: auto;
}

.history-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.history-item:hover {
  background: rgba(30, 41, 59, 0.8);
}

.history-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.history-content {
  font-size: 13px;
  font-weight: 500;
  word-break: break-all;
}

/* QR Generator Canvas */
.qr-gen-output {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  min-height: 220px;
}

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

.form-input {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid #334155;
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  width: 100%;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}
