/* XAITools - Modern SaaS Style */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --bg-alt: #f1f5f9;
  --text: #0f172a;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --border: #e2e8f0;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

/* Header */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 20px;
}
.logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; line-height: 1;
}
.nav-links {
  display: flex; align-items: center; gap: 28px;
}
.nav-links a {
  text-decoration: none; color: var(--text-light); font-size: 14px; font-weight: 500;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--text); }
.nav-toggle {
  display: none; background: none; border: none; font-size: 24px; cursor: pointer;
}

/* Nav Auth */
.nav-auth { display: flex; align-items: center; }
.nav-auth .btn-login {
  padding: 8px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  background: var(--primary); color: #fff; border: none; cursor: pointer;
  transition: all 0.15s;
}
.nav-auth .btn-login:hover { background: var(--primary-dark); transform: translateY(-1px); }
.nav-auth .user-chip {
  display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px;
  border-radius: 999px; background: var(--bg-alt); cursor: pointer;
  border: none; font-size: 14px; color: var(--text); transition: background 0.15s;
}
.nav-auth .user-chip:hover { background: #e2e8f0; }
.nav-auth .user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--gradient); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
}

/* Hero */
.hero {
  padding: 80px 0 60px;
  background: radial-gradient(ellipse at top, #eef2ff 0%, transparent 60%);
  text-align: center;
}
.hero-badge {
  display: inline-block; padding: 6px 16px; border-radius: 999px;
  background: #eef2ff; color: var(--primary-dark); font-size: 13px; font-weight: 600;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: 52px; font-weight: 800; line-height: 1.1;
  letter-spacing: -0.02em; margin-bottom: 20px;
}
.gradient-text {
  background: var(--gradient); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 18px; color: var(--text-light); max-width: 640px; margin: 0 auto 40px;
  line-height: 1.6;
}

/* URL Input */
.url-input-wrap { max-width: 680px; margin: 0 auto; }
.url-input-box {
  display: flex; align-items: center; gap: 0;
  background: #fff; border: 2px solid var(--border); border-radius: var(--radius);
  padding: 6px; box-shadow: var(--shadow-md); transition: border-color 0.15s;
}
.url-input-box:focus-within { border-color: var(--primary); }
.url-icon {
  width: 20px; height: 20px; color: var(--text-lighter); margin-left: 12px; flex-shrink: 0;
}
.url-input-box input {
  flex: 1; border: none; outline: none; padding: 12px 12px;
  font-size: 16px; background: none; color: var(--text);
}
.btn-parse {
  padding: 12px 28px; border: none; border-radius: var(--radius-sm);
  background: var(--gradient); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.btn-parse:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }
.btn-parse:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.btn-spinner {
  width: 16px; height: 16px; 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); } }
.hidden { display: none !important; }

.url-hint {
  margin-top: 12px; font-size: 13px; color: var(--text-lighter);
}

/* Error */
.error-box {
  max-width: 680px; margin: 16px auto 0; padding: 16px 20px;
  background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-sm);
  color: var(--error); font-size: 14px; text-align: left;
}
.error-box .err-action {
  margin-top: 10px; padding: 8px 16px; background: var(--error); color: #fff;
  border: none; border-radius: 6px; cursor: pointer; font-size: 13px;
}

/* Result */
.result-section { max-width: 760px; margin: 32px auto 0; }
.result-card {
  display: flex; gap: 20px; padding: 20px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.result-thumb-wrap { position: relative; flex-shrink: 0; }
.result-thumb {
  width: 240px; height: 135px; object-fit: cover; border-radius: var(--radius-sm);
  background: var(--bg-alt);
}
.result-duration {
  position: absolute; bottom: 6px; right: 6px; padding: 2px 8px;
  background: rgba(0,0,0,0.75); color: #fff; border-radius: 4px; font-size: 12px;
}
.result-info { flex: 1; min-width: 0; }
.result-info h3 { font-size: 17px; margin-bottom: 10px; line-height: 1.4; }
.result-meta {
  display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-light);
}
.result-meta span { display: inline-flex; align-items: center; gap: 4px; }

/* Formats */
.formats-wrap {
  margin-top: 16px; padding: 20px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.formats-wrap h4 { font-size: 15px; margin-bottom: 14px; }
.formats-list { display: flex; flex-direction: column; gap: 8px; }
.format-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  background: var(--bg-soft); border-radius: var(--radius-sm); transition: background 0.15s;
}
.format-row:hover { background: var(--bg-alt); }
.format-quality {
  padding: 3px 10px; border-radius: 5px; font-size: 12px; font-weight: 600;
  background: #eef2ff; color: var(--primary); min-width: 60px; text-align: center;
}
.format-quality.audio { background: #fef3c7; color: #92400e; }
.format-info-text { flex: 1; font-size: 13px; color: var(--text-light); }
.format-size { font-size: 12px; color: var(--text-lighter); }
.btn-download {
  padding: 7px 16px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500;
  background: var(--primary); color: #fff; cursor: pointer; transition: all 0.15s;
  text-decoration: none; display: inline-block;
}
.btn-download:hover { background: var(--primary-dark); }

/* Merge */
.merge-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.btn-merge {
  width: 100%; padding: 14px; border: none; border-radius: var(--radius-sm);
  background: var(--gradient); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn-merge:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }
.btn-merge:disabled { opacity: 0.7; cursor: wait; transform: none; }
.merge-hint { margin-top: 8px; font-size: 12px; color: var(--text-light); text-align: center; }

/* Sections */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-soft); }
.section-title {
  font-size: 36px; font-weight: 800; text-align: center; margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.section-subtitle {
  font-size: 17px; color: var(--text-light); text-align: center; margin-bottom: 48px;
}

/* Steps */
.steps-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 48px;
}
.step-card {
  padding: 32px 24px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); text-align: center; box-shadow: var(--shadow);
}
.step-num {
  width: 48px; height: 48px; margin: 0 auto 16px; border-radius: 50%;
  background: var(--gradient); color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.step-card h3 { font-size: 18px; margin-bottom: 8px; }
.step-card p { font-size: 14px; color: var(--text-light); }

/* Sites grid */
.sites-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px;
}
.site-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 24px 16px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); transition: all 0.15s;
}
.site-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.site-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff; font-weight: 700;
}
.site-name { font-size: 14px; font-weight: 600; }
.site-type { font-size: 11px; color: var(--text-lighter); }

/* FAQ */
.faq-list { max-width: 760px; margin: 0 auto; }
.faq-item {
  border-bottom: 1px solid var(--border); padding: 20px 0;
}
.faq-item summary {
  cursor: pointer; font-size: 16px; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::after { content: "+"; font-size: 22px; color: var(--text-light); transition: transform 0.15s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { margin-top: 12px; font-size: 14px; color: var(--text-light); line-height: 1.7; }

/* Footer */
.footer {
  padding: 48px 0 32px; background: var(--bg-soft); border-top: 1px solid var(--border);
}
.footer-content {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.footer-brand { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.footer-text { font-size: 14px; color: var(--text-light); }
.footer-copy {
  font-size: 13px; color: var(--text-lighter); padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg); position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  font-size: 24px; cursor: pointer; color: var(--text-light); line-height: 1;
}
.auth-tabs {
  display: flex; gap: 4px; margin-bottom: 24px; background: var(--bg-alt);
  border-radius: var(--radius-sm); padding: 4px;
}
.auth-tab {
  flex: 1; padding: 10px; border: none; background: none; border-radius: 6px;
  font-size: 14px; font-weight: 600; color: var(--text-light); cursor: pointer;
  transition: all 0.15s;
}
.auth-tab.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; outline: none; transition: border-color 0.15s;
}
.auth-form input:focus { border-color: var(--primary); }
.btn-auth {
  padding: 12px; border: none; border-radius: var(--radius-sm);
  background: var(--gradient); color: #fff; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn-auth:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }
.btn-auth:disabled { opacity: 0.7; cursor: wait; transform: none; }
.auth-error {
  padding: 12px 16px; background: #fef2f2; border: 1px solid #fecaca;
  border-radius: var(--radius-sm); color: var(--error); font-size: 13px; margin-bottom: 16px;
}
.auth-hint { margin-top: 16px; font-size: 12px; color: var(--text-lighter); text-align: center; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; background: var(--text); color: #fff; border-radius: var(--radius-sm);
  font-size: 14px; z-index: 300; opacity: 0; transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-8px); }

/* Responsive */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--border); padding: 20px; gap: 16px;
  }
  .nav-toggle { display: block; }
  .hero h1 { font-size: 36px; }
  .hero-subtitle { font-size: 16px; }
  .url-input-box { flex-direction: column; gap: 8px; }
  .url-input-box input { width: 100%; }
  .btn-parse { width: 100%; justify-content: center; }
  .steps-grid { grid-template-columns: 1fr; }
  .result-card { flex-direction: column; }
  .result-thumb { width: 100%; height: 200px; }
  .section-title { font-size: 28px; }
}
