/* Sistema visual WiWO - tema Tech Black.
   Paleta: Cobalt #060689, Electric #1E3CFF, Lime #B8FF00, Cream #F4EFE2,
   Ivory #FFFDF4, Tech Black #0B0D12, Lavender #E8E6FF, Cyan #00D8FF.
   Tipografia: Plus Jakarta Sans (titulares) + Outfit (microcopy). */

:root {
  color-scheme: dark;

  --cobalt: #060689;
  --electric: #1e3cff;
  --lime: #b8ff00;
  --cream: #f4efe2;
  --ivory: #fffdf4;
  --tech-black: #0b0d12;
  --lavender: #e8e6ff;
  --cyan: #00d8ff;

  --ink: #fffdf4;
  --muted: rgba(232, 230, 255, 0.62);
  --muted-soft: rgba(232, 230, 255, 0.42);

  --line: rgba(232, 230, 255, 0.12);
  --line-strong: rgba(232, 230, 255, 0.2);

  --glass: rgba(255, 255, 255, 0.035);
  --glass-strong: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(232, 230, 255, 0.1);

  --warning: #ffcf4a;
  --danger: #ff6b7d;

  --shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  --glow-blue: 0 18px 44px rgba(30, 60, 255, 0.32);
  --glow-lime: 0 0 0 1px rgba(184, 255, 0, 0.45), 0 16px 36px rgba(184, 255, 0, 0.16);

  --font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  background:
    radial-gradient(900px 540px at 10% -10%, rgba(30, 60, 255, 0.22), transparent 60%),
    radial-gradient(820px 520px at 102% -4%, rgba(0, 216, 255, 0.12), transparent 55%),
    radial-gradient(760px 640px at 50% 118%, rgba(184, 255, 0, 0.07), transparent 60%),
    var(--tech-black);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

/* ---------- Topbar / marca ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 8px max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(11, 13, 18, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 6px 16px rgba(30, 60, 255, 0.45));
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-word {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.05em;
  color: var(--ivory);
  line-height: 1;
}

.brand-tag {
  margin-left: 2px;
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Layout ---------- */

.workspace {
  display: grid;
  gap: 26px;
  width: min(1180px, calc(100% - 32px));
  margin: 26px auto 56px;
}

.welcome-card,
.converter,
.compact-grid,
.support-drawer {
  width: min(920px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.welcome-card,
.panel,
.support-drawer {
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--glass);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(125%);
}

.welcome-card {
  position: relative;
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 168px;
  align-items: center;
  gap: 22px;
  min-height: 132px;
  padding: 22px 28px;
  overflow: hidden;
}

/* palabra gigante tenue, estilo editorial WiWO */
.welcome-card::before {
  content: "wiwo";
  position: absolute;
  right: -8px;
  bottom: -34px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 9rem;
  letter-spacing: -0.06em;
  line-height: 1;
  color: rgba(232, 230, 255, 0.05);
  pointer-events: none;
}

.bot-visual {
  position: relative;
  z-index: 1;
  grid-column: 1;
  justify-self: center;
  width: 140px;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45));
}

.welcome-copy {
  position: relative;
  z-index: 1;
  grid-column: 2;
  text-align: center;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 0.95;
  color: var(--ivory);
}

h1 .hl {
  color: var(--lime);
}

.welcome-copy p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

/* ---------- Paneles ---------- */

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 32px 14px;
}

.panel-head.with-lines {
  justify-content: center;
  padding-bottom: 8px;
}

.panel-head.with-lines span {
  display: none;
}

h2 {
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--ivory);
}

h3 {
  color: var(--ivory);
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  border: 1px solid rgba(184, 255, 0, 0.32);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(184, 255, 0, 0.1);
  color: var(--lime);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.mode-pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 10px rgba(184, 255, 0, 0.8);
}

.mode-pill.is-server {
  border-color: rgba(0, 216, 255, 0.35);
  background: rgba(0, 216, 255, 0.1);
  color: var(--cyan);
}

.mode-pill.is-server::before {
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 216, 255, 0.8);
}

/* ---------- Drop zone ---------- */

.drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
  margin: 0 32px 18px;
  min-height: 68px;
  padding: 0 16px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: var(--glass-strong);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-zone:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.08);
}

.drop-zone.is-over {
  border-color: rgba(184, 255, 0, 0.6);
  background: rgba(184, 255, 0, 0.06);
  box-shadow: var(--glow-lime);
  transform: translateY(-1px);
}

.file-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--electric), var(--cobalt));
  color: var(--ivory);
  font-size: 1.5rem;
  font-weight: 500;
  box-shadow: 0 8px 18px rgba(30, 60, 255, 0.4);
}

.drop-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.drop-title,
.drop-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ivory);
}

.drop-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.send-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--lime);
}

.send-icon::before {
  content: ">";
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 1;
}

/* ---------- Resumen de archivo ---------- */

.file-summary {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr 0.85fr 0.85fr;
  gap: 10px;
  margin: 0 32px 18px;
}

.file-summary > div {
  min-width: 0;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 13px 14px;
  background: var(--glass-strong);
}

.summary-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.file-summary strong {
  display: block;
  overflow: hidden;
  color: var(--ivory);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
}

/* ---------- Secciones smart / presets ---------- */

.smart-section,
.preset-section {
  display: grid;
  gap: 12px;
  margin: 0 32px 20px;
}

.smart-section[hidden],
.preset-section[hidden] {
  display: none;
}

.smart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.smart-head h3 {
  font-size: 1rem;
  font-weight: 800;
}

.smart-head span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.recommendation-list,
.preset-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.recommendation-card,
.preset-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 132px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
  background: var(--glass-strong);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.recommendation-card:hover,
.preset-card:hover,
.recommendation-card.is-selected,
.preset-card.is-selected {
  border-color: rgba(184, 255, 0, 0.55);
  box-shadow: var(--glow-lime);
  transform: translateY(-2px);
}

.recommendation-card.is-selected,
.preset-card.is-selected {
  background: rgba(184, 255, 0, 0.07);
}

.recommendation-card strong,
.preset-card strong {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ivory);
}

.recommendation-card span,
.preset-card span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.recommendation-card em,
.preset-card em {
  align-self: end;
  justify-self: start;
  border: 1px solid rgba(232, 230, 255, 0.2);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(30, 60, 255, 0.18);
  color: var(--lavender);
  font-family: var(--font-body);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- Acciones / botones ---------- */

.action-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0 32px 16px;
}

.action-row .primary-button {
  min-width: 220px;
}

.primary-button,
.secondary-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 24px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass-strong);
  color: var(--ivory);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, filter 160ms ease;
}

.primary-button {
  border-color: transparent;
  background: linear-gradient(135deg, var(--electric), var(--cobalt));
  box-shadow: var(--glow-blue);
}

.primary-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: var(--glow-blue), 0 0 0 2px rgba(184, 255, 0, 0.5);
}

.secondary-button:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
}

.primary-button:disabled,
.download-button.is-disabled {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted-soft);
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  filter: none;
}

/* boton de descarga activo = CTA lime (exito) */
.download-button {
  min-width: 190px;
  border-color: transparent;
  background: var(--lime);
  color: var(--tech-black);
  box-shadow: 0 14px 30px rgba(184, 255, 0, 0.22);
}

.download-button:not(.is-disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 18px 38px rgba(184, 255, 0, 0.32);
}

/* ---------- Opciones avanzadas / cajones ---------- */

.advanced-options {
  margin: 0 32px 18px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.advanced-options summary,
.support-drawer summary {
  min-height: 46px;
  padding: 13px 18px;
  color: var(--ivory);
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.advanced-options summary::marker,
.support-drawer summary::marker {
  color: var(--lime);
}

.controls {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.field small {
  min-height: 18px;
  color: var(--muted-soft);
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.35;
}

select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 0 18px;
  background: rgba(11, 13, 18, 0.6);
  color: var(--ivory);
}

optgroup,
option {
  background: var(--tech-black);
  color: var(--ivory);
}

/* ---------- Estado ---------- */

.status {
  margin: 0 32px 28px;
  border: 1px solid rgba(184, 255, 0, 0.28);
  border-radius: 14px;
  padding: 13px 16px;
  background: rgba(184, 255, 0, 0.08);
  color: var(--lime);
  font-family: var(--font-body);
  font-weight: 600;
}

.status.is-warning {
  border-color: rgba(255, 207, 74, 0.4);
  background: rgba(255, 207, 74, 0.1);
  color: var(--warning);
}

.status.is-error {
  border-color: rgba(255, 107, 125, 0.4);
  background: rgba(255, 107, 125, 0.1);
  color: var(--danger);
}

/* ---------- Resultado / dashboard ---------- */

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 28px;
}

.compact-grid {
  display: block;
}

.output,
.how-card {
  min-height: 420px;
}

.compact-grid .output {
  min-height: 0;
}

.support-drawer .how-card {
  min-height: 0;
}

.support-drawer > .panel {
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 20px 20px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.support-drawer + .support-drawer {
  margin-top: -10px;
}

.preview {
  display: grid;
  place-items: stretch;
  min-height: 276px;
  padding: 20px 32px;
}

.empty-state,
.server-preview {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 236px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  text-align: center;
}

.empty-state span {
  display: block;
  margin-bottom: 8px;
  color: var(--lime);
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.preview img {
  max-width: 100%;
  max-height: 272px;
  object-fit: contain;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.25);
}

.preview pre {
  overflow: auto;
  min-height: 272px;
  max-height: 272px;
  margin: 0;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--lavender);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.panel-footer {
  display: flex;
  justify-content: center;
  padding: 0 32px 28px;
}

/* ---------- Tarjeta "como funciona" / motores ---------- */

.how-content {
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 22px 32px 28px;
  text-align: center;
}

.how-content p {
  margin: 0;
  max-width: 440px;
  color: var(--muted);
  line-height: 1.55;
}

.engine-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.engine-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--glass-strong);
  text-align: left;
}

.engine-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted-soft);
}

.engine-item.is-ready .engine-dot {
  background: var(--lime);
  box-shadow: 0 0 10px rgba(184, 255, 0, 0.8);
}

.engine-item.is-missing .engine-dot {
  background: var(--muted-soft);
}

.engine-item strong,
.engine-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.engine-item strong {
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ivory);
}

.engine-item small {
  color: var(--muted);
  font-size: 0.72rem;
}

/* ---------- Preview servidor ---------- */

.server-preview {
  place-items: stretch;
  align-content: start;
  padding: 24px;
  text-align: left;
}

.server-tag {
  justify-self: start;
  border: 1px solid rgba(0, 216, 255, 0.35);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(0, 216, 255, 0.1);
  color: var(--cyan);
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.server-preview h3 {
  margin-top: 18px;
  font-size: 1.35rem;
  font-weight: 800;
}

.server-preview p {
  margin: 9px 0 20px;
  color: var(--muted);
  line-height: 1.55;
}

.server-preview dl {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
}

.server-preview dt {
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 800;
}

.server-preview dd {
  margin: 0;
  color: var(--ivory);
}

/* ---------- Lista de formatos ---------- */

.format-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.format-card {
  min-height: 154px;
  padding: 22px 26px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.format-card:nth-child(3n) {
  border-right: 0;
}

.format-card h3 {
  margin-bottom: 10px;
  font-size: 1.02rem;
  font-weight: 800;
}

.format-card p {
  margin: 0;
  min-height: 48px;
  color: var(--muted);
  line-height: 1.45;
}

.format-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.format-modes span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 12px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: rgba(30, 60, 255, 0.14);
  color: var(--lavender);
  font-family: var(--font-body);
  font-size: 0.74rem;
  font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 1040px) {
  .welcome-card {
    grid-template-columns: 140px minmax(0, 1fr) 140px;
  }

  .dashboard-grid,
  .format-list {
    grid-template-columns: 1fr;
  }

  .recommendation-list,
  .preset-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .format-card,
  .format-card:nth-child(3n) {
    border-right: 0;
  }
}

@media (max-width: 720px) {
  .topbar {
    min-height: 54px;
  }

  .brand-tag {
    display: none;
  }

  .welcome-card {
    grid-template-columns: 1fr;
    padding: 20px 18px;
  }

  .welcome-card::before {
    font-size: 6rem;
    bottom: -22px;
  }

  .bot-visual {
    width: 128px;
  }

  .welcome-copy {
    grid-column: 1;
    text-align: center;
  }

  .panel-head,
  .controls,
  .action-row,
  .preview,
  .panel-footer,
  .how-content {
    padding-right: 20px;
    padding-left: 20px;
  }

  .drop-zone,
  .file-summary,
  .smart-section,
  .preset-section,
  .advanced-options,
  .status {
    margin-right: 20px;
    margin-left: 20px;
  }

  .recommendation-list,
  .preset-list {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .drop-title,
  .drop-meta {
    white-space: normal;
  }

  .send-icon {
    display: none;
  }

  .file-summary,
  .controls {
    grid-template-columns: 1fr;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .engine-list {
    grid-template-columns: 1fr;
  }
}
