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

:root {
  --bg-dark: #090d16;
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.9);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-light: rgba(56, 189, 248, 0.2);
  
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.35);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.35);
  --warning: #f59e0b;
  --error: #f43f5e;
  --error-glow: rgba(244, 63, 94, 0.35);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-main: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px var(--primary-glow);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.12) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
    radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.8) 0px, transparent 100%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1.5rem;
  overflow-x: hidden;
}

h1, h2, h3, .font-heading {
  font-family: 'Outfit', 'Inter', sans-serif;
  letter-spacing: -0.02em;
}

/* Header & Nav */
.header-nav {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

.brand-info h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.brand-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  gap: 0.75rem;
}

.nav-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.nav-btn:hover, .nav-btn.active {
  color: #fff;
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--primary);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

/* Container & Cards */
.container {
  width: 100%;
  max-width: 1200px;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-main);
  transition: border-color 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

/* Grid Layouts */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

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

/* QR Code Display Container */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 2rem;
}

.qr-frame {
  position: relative;
  background: #ffffff;
  padding: 1.25rem;
  border-radius: 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(56, 189, 248, 0.25);
  display: inline-block;
  margin: 1.5rem 0;
  transition: transform 0.3s ease;
}

.qr-frame:hover {
  transform: scale(1.02);
}

#qrcode canvas, #qrcode img {
  display: block !important;
  max-width: 280px;
  max-height: 280px;
  border-radius: 8px;
}

/* Circular Timer Widget */
.timer-widget {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  background: rgba(15, 23, 42, 0.6);
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  border: 1px solid var(--border-color);
}

.timer-circle {
  position: relative;
  width: 42px;
  height: 42px;
}

.timer-circle svg {
  width: 42px;
  height: 42px;
  transform: rotate(-90deg);
}

.timer-circle circle {
  fill: none;
  stroke-width: 4;
}

.timer-bg {
  stroke: rgba(255, 255, 255, 0.1);
}

.timer-progress {
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s linear, stroke 0.3s ease;
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.timer-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Stats Badges */
.stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-pill {
  flex: 1;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-color);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
}

.stat-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* Table Styling */
.table-container {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th {
  background: rgba(15, 23, 42, 0.8);
  padding: 0.9rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

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

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

.badge-error {
  background: rgba(244, 63, 94, 0.15);
  color: var(--error);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Form Controls & Inputs */
.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.form-input, .form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 15px var(--primary-glow);
}

.btn {
  width: 100%;
  padding: 0.85rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.25 ease;
  box-shadow: var(--shadow-main);
}

.btn-primary {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Scanner Specific UI */
.scanner-card {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.scanner-viewport {
  width: 100%;
  min-height: 260px;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  margin: 1rem 0;
  border: 2px dashed var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#reader {
  width: 100%;
  border: none !important;
}

#reader video {
  border-radius: var(--radius-md);
  object-fit: cover;
}

/* Status Cards & Alert Box */
.status-card {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-top: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  text-align: left;
  animation: fadeIn 0.3s ease-in-out;
}

.status-card.success {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
}

.status-card.error {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fecdd3;
}

.status-card.warning {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
}

.status-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.status-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.status-desc {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Helper Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.pulse {
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(56, 189, 248, 0); }
  100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0); }
}

/* Hidden Utility */
.hidden {
  display: none !important;
}
