/* ═══════════════════════════════════════════════
   Detector de Texto IA — style.css
   ═══════════════════════════════════════════════ */

:root {
  --bg:       #f7f4ef;
  --ink:      #1a1714;
  --muted:    #6b6560;
  --border:   #d4cfc8;
  --accent:   #c0392b;
  --accent2:  #e67e22;
  --green:    #27ae60;
  --surface:  #ffffff;
  --surface2: #ede9e2;
  --mono:     'IBM Plex Mono', monospace;
  --serif:    'Instrument Serif', serif;
  --sans:     'Inter', sans-serif;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(192,57,43,.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(230,126,34,.04) 0%, transparent 50%);
}

/* ════════════════════════════════
   HEADER
   ════════════════════════════════ */
header {
  padding: 1.4rem 2.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
  background: var(--surface);
}

.header-title {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-style: italic;
  color: var(--ink);
  line-height: 1;
}

.header-sub {
  font-family: var(--mono);
  font-size: .58rem;
  color: var(--muted);
  letter-spacing: .14em;
  text-transform: uppercase;
  margin-bottom: .2rem;
}

.header-badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .58rem;
  border: 1px solid var(--border);
  padding: .28rem .65rem;
  border-radius: 2px;
  color: var(--muted);
  letter-spacing: .08em;
}

/* ════════════════════════════════
   API KEY BAR
   ════════════════════════════════ */
.apikey-bar {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: .6rem 2.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.apikey-label {
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.apikey-input {
  flex: 1;
  min-width: 240px;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .38rem .7rem;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--ink);
  outline: none;
  transition: border-color .2s;
  letter-spacing: .03em;
}
.apikey-input:focus          { border-color: var(--accent2); }
.apikey-input.valid          { border-color: var(--green); }
.apikey-input::placeholder   { color: var(--muted); opacity: .5; }

.apikey-badge {
  font-family: var(--mono);
  font-size: .6rem;
  padding: .22rem .55rem;
  border-radius: 2px;
  white-space: nowrap;
}
.apikey-badge.ok   { background: rgba(39,174,96,.1);   color: var(--green);  border: 1px solid rgba(39,174,96,.3); }
.apikey-badge.err  { background: rgba(192,57,43,.1);   color: var(--accent); border: 1px solid rgba(192,57,43,.3); }
.apikey-badge.idle { background: var(--surface);       color: var(--muted);  border: 1px solid var(--border); }

.apikey-hint {
  font-size: .67rem;
  color: var(--muted);
}
.apikey-hint a { color: var(--accent2); text-decoration: none; }
.apikey-hint a:hover { text-decoration: underline; }

/* ════════════════════════════════
   LAYOUT
   ════════════════════════════════ */
main {
  display: grid;
  grid-template-columns: 1fr 420px;
  min-height: calc(100vh - 115px);
}

/* ════════════════════════════════
   INPUT SIDE
   ════════════════════════════════ */
.input-side {
  padding: 1.75rem 2.5rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.field-label {
  font-family: var(--mono);
  font-size: .58rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .4rem;
}

textarea {
  width: 100%;
  flex: 1;
  min-height: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .9rem 1rem;
  font-family: var(--sans);
  font-size: .88rem;
  line-height: 1.7;
  color: var(--ink);
  resize: vertical;
  outline: none;
  transition: border-color .2s;
}
textarea:focus       { border-color: var(--accent2); }
textarea::placeholder{ color: var(--muted); opacity: .55; }

/* ── Controls ── */
.controls {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.word-count {
  font-family: var(--mono);
  font-size: .63rem;
  color: var(--muted);
}
.word-count span { color: var(--ink); font-weight: 600; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .58rem 1.2rem;
  border: none;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .18s;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover:not(:disabled) { background: #2d2926; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .32; cursor: not-allowed; transform: none; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

/* ── Examples ── */
.examples { display: flex; flex-wrap: wrap; gap: .45rem; }

.example-chip {
  font-family: var(--mono);
  font-size: .58rem;
  padding: .24rem .58rem;
  border: 1px dashed var(--border);
  border-radius: 2px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.example-chip:hover { border-color: var(--accent2); color: var(--accent2); border-style: solid; }

/* ── Disclaimer ── */
.disclaimer {
  font-family: var(--mono);
  font-size: .58rem;
  color: var(--muted);
  line-height: 1.6;
  padding: .65rem .85rem;
  border: 1px dashed var(--border);
  border-radius: 3px;
  opacity: .72;
}

/* ════════════════════════════════
   RESULT SIDE
   ════════════════════════════════ */
.result-side {
  padding: 1.75rem 1.75rem;
  background: var(--surface2);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
}

/* ── Empty state ── */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  text-align: center;
  color: var(--muted);
}
.empty-icon  { font-size: 2.5rem; opacity: .18; }
.empty-title { font-family: var(--serif); font-size: 1.15rem; font-style: italic; opacity: .38; }
.empty-sub   { font-size: .73rem; opacity: .32; max-width: 210px; line-height: 1.6; }

/* ── Loading ── */
.loading-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2.5rem;
  text-align: center;
}

.loading-dots { display: flex; gap: .4rem; }

.loading-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink);
  animation: dotPulse 1.4s ease infinite;
}
.loading-dot:nth-child(2) { animation-delay: .22s; }
.loading-dot:nth-child(3) { animation-delay: .44s; }

@keyframes dotPulse {
  0%,80%,100% { transform: scale(.55); opacity: .25; }
  40%          { transform: scale(1);   opacity: 1;   }
}

.loading-text {
  font-family: var(--mono);
  font-size: .65rem;
  color: var(--muted);
  letter-spacing: .08em;
}

/* ── Gauge ── */
.gauge-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.4rem;
  display: none;
}

.gauge-label {
  font-family: var(--mono);
  font-size: .54rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .9rem;
}

.gauge-score {
  font-family: var(--serif);
  font-size: 3.8rem;
  font-style: italic;
  line-height: 1;
  margin-bottom: .35rem;
  transition: color .5s;
}

.gauge-verdict {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  transition: color .5s;
}

.gauge-bar-track {
  width: 100%; height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: .38rem;
}

.gauge-bar-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 1.1s cubic-bezier(.4,0,.2,1), background .5s;
}

.gauge-scale {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: .5rem;
  color: var(--muted);
}

/* ── Indicators ── */
.indicators { display: none; flex-direction: column; gap: .45rem; }

.ind-label {
  font-family: var(--mono);
  font-size: .54rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .15rem;
}

.indicator {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: .65rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .28rem;
}

.ind-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}

.ind-name {
  font-family: var(--mono);
  font-size: .62rem;
  font-weight: 600;
  color: var(--ink);
}

.ind-badge {
  font-family: var(--mono);
  font-size: .57rem;
  font-weight: 600;
  padding: .1rem .38rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.ind-desc {
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.5;
}

.ind-mini-bar {
  width: 100%; height: 2px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-top: .1rem;
}

.ind-mini-fill {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width .9s ease;
}

/* ── Analysis box ── */
.analysis-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .95rem 1rem;
  display: none;
}

.analysis-text {
  font-size: .78rem;
  line-height: 1.72;
  color: var(--ink);
}

/* ── Spinner ── */
.spin {
  display: inline-block;
  width: 11px; height: 11px;
  border: 2px solid rgba(255,255,255,.22);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinA .55s linear infinite;
  flex-shrink: 0;
}
@keyframes spinA { to { transform: rotate(360deg); } }

/* ════════════════════════════════
   RESPONSIVE
   ════════════════════════════════ */
@media (max-width: 820px) {
  main { grid-template-columns: 1fr; }
  .result-side { border-top: 1px solid var(--border); min-height: 400px; }
  header, .apikey-bar, .input-side { padding-left: 1.25rem; padding-right: 1.25rem; }
  .result-side { padding: 1.5rem 1.25rem; }
  .apikey-input { max-width: 100%; }
}
