@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');

:root {
  --bg-color: #0f172a;
  --panel-bg: rgba(30, 41, 59, 0.7);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --error: #ef4444;
  --border: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: background 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.container {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px;
  width: 90%;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
              border-color 0.4s ease, 
              background-color 0.4s ease,
              box-shadow 0.4s ease;
}

.container:hover {
  transform: translateY(-5px);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.6);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: color 0.3s ease, background 0.3s ease;
}

p.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 30px;
  transition: color 0.3s ease;
}

#reader {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  margin-bottom: 25px;
  background: #000;
  position: relative;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  transition: border-color 0.3s ease;
}

#reader:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

#reader video {
  object-fit: cover !important;
  width: 100% !important;
  border-radius: 16px;
}

/* Hide html5-qrcode default UI elements just in case */
#reader__dashboard_section_csr span,
#reader__dashboard_section_swaplink {
  display: none !important;
}

.status-box {
  margin-top: 10px;
  padding: 16px;
  border-radius: 14px;
  font-weight: 600;
  font-size: 1.1rem;
  opacity: 0;
  transform: translateY(15px);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  display: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.status-box.active {
  opacity: 1;
  transform: translateY(0);
  display: block;
  animation: pulseBox 2s infinite;
}

@keyframes pulseBox {
  0% { box-shadow: 0 0 0 0 rgba(0,0,0,0.1); }
  50% { box-shadow: 0 0 10px 0 rgba(0,0,0,0.2); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0.1); }
}

.status-box.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-box.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-box.info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Screen state classes for fullscreen colors */
body.state-success {
  background: var(--success);
}

body.state-error {
  background: var(--error);
}

body.state-success .container {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.02);
}
body.state-success h1 {
  background: none;
  -webkit-text-fill-color: initial;
  color: #064e3b;
}
body.state-success .status-box {
  color: #064e3b;
}
body.state-success p.subtitle {
  color: #065f46;
}

body.state-error .container {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(0.98);
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0) scale(0.98); }
  20%, 80% { transform: translate3d(2px, 0, 0) scale(0.98); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0) scale(0.98); }
  40%, 60% { transform: translate3d(4px, 0, 0) scale(0.98); }
}

body.state-error h1 {
  background: none;
  -webkit-text-fill-color: initial;
  color: #7f1d1d;
}
body.state-error .status-box {
  color: #7f1d1d;
}
body.state-error p.subtitle {
  color: #991b1b;
}

.btn-nav {
  display: inline-block;
  margin-top: 25px;
  padding: 10px 20px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.btn-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  color: #fff;
}

body.state-success .btn-nav, body.state-error .btn-nav {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.7);
}

body.state-success .btn-nav:hover, body.state-error .btn-nav:hover {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.9);
}
