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

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
  --bg-dark: #060b14;
  --bg-card: rgba(14, 22, 38, 0.72);
  --bg-card-hover: rgba(22, 34, 58, 0.85);
  --bg-input: rgba(8, 14, 26, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(139, 92, 246, 0.35);

  --primary: #8b5cf6;
  --primary-dark: #7c3aed;
  --primary-glow: rgba(139, 92, 246, 0.45);
  --secondary: #06b6d4;
  --secondary-glow: rgba(6, 182, 212, 0.45);
  --accent: #f43f5e;
  --accent-glow: rgba(244, 63, 94, 0.35);
  --success: #10b981;
  --warning: #f59e0b;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #475569;

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.5);
  --shadow-primary: 0 4px 20px rgba(139,92,246,0.4);
  --shadow-secondary: 0 4px 20px rgba(6,182,212,0.35);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-dark);
  background-image:
    radial-gradient(ellipse at 0% 0%, rgba(139, 92, 246, 0.18) 0, transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(6, 182, 212, 0.14) 0, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(6, 11, 20, 0.9) 0, transparent 100%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   GLASSMORPHISM PANEL
   ============================================================ */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(6, 11, 20, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 2rem;
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-primary);
}

.brand-badge {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================================================
   LIVE QUEUE PILL
   ============================================================ */
.live-queue-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.28);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 600;
  color: #c4b5fd;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.live-queue-pill:hover {
  background: rgba(139, 92, 246, 0.2);
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.25);
}

.pill-sep { opacity: 0.3; font-size: 0.85rem; }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse-anim 1.8s infinite;
}

@keyframes pulse-anim {
  0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129,0.7); }
  70%  { transform: scale(1.1);  box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: var(--transition-fast);
}

.btn:hover::after { background: rgba(255,255,255,0.06); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(139,92,246,0.5);
}

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

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

.btn-accent {
  background: linear-gradient(135deg, var(--secondary), #0284c7);
  color: white;
  box-shadow: var(--shadow-secondary);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(6,182,212,0.45);
}

.btn-admin {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

.btn-admin:hover {
  background: rgba(244, 63, 94, 0.22);
  border-color: rgba(244, 63, 94, 0.5);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.28);
}

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

.btn-google:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.btn-full { width: 100%; }

.btn-sm {
  padding: 0.38rem 0.75rem;
  font-size: 0.82rem;
}

/* ============================================================
   USER PROFILE BADGE
   ============================================================ */
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
}

.avatar-wrap { flex-shrink: 0; }

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--primary);
}

.user-avatar-placeholder {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.user-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 2px;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.role-badge.admin {
  background: rgba(244, 63, 94, 0.18);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.role-badge.user {
  background: rgba(6, 182, 212, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.role-badge.danger {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ============================================================
   STATUS BADGE
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.status-badge.idle { color: var(--text-muted); }
.status-badge.processing { color: #a78bfa; animation: pulse-text 1.5s infinite; }
.status-badge.done { color: var(--success); }
.status-badge.error { color: var(--accent); }

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
  width: 100%;
}

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero-banner {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 1rem 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
  animation: fadeInDown 0.5s ease;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 0.8rem;
  background: linear-gradient(135deg, #ffffff 20%, #a78bfa 60%, #38bdf8 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: fadeInUp 0.5s ease 0.1s both;
}

.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.08rem;
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.65;
  animation: fadeInUp 0.5s ease 0.2s both;
}

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

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   LOGIN REQUIRED BANNER
   ============================================================ */
.login-required-banner {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  animation: fadeInUp 0.4s ease;
}

.login-required-content {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.login-required-content h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.login-required-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.login-required-content .btn {
  margin-left: auto;
  flex-shrink: 0;
}

/* ============================================================
   WORKSPACE GRID
   ============================================================ */
.workspace-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.75rem;
}

.workspace-locked {
  opacity: 0.5;
  pointer-events: none;
  filter: blur(1px);
  user-select: none;
}

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

/* ============================================================
   UPLOAD PANEL
   ============================================================ */
.upload-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.85rem;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-limit {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  background: rgba(255,255,255,0.05);
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
}

/* ============================================================
   DROPZONE
   ============================================================ */
.dropzone {
  border: 2px dashed rgba(139, 92, 246, 0.35);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  background: rgba(8, 14, 26, 0.5);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.07);
  box-shadow: inset 0 0 30px rgba(139, 92, 246, 0.05);
}

.dropzone-icon {
  margin-bottom: 0.7rem;
  transition: var(--transition);
}

.dropzone:hover .dropzone-icon {
  transform: scale(1.08) translateY(-3px);
}

.dropzone-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.dropzone-text span {
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dropzone-formats {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  background: rgba(255,255,255,0.04);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.preview-thumb {
  max-width: 100%;
  max-height: 160px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  margin-top: 0.8rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.preview-info {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.62rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.form-hint {
  font-size: 0.73rem;
  color: var(--text-dim);
}

.form-select option {
  background: #0d1929;
  color: var(--text-main);
}

.form-textarea { resize: vertical; min-height: 120px; }

.input-icon-wrap { position: relative; }
.input-icon-wrap .form-input { padding-right: 2.8rem; }

.pw-toggle {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: var(--transition-fast);
}

.pw-toggle:hover { color: var(--primary); }

/* ============================================================
   INFO / ALERT BOXES
   ============================================================ */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(6, 182, 212, 0.07);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.alert-error {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  font-size: 0.88rem;
  color: #fca5a5;
  margin-bottom: 1rem;
}

/* ============================================================
   LOCKED STATE
   ============================================================ */
.locked-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  gap: 0.5rem;
  color: var(--text-dim);
}

/* ============================================================
   STUDIO VIEWER
   ============================================================ */
.studio-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 560px;
}

.view-tabs {
  display: flex;
  gap: 0.35rem;
  background: rgba(8, 14, 26, 0.7);
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 10px var(--primary-glow);
}

.tab-btn:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255,255,255,0.06);
}

.viewer-stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1rem;
}

.tab-content-frame {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.image-frame {
  background: rgba(6, 11, 20, 0.92);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  padding: 1rem;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 300px;
}

.frame-title {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(8, 14, 26, 0.88);
  backdrop-filter: blur(8px);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid var(--border-color);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.manga-image-display {
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
}

.empty-studio {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 300px;
  text-align: center;
}

.empty-frame-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* ============================================================
   RESULT PANEL
   ============================================================ */
.result-card {
  background: rgba(8, 14, 26, 0.6);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  animation: fadeInUp 0.3s ease;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.result-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.result-stat-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.result-stat-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--primary);
}

/* ============================================================
   DIRECTION BANNER
   ============================================================ */
.reading-dir-banner {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.22);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  font-size: 0.9rem;
  color: #ddd6fe;
}

/* ============================================================
   DIALOGUE TABLE
   ============================================================ */
.dialogue-table-wrapper {
  overflow-x: auto;
  margin-top: 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.dialogue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.dialogue-table th {
  background: rgba(8, 14, 26, 0.9);
  padding: 0.75rem 1rem;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.dialogue-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: top;
}

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

.dialogue-table tr:hover td {
  background: rgba(139, 92, 246, 0.04);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 6px;
  transition: var(--transition-fast);
}

.modal-close:hover {
  color: white;
  background: rgba(255,255,255,0.08);
}

.queue-spinner {
  display: flex;
  justify-content: center;
  animation: spin 1.5s linear infinite;
}

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

/* ============================================================
   ADMIN TABS
   ============================================================ */
.admin-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.75rem;
  overflow-x: auto;
  padding-bottom: 0;
}

.admin-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--font-body);
  transition: var(--transition-fast);
  white-space: nowrap;
  margin-bottom: -1px;
}

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

.admin-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-tab-content { }

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

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

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.2rem;
  flex-wrap: wrap;
}

/* ============================================================
   TEST RESULT BOX
   ============================================================ */
.test-result-box {
  background: rgba(6, 11, 20, 0.97);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: #a7f3d0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 280px;
  overflow-y: auto;
}

.test-result-box.error {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.35);
}

/* ============================================================
   LOGIN METHOD CARDS
   ============================================================ */
.login-method-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .login-method-cards { grid-template-columns: 1fr; }
}

.method-card {
  background: rgba(14, 22, 38, 0.6);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.2rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  text-align: center;
}

.method-card:hover {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.05);
}

.method-card.active {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
}

.method-card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: rgba(139, 92, 246, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.9rem;
  color: var(--primary);
}

.method-card-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.method-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.method-card-check {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: var(--primary);
  opacity: 0;
  transition: var(--transition-fast);
}

.method-card.active .method-card-check { opacity: 1; }

/* ============================================================
   AUTH PAGE (Login / Setup)
   ============================================================ */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
}

.auth-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.orb1 {
  width: 500px;
  height: 500px;
  background: rgba(139, 92, 246, 0.2);
  top: -150px;
  left: -100px;
}

.orb2 {
  width: 400px;
  height: 400px;
  background: rgba(6, 182, 212, 0.15);
  bottom: -100px;
  right: -80px;
}

.orb3 {
  width: 300px;
  height: 300px;
  background: rgba(244, 63, 94, 0.1);
  top: 40%;
  left: 60%;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  background: rgba(10, 16, 30, 0.88);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
  animation: slideUp 0.4s ease;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  justify-content: center;
}

.auth-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-primary);
}

.logo-icon-svg {
  width: 22px;
  height: 22px;
  color: white;
}

.auth-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 800;
}

.brand-accent {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.setup-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
}

.auth-heading {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.auth-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-info-box {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(6, 182, 212, 0.06);
  border: 1px solid rgba(6, 182, 212, 0.18);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-top: 1.25rem;
}

.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1rem 0;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* Password strength */
.pw-strength {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.pw-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.pw-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: var(--transition);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .app-header { padding: 0.75rem 1rem; }
  .main-wrapper { padding: 1rem; }
  .hero-title { font-size: 2rem; }
  .hero-subtitle { font-size: 0.95rem; }
  .login-required-content .btn { margin-left: 0; }
  .live-queue-pill { display: none; }
}

@media (max-width: 480px) {
  .auth-card { padding: 1.8rem 1.4rem; }
  .hero-title { font-size: 1.7rem; }
}
