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

/* =========================
   ROOT
========================= */
:root {
  --bg: #05070f;
  --bg-secondary: #0a0f1e;

  --text: #f3f6ff;
  --text-soft: rgba(255,255,255,0.70);
  --text-muted: rgba(255,255,255,0.35);

  --primary: #7c5cff;
  --primary-2: #5a8dff;
  --primary-glow: rgba(124,92,255,0.25);

  --success: #3dd68c;
  --danger: #ff6b6b;
  --warning: #ffb84d;

  --header-bg: rgba(5, 7, 15, 0.75);
  --card-bg: rgba(255,255,255,0.02);
  --border-color: rgba(255,255,255,0.06);
  --border-hover: rgba(124,92,255,0.25);
}

/* =========================
   BODY
========================= */
body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background:
    radial-gradient(ellipse 80% 60% at 0% 20%, rgba(124,92,255,0.08), transparent 70%),
    radial-gradient(ellipse 60% 50% at 100% 10%, rgba(90,141,255,0.06), transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 100%, rgba(124,92,255,0.04), transparent 50%),
    linear-gradient(180deg, #05070f 0%, #090e1c 50%, #05070f 100%);

  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* =========================
   MODERN HEADER
========================= */
.topbar {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  margin-top: 1rem;
  position: relative;
  z-index: 10;

  background: var(--header-bg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 18px;
  box-shadow:
    0 8px 32px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.04);
}

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

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 60%, rgba(124,92,255,0.8));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* =========================
   MODERN NAV
========================= */
.top-nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-link {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  transition: all 0.2s ease;
  position: relative;
  letter-spacing: 0.01em;
}

.nav-link:hover {
  background: rgba(124,92,255,0.1);
  color: #fff;
}

.nav-link.active {
  background: rgba(124,92,255,0.15);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 24px rgba(124,92,255,0.12);
}

/* =========================
   MODERN STATUS BADGE
========================= */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(61,214,140,0.08), rgba(61,214,140,0.03));
  border: 1px solid rgba(61,214,140,0.12);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}

.status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(61,214,140,0.5);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-badge strong {
  color: var(--success);
}

/* =========================
   LAYOUT
========================= */
.layout {
  width: 100%;
  max-width: 1200px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2.5rem;
  padding: 2rem 1.5rem 3rem;
  flex: 1;
}

/* =========================
   FORM AREA
========================= */
.form-area h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1.4rem;
  color: rgba(255,255,255,0.9);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
}

.field input {
  width: 100%;
  height: 52px;
  padding: 0 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
  color: #fff;
  font-size: 0.9rem;
  outline: none;
  transition: 0.22s ease;
  font-family: "JetBrains Mono", "SF Mono", monospace;
}

.field input::placeholder {
  color: rgba(255,255,255,0.18);
}

.field input:hover {
  border-color: rgba(255,255,255,0.08);
}

.field input:focus {
  border-color: rgba(124,92,255,0.4);
  background: rgba(124,92,255,0.05);
  box-shadow: 0 0 0 4px rgba(124,92,255,0.08);
}

/* =========================
   BUTTON
========================= */
.main-btn {
  width: 100%;
  height: 54px;
  margin-top: 0.5rem;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  transition: transform 0.15s, box-shadow 0.2s;
}

.main-btn:hover {
  box-shadow: 0 8px 32px rgba(124,92,255,0.3);
}

.main-btn:active {
  transform: scale(0.985);
}

.main-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* =========================
   PROGRESS
========================= */
.progress-wrap {
  display: none;
  margin-top: 1.2rem;
}

.progress-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width 0.35s ease;
}

.progress-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* =========================
   PANEL
========================= */
.panel {
  padding-top: 0.5rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.panel-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(255,255,255,0.88);
}

/* =========================
   LIVE BADGE
========================= */
.live-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--success);
}

.live-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(61,214,140,0.7);
  animation: blink 1.6s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

/* =========================
   LOG BOX
========================= */
.log-box {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: 18px;
  padding: 0.8rem;
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.log-box::-webkit-scrollbar {
  width: 4px;
}

.log-box::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
}

.log-line {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  font-size: 0.8rem;
  animation: slideIn 0.18s ease;
}

.log-line i {
  width: 14px;
  flex-shrink: 0;
}

.log-line.done {
  color: var(--success);
  background: rgba(61,214,140,0.06);
}

.log-line.fail {
  color: var(--danger);
  background: rgba(255,107,107,0.06);
}

.log-line.warn {
  color: var(--warning);
  background: rgba(255,184,77,0.06);
}

.log-line.info {
  color: rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.02);
}

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

/* =========================
   FOOTER
========================= */
footer {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  padding: 1rem 1.5rem 1.5rem;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.18);
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .panel {
    order: -1;
  }
  .topbar {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
  }
}

@media (max-width: 640px) {
  .topbar {
    border-radius: 12px;
    padding: 0.6rem 0.9rem;
    flex-direction: column;
    align-items: stretch;
  }
  .top-nav {
    justify-content: center;
    flex-wrap: wrap;
  }
  .nav-link {
    font-size: 0.75rem;
    padding: 0.35rem 0.7rem;
  }
  .layout {
    padding: 1rem 1rem 2rem;
  }
  .input-row {
    grid-template-columns: 1fr;
  }
  .status-badge {
    font-size: 0.7rem;
    padding: 0.35rem 0.75rem;
    justify-content: center;
  }
  footer {
    flex-direction: column;
    gap: 0.35rem;
    text-align: center;
  }
}