/* ── SHARED DESIGN SYSTEM — seo.pici.id ── */
/* Based on ContentGuard's design. All tools import this. */

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

:root {
  --bg: #FBFBFA;
  --surface: #FFFFFF;
  --border: rgba(0,0,0,0.08);
  --border-solid: #EAEAEA;
  --text: #111111;
  --text-2: #2F3437;
  --muted: #787774;
  --accent-bg: #F7F6F3;
  --mono: 'Geist Mono', 'SF Mono', monospace;
  --sans: 'Helvetica Neue', system-ui, sans-serif;
  --serif: 'Newsreader', Georgia, serif;

  --red-bg: #FDEBEC;    --red-text: #9F2F2D;
  --yellow-bg: #FBF3DB; --yellow-text: #956400;
  --blue-bg: #E1F3FE;   --blue-text: #1F6C9F;
  --green-bg: #EDF3EC;  --green-text: #346538;
}

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── HEADER ── */
header {
  border-bottom: 1px solid var(--border-solid);
  padding: 0 28px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text);
  display: inline-block;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 9999px;
  background: var(--accent-bg);
  color: var(--muted);
  border: 1px solid var(--border-solid);
}

/* ── PROVIDER / MODEL SELECTS ── */
.provider-selects {
  display: flex;
  align-items: center;
  gap: 6px;
}

.provider-selects select {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-solid);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  outline: none;
  appearance: auto;
  max-width: 160px;
}
.provider-selects select:focus { border-color: #999; }

.provider-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── MAIN LAYOUT ── */
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
}

/* ── PANELS ── */
.panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-solid);
  overflow: hidden;
  height: calc(100dvh - 54px);
}

.panel:last-child { border-right: none; }

/* ── TABS ── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-solid);
  background: var(--surface);
  flex-shrink: 0;
}

.tab {
  padding: 12px 20px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  letter-spacing: 0.01em;
  user-select: none;
  transition: color 150ms;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }

.tab-pane { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.tab-pane.active { display: flex; }

/* ── PANEL BODY ── */
.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.panel-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 1.5px dashed var(--border-solid);
  border-radius: 10px;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 200ms, background 200ms;
  flex-shrink: 0;
}
.upload-zone:hover, .upload-zone.drag {
  border-color: #aaa;
  background: #f5f5f4;
}

.upload-icon { margin: 0 auto 10px; opacity: 0.3; }

.upload-label {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.6;
}
.upload-label strong {
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--border-solid);
}
.upload-label .ext {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

input[type="file"] { display: none; }

/* ── FILE CHIP ── */
.file-chip {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: var(--green-bg);
  color: var(--green-text);
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  width: fit-content;
}

/* ── CONTENT PREVIEW ── */
.content-preview {
  display: none;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  background: var(--accent-bg);
  border-radius: 8px;
  padding: 14px 16px;
  max-height: 180px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  flex-shrink: 0;
}

/* ── DIVIDER ── */
.or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.or-divider::before, .or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-solid);
}

/* ── PASTE AREA ── */
.paste-area {
  width: 100%;
  min-height: 120px;
  border: 1px solid var(--border-solid);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--text);
  resize: vertical;
  outline: none;
  background: var(--surface);
  transition: border-color 150ms;
}
.paste-area:focus { border-color: #999; }

/* ── URL INPUT ── */
.url-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-solid);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  outline: none;
  background: var(--surface);
  transition: border-color 150ms;
}
.url-input:focus { border-color: #999; }

/* ── RUN BUTTON ── */
.run-btn {
  width: 100%;
  padding: 12px 0;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 150ms, transform 80ms;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.run-btn:hover:not(:disabled) { background: #2a2a2a; }
.run-btn:active:not(:disabled) { transform: scale(0.99); }
.run-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── RESULTS ── */
.results-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
  padding: 40px 20px;
}
.results-empty p {
  font-size: 12.5px;
  line-height: 1.6;
  max-width: 230px;
}

.loading-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
}

.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border-solid);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-label {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

/* ── SCORE ── */
.score-block {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-solid);
  margin-bottom: 18px;
}

.score-num {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.score-meta { flex: 1; }
.score-meta-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.score-bar-wrap {
  height: 3px;
  background: var(--border-solid);
  border-radius: 2px;
  overflow: hidden;
}
.score-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--text);
  transition: width 700ms cubic-bezier(0.16,1,0.3,1);
}

/* ── SUMMARY ── */
.summary-box {
  background: var(--accent-bg);
  border-radius: 8px;
  padding: 15px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
}

/* ── ISSUE SECTION ── */
.issue-section { margin-bottom: 20px; }

.issue-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-solid);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── VIEW TOGGLE ── */
.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-solid);
  border-radius: 6px;
  overflow: hidden;
  margin-left: auto;
}
.view-toggle-btn {
  background: none;
  border: none;
  padding: 3px 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.view-toggle-btn:hover { background: var(--border-solid); }
.view-toggle-btn.active {
  background: var(--text);
  color: var(--surface);
}

/* ── AUDIT CHECKLIST (compact view) ── */
.audit-checklist { margin-bottom: 4px; }

.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.5;
}
.audit-item:last-child { border-bottom: none; }

.audit-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  margin-top: 1px;
}
.audit-pass .audit-icon { background: var(--green-bg); color: var(--green-text); }
.audit-fail .audit-icon { background: var(--red-bg); color: var(--red-text); }
.audit-partial .audit-icon { background: var(--yellow-bg); color: var(--yellow-text); }

.audit-name { font-weight: 600; color: var(--text); }
.audit-note { color: var(--muted); font-size: 11px; margin-top: 2px; }

.audit-pass .audit-name { color: var(--green-text); }
.audit-fail .audit-name { color: var(--red-text); }
.audit-partial .audit-name { color: var(--yellow-text); }

/* ── ISSUE CARD ── */
.issue-card {
  border: 1px solid var(--border-solid);
  border-radius: 8px;
  padding: 13px 15px;
  margin-bottom: 7px;
  background: var(--surface);
}

.issue-desc {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-2);
  margin-bottom: 7px;
}

.issue-location {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.issue-ref {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--accent-bg);
  border-radius: 4px;
  padding: 2px 7px;
  display: inline-block;
  color: var(--muted);
  word-break: break-word;
}

/* ── ERROR BOX ── */
.error-box {
  border: 1px solid var(--red-bg);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--red-bg);
  color: var(--red-text);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ── AUDIT CHECKLIST ── */
.audit-checklist { margin-bottom: 18px; }

.audit-checklist-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-solid);
}

.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.5;
}
.audit-item:last-child { border-bottom: none; }

.audit-icon {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  margin-top: 1px;
}

.audit-pass .audit-icon { background: var(--green-bg); color: var(--green-text); }
.audit-fail .audit-icon { background: var(--red-bg); color: var(--red-text); }
.audit-partial .audit-icon { background: var(--yellow-bg); color: var(--yellow-text); }

.audit-name { font-weight: 600; color: var(--text); }
.audit-note { color: var(--muted); font-size: 11px; margin-top: 2px; }

.audit-pass .audit-name { color: var(--green-text); }
.audit-fail .audit-name { color: var(--red-text); }
.audit-partial .audit-name { color: var(--yellow-text); }

/* ── ISSUE PILLS ── */
.issue-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.pill-critical { background: var(--red-bg); color: var(--red-text); box-shadow: 0 0 0 1px rgba(159,47,45,0.15); }
.pill-improve { background: var(--yellow-bg); color: var(--yellow-text); }
.pill-suggestion { background: var(--blue-bg); color: var(--blue-text); }
.pill-positive { background: var(--green-bg); color: var(--green-text); }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-solid); border-radius: 2px; }

/* ── DOWNLOAD DROPDOWN ── */
.dl-dropdown { position: relative; }
.dl-dropbtn {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border: 1px solid var(--border-solid);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 120ms, border-color 120ms;
  white-space: nowrap;
}
.dl-dropbtn:hover { background: var(--accent-bg); border-color: #ccc; }
.dl-dropmenu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border-solid);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  min-width: 180px;
  z-index: 20;
  padding: 4px 0;
}
.dl-dropmenu.open { display: block; }
.dl-dropitem {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 7px 14px;
  cursor: pointer;
  color: var(--text-2);
  transition: background 100ms;
}
.dl-dropitem:hover { background: var(--accent-bg); }
.dl-dropsep { height: 1px; background: var(--border-solid); margin: 4px 0; }

/* ── GUIDELINE TEXTAREA ── */
.guideline-editor {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.guideline-editor textarea {
  width: 100%;
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-2);
  background: var(--surface);
  padding: 20px;
}

/* ── QUOTA DISPLAY ── */
.quota-display {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.quota-display strong { color: var(--text-2); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .workspace { grid-template-columns: 1fr; }
  .panel { height: auto; border-right: none; border-bottom: 1px solid var(--border-solid); }
  .panel:last-child { border-bottom: none; }
  header { padding: 0 16px; }
  .provider-selects { flex-wrap: wrap; }
}
