*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
}

h1, h2 { color: #fff; }

.hidden { display: none !important; }

/* ── Login overlay ── */

.overlay {
  position: fixed;
  inset: 0;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.login-box {
  background: #16213e;
  padding: 2.5rem 2.5rem 2rem;
  border-radius: 12px;
  border: 1px solid rgba(233, 69, 96, 0.3);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 340px;
  max-width: 400px;
  width: 100%;
}

.login-box h2 {
  text-align: center;
  font-weight: 300;
  font-size: 1.6rem;
  letter-spacing: 0.5px;
}

.login-subtitle {
  text-align: center;
  color: #8892a4;
  font-size: 0.85rem;
  margin-top: -0.25rem;
}

.error { color: #e94560; font-size: 0.85rem; text-align: center; }

/* ── Inputs & textareas ── */

input[type="password"],
input[type="text"],
textarea {
  background: #0f3460;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85rem;
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="password"]::placeholder,
input[type="text"]::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

input[type="password"]:focus,
input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 2px rgba(233, 69, 96, 0.15);
}

textarea { width: 100%; }
input[type="text"] { width: 100%; }

textarea[readonly] {
  background: rgba(15, 52, 96, 0.5);
  font-size: 0.8rem;
}

/* ── Buttons ── */

.btn-primary {
  background: #e94560;
  color: #fff;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  color: #e94560;
  border: 1px solid rgba(233, 69, 96, 0.4);
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: rgba(233, 69, 96, 0.1);
}

.btn-outline:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── App layout ── */

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #16213e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
}

.app-header h1 {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* ── Tabs ── */

.tab-bar {
  display: flex;
  gap: 0;
  height: 100%;
}

.tab {
  background: transparent;
  color: #8892a4;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0 1.2rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  height: 100%;
  display: flex;
  align-items: center;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.tab:hover { color: #e0e0e0; }

.tab.active {
  color: #e94560;
  border-bottom-color: #e94560;
}

/* ── Main content ── */

.app-main {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Cards ── */

.card {
  background: #16213e;
  border-radius: 10px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Labels ── */

label {
  font-size: 0.8rem;
  color: #8892a4;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 0.25rem;
}

/* ── Output section ── */

#output-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Status pill ── */

.status-pill {
  background: rgba(233, 69, 96, 0.1);
  border-radius: 20px;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: #e0e0e0;
  text-align: center;
  align-self: center;
}

/* ── Download bar ── */

.download-bar {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 0.25rem;
}

.download-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.download-label {
  font-size: 0.75rem;
  color: #8892a4;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* ── API docs ── */

.api-docs h2 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.api-docs h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  margin-top: 0.5rem;
}

.api-intro {
  font-size: 0.82rem;
  color: #8892a4;
  line-height: 1.5;
}

.api-endpoint {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(15, 52, 96, 0.35);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.api-endpoint > p {
  font-size: 0.82rem;
  color: #b0b8c8;
  line-height: 1.4;
}

.api-method {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.api-method.post {
  background: rgba(233, 69, 96, 0.15);
  color: #e94560;
}

.api-method.get {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
}

.api-path {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.9rem;
  color: #fff;
}

.api-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  background: rgba(241, 196, 15, 0.12);
  color: #f1c40f;
}

.api-section {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.api-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #8892a4;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.api-docs pre {
  background: #0f3460;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.78rem;
  color: #e0e0e0;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.5;
}

.api-example {
  font-size: 0.75rem !important;
  color: #b0b8c8 !important;
}

/* ── Responsive ── */

@media (max-width: 640px) {
  .app-header {
    padding: 0 1rem;
  }

  .app-main {
    padding: 1rem;
  }

  .login-box {
    min-width: 0;
    margin: 0 1rem;
  }

  .download-bar {
    flex-direction: column;
    gap: 0.75rem;
  }
}
