:root {
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --bg-sunken: #f7f9fc;
  --border: #e1e7ef;
  --border-strong: #c6d0dd;
  --text: #1b2733;
  --text-muted: #67758a;
  --accent: #1f7ac4;
  --accent-strong: #19659f;
  --accent-soft: #eaf4fd;
  --danger: #c23b38;
  --danger-bg: #fdf1f0;
  --danger-border: #f2cdcb;
  --ok: #1f7f5c;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(27, 39, 51, 0.05), 0 6px 20px rgba(27, 39, 51, 0.06);
}

* { box-sizing: border-box; }

/* .result y .file-chip usan display:flex, que gana al [hidden] del navegador:
   sin esto la tarjeta "KMZ listo" se vería antes de convertir nada. */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #e9f1f8 0%, var(--bg) 320px);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

.site-header {
  text-align: center;
  padding: 3rem 1.25rem 1.5rem;
}

.site-header h1 {
  margin: 0;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.5rem 0 0;
  color: var(--text-muted);
}

main {
  flex: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

form { display: flex; flex-direction: column; gap: 1.25rem; }

/* --- dropzone --- */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-sunken);
  padding: 2.25rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.dropzone-icon {
  width: 34px;
  height: 34px;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.dropzone-text { margin: 0; }
.dropzone-text .link { color: var(--accent); text-decoration: underline; }

.dropzone-hint {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- fichero elegido --- */
.file-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--text-muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.file-clear {
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}

.file-clear:hover { color: var(--danger); }

/* --- botones --- */
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  background: var(--accent);
  color: #ffffff;
  border: 0;
  border-radius: 8px;
  padding: 0.8rem 1.1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.primary:hover:not(:disabled) { background: var(--accent-strong); }

.primary:disabled {
  background: #e3e8ef;
  color: #9aa6b5;
  cursor: not-allowed;
}

.ghost {
  background: none;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text-muted);
  padding: 0.35rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.ghost:hover { color: var(--accent); border-color: var(--accent); }

/* --- spinner --- */
.spinner {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.is-busy .spinner { display: inline-block; }

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

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

/* --- avisos y resultado --- */
.alert {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
}

.alert.error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #8c2724;
}

.result {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.result-head { display: flex; align-items: center; justify-content: space-between; }

.result-badge {
  color: var(--ok);
  font-weight: 650;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.result-file { margin: 0; word-break: break-all; }
.result-size { color: var(--text-muted); font-size: 0.85rem; }

.download { align-self: flex-start; }

/* --- placeholder fase 2 --- */
.placeholder {
  border-style: dashed;
  box-shadow: none;
  background: transparent;
  color: var(--text-muted);
}

.placeholder h2 { margin: 0 0 0.5rem; font-size: 1.05rem; color: var(--text); }
.placeholder p { margin: 0; font-size: 0.92rem; }

.placeholder code {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}

/* --- footer --- */
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.health.is-degraded { color: var(--danger); }
