/* ═══════════════════════════════════════════════
   PhinodIA — Design System
   Apple.com-inspired white minimalist theme
   ═══════════════════════════════════════════════ */

:root {
  --bg: #fbfbfd;
  --surface: #f5f5f7;
  --surface-hover: #e8e8ed;
  --border: #d2d2d7;
  --border-hover: #86868b;
  --text: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #6e6e73;
  --accent: #0066cc;
  --accent-hover: #0055b3;
  --accent-subtle: rgba(0,102,204,0.06);
  --error: #de3730;
  --warning: #bf5600;
  --success: #248a3d;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --nav-height: 52px;
  --max-width: 980px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.47059;
  font-size: 17px;
  min-height: 100vh;
  overflow-x: hidden;
  letter-spacing: -0.022em;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ── Navigation ─────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(251,251,253,0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo img { height: 22px; display: block; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 400;
  transition: color var(--transition);
  text-decoration: none;
  letter-spacing: 0;
}

.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }

.nav-cta {
  background: var(--accent) !important;
  color: #fff !important;
  padding: 6px 16px !important;
  border-radius: 980px !important;
  font-weight: 400 !important;
  font-size: 12px !important;
  transition: background var(--transition) !important;
}

.nav-cta:hover { background: var(--accent-hover) !important; text-decoration: none !important; }

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
}

/* ── Layout ──────────────────────────────────── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
}

main { padding-top: calc(var(--nav-height) + 40px); padding-bottom: 80px; }

.section { margin-bottom: 80px; }

/* ── Hero ─────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 60px 0 48px;
}

.hero-overline {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 8px;
}

.hero-badge {
  display: inline-block;
  color: var(--text-tertiary);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  background: none;
  border: none;
  padding: 0;
}

.hero h1 {
  font-size: clamp(32px, 5.5vw, 56px);
  font-weight: 700;
  line-height: 1.07143;
  letter-spacing: -0.005em;
  margin-bottom: 16px;
  color: var(--text);
}

.hero h1 .gradient {
  color: var(--text);
  background: none;
  -webkit-text-fill-color: unset;
}

.hero p {
  font-size: 21px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 32px;
  line-height: 1.381;
  font-weight: 400;
}

/* ── Cards / Surface ─────────────────────────── */
.card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 32px;
  transition: background var(--transition);
}

.card:hover {
  background: var(--surface-hover);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
  background: rgba(0,0,0,0.05);
  color: var(--text);
  font-weight: 700;
}

.card h3 {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
}

.card-link::after { content: ' >'; }
.card-link:hover { text-decoration: underline; }

/* ── Buttons ──────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 980px;
  font-size: 17px;
  font-weight: 400;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  letter-spacing: -0.022em;
}

.btn:hover { text-decoration: none; }

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

.btn-primary:hover { background: #000; color: #fff; }

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

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

.btn-secondary:hover { background: var(--accent); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--accent);
  padding: 8px 16px;
}

.btn-ghost:hover { text-decoration: underline; }

.btn-sm { padding: 8px 18px; font-size: 14px; }
.btn-lg { padding: 14px 32px; font-size: 17px; }
.btn-block { width: 100%; }

/* ── Forms ────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 17px;
  font-family: inherit;
  transition: border-color var(--transition);
  outline: none;
  letter-spacing: -0.022em;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0,102,204,0.1);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--border-hover);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2386868b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-select option { background: #fff; color: var(--text); }

.form-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

.form-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 6px;
}

/* ── File Upload ──────────────────────────────── */
.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  background: #fff;
}

.file-upload:hover, .file-upload.dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.file-upload.has-file {
  border-style: solid;
  border-color: var(--accent);
  padding: 16px;
}

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

.file-upload-icon {
  font-size: 28px;
  margin-bottom: 12px;
  color: var(--text-secondary);
}

.file-upload-text {
  color: var(--text-secondary);
  font-size: 14px;
}

.file-upload-text strong { color: var(--accent); }

.file-preview {
  max-height: 200px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

/* ── Checkbox ─────────────────────────────────── */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-group label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  margin-bottom: 0;
}

.checkbox-group label a { text-decoration: underline; }

/* ── Option Picker ────────────────────────────── */
.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.option-btn {
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.option-btn:hover { border-color: var(--border-hover); color: var(--text); }

.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent);
}

.option-btn small { color: var(--text-secondary) !important; }

/* ── Pricing ──────────────────────────────────── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.pricing-card {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  transition: all var(--transition);
  position: relative;
}

.pricing-card:hover {
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.pricing-card.popular {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.pricing-card.popular::before {
  content: 'Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  padding: 4px 16px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 600;
}

.pricing-credits {
  font-size: 40px;
  font-weight: 700;
  margin: 12px 0 4px;
  color: var(--text);
}

.pricing-label {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 16px;
}

.pricing-price {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.pricing-per {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 20px;
}

/* ── Status / Progress ────────────────────────── */
.status-card {
  background: var(--surface);
  border: none;
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
}

.status-icon {
  font-size: 48px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 20px 0;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.status-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.processing { background: rgba(0,102,204,0.1); color: var(--accent); }
.status-badge.completed { background: rgba(36,138,61,0.1); color: var(--success); }
.status-badge.failed { background: rgba(222,55,48,0.1); color: var(--error); }
.status-badge.pending { background: var(--surface); color: var(--text-secondary); }

/* ── Credits Balance ──────────────────────────── */
.credits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.credit-item {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-sm);
  padding: 20px;
  text-align: center;
}

.credit-count {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
}

.credit-label {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

/* ── Toast Notifications ──────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--nav-height) + 16px);
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 14px;
  min-width: 280px;
  max-width: 400px;
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  color: var(--text);
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }
.toast.warning { border-color: var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Loading Spinner ──────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg { width: 40px; height: 40px; border-width: 3px; }

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(251,251,253,0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  flex-direction: column;
  gap: 16px;
  color: var(--text);
}

/* ── Tabs ─────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 32px;
  overflow-x: auto;
}

.tab {
  padding: 10px 20px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  border: none;
  background: none;
}

.tab:hover { color: var(--text); }
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ── Section Headers ──────────────────────────── */
.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-header h2 {
  font-size: clamp(24px, 3.5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.005em;
  margin-bottom: 8px;
  color: var(--text);
}

.section-header p {
  color: var(--text-secondary);
  font-size: 17px;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Footer ───────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 80px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer p {
  color: var(--text-secondary);
  font-size: 12px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
}

.footer-links a:hover { color: var(--text); text-decoration: none; }

/* ── Form Layout ──────────────────────────────── */
.form-card {
  max-width: 640px;
  margin: 0 auto;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Utility ──────────────────────────────────── */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.hidden { display: none !important; }

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(251,251,253,0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 20px 22px;
    gap: 16px;
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open a { font-size: 15px; }
  .nav-toggle { display: block; }
  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 17px; }
  .card-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
  .section { margin-bottom: 48px; }
  main { padding-top: calc(var(--nav-height) + 16px); }
  .tabs { justify-content: stretch; }
  .tab { flex: 1; text-align: center; font-size: 13px; padding: 8px 12px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .card { padding: 24px; }
  .option-grid { grid-template-columns: 1fr 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-card { padding: 24px 20px; }
}
