/* ========================================
   API Page — Hero
   ======================================== */
.api-hero {
  padding: 8rem 1.5rem 3rem;
  text-align: center;
  position: relative;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(232, 114, 12, 0.06) 0%, transparent 60%);
}

.api-hero-badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  background: var(--color-accent-glow);
  border-radius: 20px;
  margin-bottom: 1.25rem;
}

.api-hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.api-hero h1 .accent {
  color: var(--color-accent);
}

.api-hero-subtitle {
  color: var(--color-text-light);
  max-width: 680px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ========================================
   Steps Navigation
   ======================================== */
.api-steps-nav {
  padding: 1.5rem 1.5rem 0;
  position: sticky;
  top: 70px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.steps-track {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  max-width: 600px;
  margin: 0 auto;
  padding-bottom: 1.25rem;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-light);
  background: var(--color-bg);
  transition: all var(--transition);
}

.step-item.active .step-number {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}

.step-item.done .step-number {
  border-color: #28c840;
  background: #28c840;
  color: #fff;
}

.step-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  transition: color var(--transition);
}

.step-item.active .step-label {
  color: var(--color-accent);
}

.step-item.done .step-label {
  color: #28c840;
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  margin: 0 0.5rem;
  margin-bottom: 1.2rem;
  max-width: 80px;
  transition: background var(--transition);
}

.step-line.done {
  background: #28c840;
}

/* ========================================
   Panels
   ======================================== */
.api-panel {
  padding: 2.5rem 1.5rem;
}

.panel-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.panel-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--color-accent-glow);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.panel-icon-success {
  background: rgba(40, 200, 64, 0.12);
  color: #28c840;
}

.panel-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.panel-desc {
  color: var(--color-text-light);
  margin-bottom: 2rem;
  line-height: 1.65;
}

/* ========================================
   Forms & Inputs
   ======================================== */
.api-form {
  margin-bottom: 1.5rem;
}

.input-group {
  margin-bottom: 1.25rem;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.input-with-icon {
  position: relative;
}

.input-with-icon svg {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-light);
  pointer-events: none;
}

.input-with-icon input {
  padding-left: 2.8rem;
}

.input-group input,
#manual-auth-form input {
  width: 100%;
  padding: 0.85rem 1rem;
  font-family: var(--font-family);
  font-size: 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
  min-height: 44px;
}

.input-group input:focus,
#manual-auth-form input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-glow);
  outline: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  min-height: 48px;
  text-decoration: none;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: 0 4px 16px rgba(232, 114, 12, 0.25);
}

.btn-outline {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.btn-full {
  width: 100%;
}

/* Button spinner */
.btn-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ========================================
   Discovery Result
   ======================================== */
.discovery-result {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.discovery-success,
.discovery-error {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.result-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-ok {
  background: rgba(40, 200, 64, 0.12);
  color: #28c840;
}

.result-err {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.result-info {
  flex: 1;
}

.result-info strong {
  display: block;
  font-size: 0.95rem;
}

.result-info span {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-top: 0.15rem;
}

.result-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.badge {
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 12px;
  background: var(--color-bg-alt);
  color: var(--color-text-light);
  border: 1px solid var(--color-border);
}

.badge-ok {
  background: rgba(40, 200, 64, 0.1);
  color: #16a34a;
  border-color: rgba(40, 200, 64, 0.3);
}

.badge-warn {
  background: rgba(234, 179, 8, 0.1);
  color: #a16207;
  border-color: rgba(234, 179, 8, 0.3);
}

/* ========================================
   Auth Choice Cards
   ======================================== */
.auth-choice {
  margin-top: 2rem;
}

.auth-choice h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.auth-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.auth-card {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  font-family: var(--font-family);
}

.auth-card:hover {
  border-color: var(--color-accent);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.auth-card-icon {
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

.auth-card strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.auth-card span {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-light);
  line-height: 1.5;
}

.auth-card-badge {
  position: absolute;
  top: -8px;
  right: 12px;
  padding: 0.15rem 0.6rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--color-accent);
  color: #fff;
  border-radius: 10px;
}

/* ========================================
   Auth Info Box
   ======================================== */
.auth-info-box {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.auth-info-box h4 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.auth-info-box ul {
  list-style: none;
  padding: 0;
}

.auth-info-box li {
  font-size: 0.85rem;
  color: var(--color-text-light);
  padding: 0.25rem 0;
  padding-left: 1.25rem;
  position: relative;
  line-height: 1.5;
}

.auth-info-box li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

/* ========================================
   Connected Site Badge
   ======================================== */
.connected-site {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(40, 200, 64, 0.06);
  border: 1px solid rgba(40, 200, 64, 0.2);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.connected-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: #28c840;
  box-shadow: 0 0 6px rgba(40, 200, 64, 0.4);
}

.btn-disconnect {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
}

.btn-disconnect:hover {
  color: #dc2626;
}

/* ========================================
   Content Type Cards
   ======================================== */
.content-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.content-type-card {
  cursor: pointer;
}

.content-type-card input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.ct-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1rem 0.5rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  text-align: center;
  transition: all var(--transition);
  background: var(--color-bg);
  position: relative;
}

.content-type-card input:checked + .ct-inner {
  border-color: var(--color-accent);
  background: rgba(232, 114, 12, 0.04);
}

.ct-inner:hover {
  border-color: var(--color-accent);
}

.ct-inner svg {
  color: var(--color-accent);
}

.ct-inner strong {
  font-size: 0.75rem;
  font-weight: 600;
}

.ct-count {
  font-size: 0.7rem;
  color: var(--color-text-light);
}

.ct-badge-auth {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.35rem;
  background: rgba(234, 179, 8, 0.15);
  color: #a16207;
  border-radius: 6px;
}

.ct-auth-required.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ========================================
   Extract Options
   ======================================== */
.extract-options {
  margin-bottom: 1.5rem;
}

.option-toggle {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  cursor: pointer;
}

.option-toggle input {
  accent-color: var(--color-accent);
  width: 18px;
  height: 18px;
}

.option-toggle code {
  background: var(--color-bg-alt);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* ========================================
   Progress
   ======================================== */
.progress-overall {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.progress-bar-outer {
  flex: 1;
  height: 10px;
  background: var(--color-bg-alt);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-hover));
  border-radius: 5px;
  transition: width 0.3s ease;
}

.progress-pct {
  font-size: 0.9rem;
  font-weight: 700;
  min-width: 3rem;
  text-align: right;
  color: var(--color-accent);
}

.progress-details {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.progress-item-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-item-icon.pending { color: var(--color-text-light); }
.progress-item-icon.running { color: var(--color-accent); }
.progress-item-icon.done { color: #28c840; }
.progress-item-icon.error { color: #dc2626; }

.progress-item-icon.running svg {
  animation: spin 1s linear infinite;
}

.progress-item-name {
  flex: 1;
  font-weight: 500;
}

.progress-item-count {
  color: var(--color-text-light);
  font-size: 0.8rem;
}

.progress-log {
  max-height: 200px;
  overflow-y: auto;
  background: #1a1a1a;
  color: #a0a0a0;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  padding: 1rem;
  border-radius: var(--radius);
  line-height: 1.6;
  margin-top: 1rem;
}

.progress-log .log-ok { color: #28c840; }
.progress-log .log-warn { color: #eab308; }
.progress-log .log-err { color: #dc2626; }
.progress-log .log-info { color: #60a5fa; }

/* ========================================
   Download
   ======================================== */
.download-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  text-align: center;
  padding: 1rem 0.5rem;
  background: var(--color-bg-alt);
  border-radius: var(--radius);
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-accent);
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
}

.download-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.download-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: var(--color-bg-alt);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.download-item button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-accent);
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  transition: background var(--transition);
}

.download-item button:hover {
  background: var(--color-accent-glow);
}

/* ========================================
   Info Section
   ======================================== */
.api-info {
  padding: 3rem 1.5rem 4rem;
  background: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 900px;
  margin: 0 auto;
}

.info-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.info-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.info-card p {
  color: var(--color-text-light);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 600px) {
  .api-hero { padding: 6rem 1.25rem 2rem; }

  .panel-card { padding: 1.75rem 1.25rem; }

  .auth-cards { grid-template-columns: 1fr; }

  .content-types { grid-template-columns: repeat(2, 1fr); }

  .download-stats { grid-template-columns: repeat(2, 1fr); }

  .step-label { font-size: 0.6rem; }

  .step-number { width: 28px; height: 28px; font-size: 0.75rem; }
}

@media (min-width: 768px) {
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}
