:root {
  --bg-color: #0f172a;
  --panel-bg: #1e293b;
  --primary-color: #10b981; /* Green contrast */
  --secondary-color: #3b82f6; /* Blue contrast */
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --danger-color: #ef4444;
  --border-radius: 16px;
  --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-size: 18px; /* Bigger default font for seniors */
  line-height: 1.5;
  overflow-x: hidden;
}

/* App Shell Layout */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background-color: #1e293b;
  padding: 16px;
  text-align: center;
  border-bottom: 2px solid #334155;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
}

.main-content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* Accessible Forms & Controls */
.btn-large {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 64px; /* Big button target */
  border-radius: var(--border-radius);
  border: none;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 16px;
  transition: transform 0.1s ease, filter 0.2s ease;
  color: #fff;
  text-decoration: none;
}

.btn-primary { background-color: var(--primary-color); }
.btn-secondary { background-color: var(--secondary-color); }
.btn-danger { background-color: var(--danger-color); }

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

.btn-large:focus {
  outline: 4px solid var(--secondary-color);
  outline-offset: 2px;
}

/* Cards & Containers */
.card {
  background-color: var(--panel-bg);
  border-radius: var(--border-radius);
  padding: 24px;
  margin-bottom: 16px;
  border: 1px solid #334155;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.input-large {
  width: 100%;
  min-height: 56px;
  border-radius: 8px;
  border: 2px solid #475569;
  background-color: #0f172a;
  color: #fff;
  padding: 12px;
  font-size: 18px;
  margin-bottom: 16px;
}

.input-large:focus {
  border-color: var(--primary-color);
  outline: none;
}

/* Loading & Scanner Specific Styles */
.loading-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
  min-height: 100vh;
}

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

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

/* Scanner Frame for Quagga2 */
#reader {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#reader video, #reader canvas.drawingBuffer {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
}

#reader canvas.drawingBuffer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
}

/* Scan Corners — Colțuri galbene centrate pe zona de scanare (300x90px) */
.scan-corners {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 90px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
}

.corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: #fbbf24;
  border-style: solid;
  border-width: 0;
}

.corner-tl { top: 0; left: 0; border-top-width: 4px; border-left-width: 4px; border-top-left-radius: 6px; }
.corner-tr { top: 0; right: 0; border-top-width: 4px; border-right-width: 4px; border-top-right-radius: 6px; }
.corner-bl { bottom: 0; left: 0; border-bottom-width: 4px; border-left-width: 4px; border-bottom-left-radius: 6px; }
.corner-br { bottom: 0; right: 0; border-bottom-width: 4px; border-right-width: 4px; border-bottom-right-radius: 6px; }

/* Feedback Boxes */
.scan-feedback-box {
  border-radius: 8px;
  padding: 14px;
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.5;
}

.feedback-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #a7f3d0;
}

.feedback-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
}

.feedback-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid #f59e0b;
  color: #fde68a;
}

.feedback-info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid #3b82f6;
  color: #bfdbfe;
}
