/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #F7F4EF;
  --surface:   #FFFFFF;
  --surface2:  #F0EDE7;
  --border:    #E2DDD6;
  --text:      #1C1917;
  --muted:     #78716C;
  --light:     #A8A29E;
  --accent:    #C4622D;
  --accent-bg: #FBF0EA;
  --green:     #2D7D52;
  --green-bg:  #EBF7F1;
  --yellow:    #B45309;
  --yellow-bg: #FFFBEB;
  --red:       #B91C1C;
  --red-bg:    #FEF2F2;
  --radius:    12px;
  --shadow:    0 1px 3px rgba(28,25,23,0.08), 0 4px 16px rgba(28,25,23,0.04);
  --shadow-lg: 0 2px 8px rgba(28,25,23,0.1), 0 12px 40px rgba(28,25,23,0.08);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 32px; height: 32px; background: var(--accent);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: white; font-family: Georgia, serif; font-style: italic;
  font-weight: 700; font-size: 17px;
}
.logo-text { font-size: 18px; font-weight: 600; letter-spacing: -0.4px; color: var(--text); }
.logo-text strong { color: var(--accent); }
.header-badge {
  font-size: 11px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--border); border-radius: 20px;
  padding: 5px 14px; background: var(--bg);
}

/* ── Hero ────────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 64px 20px 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: clamp(30px, 5vw, 50px);
  font-weight: 700;
  letter-spacing: -1.5px;
  line-height: 1.1;
  margin-bottom: 16px;
  color: var(--text);
}
.accent { color: var(--accent); }
.hero-sub {
  color: var(--muted); font-size: 17px;
  max-width: 480px; margin: 0 auto;
}

/* ── Main ────────────────────────────────────────────────────── */
main {
  max-width: 820px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h3 {
  font-size: 13px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 18px;
}

/* ── Tabs ────────────────────────────────────────────────────── */
.input-card { padding: 0; overflow: hidden; }
.tabs {
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tab {
  flex: 1; padding: 15px;
  background: none; border: none;
  color: var(--muted); font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all 0.15s; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); background: rgba(196,98,45,0.04); }
.tab.active {
  color: var(--accent); border-bottom-color: var(--accent);
  background: var(--surface); font-weight: 600;
}

.tab-content { display: none; padding: 28px; }
.tab-content.active { display: block; }

/* ── Form fields ─────────────────────────────────────────────── */
.field-label {
  display: block; font-size: 11px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.url-input-row { display: flex; gap: 10px; }

input[type="url"], input[type="text"] {
  width: 100%; padding: 11px 14px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: 'DM Mono', monospace; font-size: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="url"] { flex: 1; }
input[type="text"] { font-family: 'DM Sans', sans-serif; font-size: 14px; }
input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196,98,45,0.1);
}

textarea {
  width: 100%; min-height: 130px; padding: 12px 14px; resize: vertical;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: 14px;
  transition: border-color 0.15s;
}
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196,98,45,0.1); }
.field-hint { font-size: 12px; color: var(--light); margin-top: 8px; }

/* ── Drop zone ───────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border); border-radius: 8px;
  padding: 24px; text-align: center; cursor: pointer;
  transition: all 0.15s; color: var(--muted); font-size: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--bg);
}
.drop-zone:hover { border-color: var(--accent); background: var(--accent-bg); }
.drop-zone.drag-over { border-color: var(--accent); background: var(--accent-bg); }
.drop-icon { font-size: 26px; }
.drop-zone strong { color: var(--accent); }
#imagePreview img { max-width: 180px; max-height: 110px; border-radius: 6px; margin-top: 10px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-analyze {
  padding: 11px 24px;
  background: var(--accent); border: none; border-radius: 8px;
  color: white; font-family: 'DM Sans', sans-serif;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, transform 0.1s; white-space: nowrap;
}
.btn-analyze:hover { background: #A8521F; transform: translateY(-1px); }
.btn-analyze:active { transform: translateY(0); }
.btn-analyze:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-reset {
  padding: 11px 28px; background: transparent;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--muted); font-family: 'DM Sans', sans-serif;
  font-size: 14px; cursor: pointer; transition: all 0.15s;
}
.btn-reset:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

/* ── Loading ─────────────────────────────────────────────────── */
.loading { text-align: center; padding: 56px 20px; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
  margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-steps p { color: var(--muted); font-size: 14px; }
@keyframes pulse { 0%,100%{opacity:.5} 50%{opacity:1} }

/* ── Error ───────────────────────────────────────────────────── */
.error-box {
  background: var(--red-bg); border: 1px solid #FCA5A5;
  border-radius: var(--radius); padding: 14px 18px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px; font-size: 14px; color: var(--red);
}

/* ── Page info bar ───────────────────────────────────────────── */
.page-info-bar {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 20px;
  margin-bottom: 14px; display: flex; flex-wrap: wrap;
  gap: 12px; align-items: center; font-size: 13px;
  box-shadow: var(--shadow);
}
.page-info-bar .pi-title { font-weight: 600; color: var(--text); flex: 1; min-width: 200px; }
.page-info-bar .pi-meta { color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.pi-tag {
  background: var(--accent); color: white;
  border-radius: 5px; padding: 2px 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
}

/* ── Scores grid ─────────────────────────────────────────────── */
.scores-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px; margin-bottom: 14px;
}
.score-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 20px;
  text-align: center; box-shadow: var(--shadow);
}
.score-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 20px;
}

/* ── Gauge ───────────────────────────────────────────────────── */
.gauge-wrap { position: relative; width: 110px; height: 110px; margin: 0 auto 14px; }
.gauge { width: 100%; height: 100%; transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: var(--border); stroke-width: 9; }
.gauge-fill { fill: none; stroke-width: 9; stroke-linecap: round;
  transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1); }
.ai-fill      { stroke: var(--red); }
.quality-fill { stroke: var(--green); }
.image-fill   { stroke: var(--yellow); }
.gauge-value {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; font-family: 'DM Mono', monospace;
  color: var(--text);
}
.score-desc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Breakdown bars ──────────────────────────────────────────── */
.breakdown-bars { display: flex; flex-direction: column; gap: 13px; }
.breakdown-row { display: flex; align-items: center; gap: 12px; }
.breakdown-name { font-size: 13px; width: 185px; flex-shrink: 0; color: var(--muted); }
.breakdown-bar-bg {
  flex: 1; height: 7px; background: var(--surface2);
  border-radius: 4px; overflow: hidden; border: 1px solid var(--border);
}
.breakdown-bar-fill { height: 100%; border-radius: 4px; transition: width 1.2s cubic-bezier(.4,0,.2,1); }
.breakdown-score { font-size: 13px; font-family: 'DM Mono', monospace; font-weight: 600; width: 32px; text-align: right; }

/* ── Signals ─────────────────────────────────────────────────── */
.signals-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.signals-card ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.signals-card li {
  padding: 10px 14px;
  background: var(--bg); border-radius: 8px;
  border-left: 3px solid var(--accent);
  font-size: 13px; line-height: 1.5; color: var(--text);
}

/* ── Recommendations ─────────────────────────────────────────── */
.recs-card ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.recs-card li {
  padding: 12px 14px 12px 42px; position: relative;
  background: var(--green-bg); border-radius: 8px;
  border-left: 3px solid var(--green);
  font-size: 13px; line-height: 1.5;
}
.recs-card li::before { content: '→'; position: absolute; left: 15px; color: var(--green); font-weight: 700; }

/* ── Summary ─────────────────────────────────────────────────── */
.summary-card p { font-size: 15px; line-height: 1.75; color: var(--text); }

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  text-align: center; padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--light); font-size: 12px;
  background: var(--surface);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 14px 20px; }
  .header-badge { display: none; }
  .hero { padding: 40px 20px 30px; }
  main { padding: 24px 14px 60px; }
  .url-input-row { flex-direction: column; }
  .breakdown-name { width: 120px; font-size: 12px; }
}
