* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #09090b;
  --surface: #111114;
  --surface-2: #18181c;
  --border: #27272a;
  --border-hover: #3f3f46;
  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --accent: #7c3aed;
  --accent-hover: #8b5cf6;
  --accent-glow: rgba(124, 58, 237, 0.15);
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.15s ease;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============ AUTH SCREEN ============ */
.screen { min-height: 100vh; }

.auth-container {
  max-width: 380px;
  margin: 0 auto;
  padding: 120px 24px 40px;
  text-align: center;
}

.logo-mark {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 20px;
  box-shadow: 0 0 40px var(--accent-glow);
}

.logo-mark.small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 0;
}

.auth-container h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.tagline {
  color: var(--text-2);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

.input-group {
  text-align: left;
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

input[type="email"],
input[type="password"],
input[type="url"],
input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder { color: var(--text-3); }

/* ============ BUTTONS ============ */
.btn-primary {
  padding: 10px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 20px var(--accent-glow); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  padding: 10px 24px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); background: var(--surface); }

.btn-full { width: 100%; display: block; margin-bottom: 10px; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.btn-icon:hover { color: var(--text); border-color: var(--border-hover); }

.btn-danger {
  padding: 5px 12px;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

.btn-success {
  padding: 6px 16px;
  background: var(--success);
  color: #09090b;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-success:hover { filter: brightness(1.1); }

/* ============ TOAST ============ */
.toast {
  margin-top: 16px;
  padding: 10px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.8rem;
  text-align: left;
  animation: slideUp 0.2s ease;
}

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

/* ============ TOP BAR ============ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.3px;
}

.user-label {
  font-size: 0.8rem;
  color: var(--text-3);
}

/* ============ MAIN CONTENT ============ */
main {
  max-width: 840px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ============ HERO CARD ============ */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.hero-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.hero-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.hint {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-bottom: 20px;
}

.url-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.url-row input {
  flex: 1;
}

.url-row .btn-primary {
  white-space: nowrap;
}

/* ============ FORMAT TOGGLE ============ */
.format-toggle {
  display: flex;
  gap: 8px;
}

.toggle-option {
  flex: 1;
  position: relative;
  cursor: pointer;
}

.toggle-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-option span {
  display: block;
  padding: 10px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
  transition: all var(--transition);
}

.toggle-option input:checked + span {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--text);
}

.toggle-option:hover span {
  border-color: var(--border-hover);
}

/* ============ STATUS ============ */
.status-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding: 14px 18px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  animation: slideUp 0.2s ease;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s ease infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.status-box p {
  font-size: 0.85rem;
  color: var(--text-2);
}

/* ============ TWO COLUMNS ============ */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* ============ PANELS ============ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.panel-header {
  margin-bottom: 16px;
}

.panel-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.2px;
}

/* ============ DROP ZONES ============ */
.upload-area {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.drop-zone:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.drop-zone.uploaded {
  border-style: solid;
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.05);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: 8px;
  color: var(--text-3);
}

.drop-zone span {
  font-size: 0.75rem;
  color: var(--text-3);
  font-weight: 500;
}

/* ============ API KEY BOX ============ */
.api-key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.api-key-box code {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.78rem;
  color: var(--accent-hover);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-example {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.api-example code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.7rem;
  color: var(--text-3);
  line-height: 1.6;
}

/* ============ ITEM LISTS ============ */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  animation: slideUp 0.2s ease;
}

.item-row .left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.item-row .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

.badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.badge-photo { background: rgba(59, 130, 246, 0.1); color: #60a5fa; }
.badge-video { background: rgba(139, 92, 246, 0.1); color: #a78bfa; }
.badge-completed { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.badge-processing { background: rgba(234, 179, 8, 0.1); color: #facc15; }
.badge-pending { background: rgba(161, 161, 170, 0.1); color: var(--text-3); }
.badge-failed { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-image { background: rgba(59, 130, 246, 0.1); color: #60a5fa; }

.time {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.8rem;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.15s ease;
}

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.doc-section { margin-bottom: 24px; }

.doc-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.doc-section h4 {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
  margin: 12px 0 6px;
}

.doc-section p {
  font-size: 0.83rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 8px;
}

.doc-section pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  overflow-x: auto;
  margin-bottom: 8px;
}

.doc-section pre code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.75rem;
  color: var(--accent-hover);
  line-height: 1.7;
  white-space: pre;
}

.doc-endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.doc-endpoint code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.8rem;
  color: var(--text);
}

.method {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.method.post { background: rgba(124, 58, 237, 0.15); color: var(--accent-hover); }
.method.get { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.method.delete { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.doc-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--bg);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.doc-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}

.doc-table td code {
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.73rem;
  color: var(--accent-hover);
}

.doc-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  .upload-area { grid-template-columns: 1fr; }
  .url-row { flex-direction: column; }
  .url-row .btn-primary { width: 100%; }
  main { padding: 20px 16px 60px; }
  .hero-card { padding: 24px; }
  .topbar { padding: 12px 16px; }
}
