/* ═══════════════════════════════════════════════════════════
   DL Webapp — Premium Design System v2
   Dark theme · Glassmorphism · Micro-animations
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
  /* Colors — Refined dark palette */
  --bg-primary: #050510;
  --bg-secondary: #0a0a1a;
  --bg-tertiary: #0f0f24;
  --bg-card: rgba(15, 15, 40, 0.6);
  --bg-card-hover: rgba(20, 20, 50, 0.8);
  --bg-input: rgba(255, 255, 255, 0.04);
  --bg-input-focus: rgba(255, 255, 255, 0.07);

  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-card: rgba(255, 255, 255, 0.08);
  --border-input: rgba(255, 255, 255, 0.1);
  --border-input-focus: rgba(99, 102, 241, 0.6);

  --text-primary: #eef0f6;
  --text-secondary: #a0a8c0;
  --text-muted: #636b83;
  --text-inverse: #ffffff;

  --accent-primary: #6366f1;
  --accent-secondary: #818cf8;
  --accent-tertiary: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);
  --accent-gradient-subtle: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  --accent-glow: rgba(99, 102, 241, 0.3);
  --accent-glow-soft: rgba(99, 102, 241, 0.12);

  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.08);
  --success-border: rgba(52, 211, 153, 0.25);

  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.08);
  --warning-border: rgba(251, 191, 36, 0.25);

  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.08);
  --error-border: rgba(248, 113, 113, 0.25);

  --info: #38bdf8;
  --info-bg: rgba(56, 189, 248, 0.08);
  --info-border: rgba(56, 189, 248, 0.25);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: 100px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.12);
  --shadow-glow-strong: 0 0 60px rgba(99, 102, 241, 0.2);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ─── Animated Background ──────────────────────────────── */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 80px 80px;
  z-index: 0;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at 50% 50%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 30%, transparent 80%);
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(150px);
  opacity: 0.35;
  z-index: 0;
  pointer-events: none;
  animation: bgFloat 25s ease-in-out infinite;
}

.bg-glow-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.35), transparent 70%);
  top: -15%;
  right: -10%;
  animation-delay: 0s;
}

.bg-glow-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.25), transparent 70%);
  bottom: -15%;
  left: -10%;
  animation-delay: -12s;
}

.bg-glow-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(167, 139, 250, 0.15), transparent 70%);
  top: 40%;
  left: 30%;
  animation-delay: -6s;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(40px, -30px) scale(1.08); }
  50% { transform: translate(-30px, 40px) scale(0.92); }
  75% { transform: translate(25px, 25px) scale(1.04); }
}

/* Noise overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px;
}

/* ─── Glass Effect ──────────────────────────────────────── */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--border-card);
}

.glass-strong {
  background: rgba(15, 15, 40, 0.8);
  backdrop-filter: blur(40px) saturate(1.4);
  -webkit-backdrop-filter: blur(40px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ─── Typography ────────────────────────────────────────── */
h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.12), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::before {
  opacity: 1;
}

.btn-primary {
  background: var(--accent-gradient);
  color: var(--text-inverse);
  box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow), 0 0 0 1px rgba(99, 102, 241, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px var(--accent-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--border-input);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-full {
  width: 100%;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  transition: all var(--transition-fast);
}

.btn-link:hover {
  color: var(--accent-tertiary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-text {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-loader {
  display: inline-flex;
  align-items: center;
}

/* Spinner */
.spinner {
  animation: spin 0.8s linear infinite;
}

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

/* ─── Form Elements ─────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-base);
  z-index: 1;
}

.input-wrapper input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.925rem;
  transition: all var(--transition-base);
  outline: none;
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.input-wrapper input:focus {
  background: var(--bg-input-focus);
  border-color: var(--border-input-focus);
  box-shadow: 0 0 0 3px var(--accent-glow-soft), var(--shadow-glow);
}

.input-wrapper:focus-within .input-icon {
  color: var(--accent-secondary);
}

.form-error {
  padding: 0.75rem 1rem;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 0.85rem;
  font-weight: 500;
  animation: slideDown var(--transition-base) ease-out;
}

.form-success {
  padding: 0.75rem 1rem;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 500;
  animation: slideDown var(--transition-base) ease-out;
}

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

.form-row {
  display: flex;
  gap: var(--space-md);
}

.form-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.form-group-url {
  flex: 1;
}

.hidden {
  display: none !important;
}

/* ─── Auth Page ─────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-lg);
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
}

.auth-card {
  padding: var(--space-2xl) var(--space-2xl) var(--space-xl);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl), var(--shadow-glow-strong);
  animation: cardAppear 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

/* Subtle gradient border effect on auth card */
.auth-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-2xl);
  padding: 1px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), transparent 40%, transparent 60%, rgba(139, 92, 246, 0.2));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.auth-logo {
  margin-bottom: var(--space-md);
  display: inline-block;
  animation: logoFloat 4s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.3));
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.auth-title {
  font-size: 1.875rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
  font-weight: 700;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.auth-toggle {
  text-align: center;
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.875rem;
  color: var(--text-muted);
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  align-items: center;
}

/* ─── Dashboard Page ────────────────────────────────────── */
.dashboard-page {
  min-height: 100vh;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  background: rgba(5, 5, 16, 0.8);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-title {
  font-size: 1.15rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.header-user {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-user::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
  animation: pulse 3s ease-in-out infinite;
}

/* Main content */
.main-content {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-xl) var(--space-3xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
}

.stat-card {
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  transition: all var(--transition-base);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-input);
}

.stat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.stat-icon.pending { background: var(--warning-bg); color: var(--warning); }
.stat-icon.processing { background: var(--info-bg); color: var(--info); }
.stat-icon.completed { background: var(--success-bg); color: var(--success); }
.stat-icon.total { background: var(--accent-gradient-subtle); color: var(--accent-secondary); }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-top: 2px;
}

/* Cards */
.card {
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-md);
  animation: cardSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

/* Gradient accent line at the top of cards */
.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-xl);
  right: var(--space-xl);
  height: 1px;
  background: var(--accent-gradient);
  opacity: 0.4;
}

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

.submit-card {
  animation-delay: 0.1s;
  animation-fill-mode: both;
}

.jobs-card {
  animation-delay: 0.2s;
  animation-fill-mode: both;
}

.card-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.card-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  color: var(--text-inverse);
  flex-shrink: 0;
  box-shadow: 0 4px 12px var(--accent-glow-soft);
}

.card-title {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 600;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-header .btn {
  margin-left: auto;
}

/* Submit form */
.submit-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* ─── Jobs List ─────────────────────────────────────────── */
.jobs-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.jobs-empty {
  text-align: center;
  padding: var(--space-3xl) var(--space-md);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.jobs-empty p {
  font-size: 0.9rem;
}

.job-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  animation: jobSlideIn 0.35s ease-out both;
}

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

.job-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.08);
}

.job-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.job-status-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
}

.job-status-dot.pending {
  background: var(--warning);
  color: var(--warning);
  animation: dotPulse 2s ease-in-out infinite;
}

.job-status-dot.processing {
  background: var(--info);
  color: var(--info);
  animation: dotPulse 1.5s ease-in-out infinite;
}

.job-status-dot.processing::after {
  opacity: 0.3;
  animation: dotRing 1.5s ease-in-out infinite;
}

.job-status-dot.completed {
  background: var(--success);
  color: var(--success);
}

.job-status-dot.error {
  background: var(--error);
  color: var(--error);
}

@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

@keyframes dotRing {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.8); opacity: 0; }
}

.job-info {
  flex: 1;
  min-width: 0;
}

.job-url {
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.job-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  gap: var(--space-md);
  margin-top: 3px;
}

.job-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.job-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.job-badge.pending {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.job-badge.processing {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.job-badge.completed {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.job-badge.error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-border);
}

/* ─── Modal ─────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 580px;
  max-height: 80vh;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl), var(--shadow-glow-strong);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(24px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-body {
  padding: var(--space-xl);
  overflow-y: auto;
}

.modal-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.modal-detail-row:last-child {
  border-bottom: none;
}

.modal-detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  flex-shrink: 0;
}

.modal-detail-value {
  font-size: 0.9rem;
  color: var(--text-primary);
  text-align: right;
  word-break: break-all;
  max-width: 65%;
}

.modal-urls {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.8;
  color: var(--info);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  user-select: all;
}

.copy-btn {
  margin-top: var(--space-md);
}

/* ─── Connection indicator ──────────────────────────────── */
.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  margin-right: var(--space-xs);
  animation: pulse 3s ease-in-out infinite;
}

.connection-dot.disconnected {
  background: var(--error);
  animation: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: 0.6; box-shadow: 0 0 0 6px transparent; }
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  .auth-card {
    padding: var(--space-xl);
  }

  .main-content {
    padding: var(--space-md);
  }

  .card {
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
  }

  .card::after {
    left: var(--space-lg);
    right: var(--space-lg);
  }

  .form-row-split {
    grid-template-columns: 1fr;
  }

  .header {
    padding: var(--space-md);
  }

  .header-title {
    font-size: 1rem;
  }

  .job-meta {
    flex-direction: column;
    gap: 2px;
  }

  .modal-content {
    max-height: 90vh;
    border-radius: var(--radius-lg);
  }

  .modal-detail-row {
    flex-direction: column;
    gap: var(--space-xs);
  }

  .modal-detail-value {
    text-align: left;
    max-width: 100%;
  }

  .stats-bar {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 400px) {
  .stats-bar {
    grid-template-columns: 1fr;
  }
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* ─── Selection ─────────────────────────────────────────── */
::selection {
  background: rgba(99, 102, 241, 0.4);
  color: var(--text-inverse);
}

/* ─── Toast notification ────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 2000;
  animation: toastIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast.success {
  background: rgba(5, 46, 32, 0.9);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.toast.error {
  background: rgba(50, 10, 10, 0.9);
  border: 1px solid var(--error-border);
  color: var(--error);
}

.toast.info {
  background: rgba(5, 30, 50, 0.9);
  border: 1px solid var(--info-border);
  color: var(--info);
}

.toast-out {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) translateX(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) translateX(0) scale(1); }
}

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

/* ─── Page transition ──────────────────────────────────── */
.page-loading {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.page-loaded {
  opacity: 1;
}

/* ─── Focus ring for accessibility ─────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

/* ─── Disabled state ───────────────────────────────────── */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}
