/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD PROFESIONAL — Hormigón Premezclado Cotizador
   Rediseño: fondo técnico, header negro, chips, sidebar ticket, monospace
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  /* Paleta técnica */
  --bg: #ffffff;
  /* Blanco puro */
  --bg-panel: #ffffff;
  --surface: #ffffff;
  --line: #e2e6ea;
  --line-dark: #d0d5dd;
  --text: #1a1d23;
  --text-secondary: #4a5568;
  --muted: #718096;

  /* Marca / acento */
  --brand: #e83c3f;
  --brand-deep: #b91c1c;
  --brand-soft: #ffe4e4;

  /* Éxito / validación */
  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.08);
  --success-glow: rgba(22, 163, 74, 0.18);

  /* Header Dark Graphite */
  --header-bg: linear-gradient(180deg, #1a1a1a 0%, #0a0a0a 100%);
  --header-border: rgba(232, 60, 63, 0.4);

  /* Tarjetas resumen rosadas */
  --stat-bg: #fff5f5;
  --stat-border: #fcd6d6;

  /* Sidebar ticket verde */
  --ticket-border: #16a34a;
  --ticket-bg: #ffffff;

  /* Radios */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;

  /* Sombras */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.10);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.10);
}

/* ─── RESET BASE ────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
}

/* ─── PAGE SHELL ────────────────────────────────────────────────────────────── */
.page-shell {
  width: min(1600px, 98%);
  margin: 0 auto;
  padding: 0 0 32px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER — Dark Graphite Panel Tecnológico
   ═══════════════════════════════════════════════════════════════════════════ */
.hero {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  /* Glow limonales y rojizos en esquinas */
  background-image:
    radial-gradient(circle at top left, rgba(232, 60, 63, 0.08) 0%, transparent 400px),
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.08) 0%, transparent 400px);
  border-bottom: 1px solid var(--line);
  padding: 15px 20px;
  min-height: 100px;
  z-index: 10;
  width: 100%;
}

/* ESQUINA IZQUIERDA: Identidad */
.hero-copy {
  display: flex;
  align-items: center;
  gap: 20px;
  background: transparent;
  padding: 0;
  margin: 0;
  z-index: 2;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  height: 110px !important;
  max-height: none !important;
  width: auto;
  filter: none;
  /* Colores originales sobre fondo blanco */
  order: 1;
  flex-shrink: 0;
}

.eyebrow {
  display: block;
  font-size: 1.9rem;
  font-weight: 800;
  color: #1a1d23;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  order: 2;
  line-height: 1.1;
}

/* CENTRO: Mensaje */
.hero h1 {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Manrope', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #1a1d23;
  letter-spacing: 0.02em;
  margin: 0;
  white-space: nowrap;
}

/* Ocultar pipe vertical */
.hero h1::before {
  display: none;
}

/* ESQUINA DERECHA: Cálculos */
.hero-card {
  display: flex;
  align-items: center;
  padding: 0;
  background: transparent;
  border: none;
  z-index: 2;
}

.hero-card::before {
  display: none;
  /* Ocultamos Live Quote por diseño minimalista */
}

.hero-card .hero-card-label {
  display: none;
}

.hero-card .stat-grid {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
}

/* Cada stat = minimalista, texto rojo sobre fondo transparente */
.stat {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid rgba(232, 60, 63, 0.4);
  /* Bordes rojos muy finos */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  /* Alinear contenido a la derecha para ver los números claros */
  gap: 2px;
  min-width: 110px;
}

/* Tercera tarjeta (volumen) destacada */
.stat:nth-child(3) {
  background: rgba(232, 60, 63, 0.04);
}

.stat-value {
  font-family: 'Sora', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--brand);
  /* Rojo vibrante */
  white-space: nowrap;
}

/* Aún más visible para el dato principal de volumen */
.stat:nth-child(3) .stat-value {
  font-size: 1.6rem;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-top: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONTENT GRID — 70 / 30
   ═══════════════════════════════════════════════════════════════════════════ */
.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(260px, 3fr);
  gap: 16px;
  padding: 16px 20px;
}

/* ─── PANEL IZQUIERDO (Formulario) ─────────────────────────────────────────── */
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
  padding: 16px 20px;
  backdrop-filter: none;
}

.section-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 4px;
}

.section-heading h2 {
  font-family: 'Sora', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* ─── FORM GRID ──────────────────────────────────────────────────────────── */
.quote-form {
  margin-top: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

/* ─── SECCIONES AGRUPADAS (acordeón visual) ─────────────────────────────── */
.form-block {
  margin: 12px 0 8px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: #fafbfc;
  border: 1px solid var(--line);
  position: relative;
}

/* Título de sección + línea divisoria */
.block-title {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-dark);
}

.block-title h3 {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  margin: 0 0 2px;
}

.block-title p {
  font-size: 0.73rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.block-title em,
.field em {
  color: var(--brand);
  font-style: normal;
}

/* ─── CAMPO (label wrapper) ──────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 6px;
}

.field span {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: block;
}

.field small {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 2px;
}

.field-full {
  grid-column: 1 / -1;
}

/* ─── INPUTS ─────────────────────────────────────────────────────────────── */
input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease,
    background-color 0.25s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

textarea {
  resize: vertical;
  min-height: 80px;
  font-size: 0.82rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHIPS DE RADIO — Tipo de obra & Elemento a vaciar
   ═══════════════════════════════════════════════════════════════════════════ */
.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Cuadrícula simétrica para las 8 opciones de resistencia */
.strength-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.strength-grid .choice-card {
  justify-content: center;
  text-align: center;
}

/* Chip base */
.choice-card {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: #eef0f3;
  border: 1.5px solid transparent;
  min-height: 0;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
  user-select: none;
  position: relative;
}

/* Ocultar el radio nativo dentro del chip */
.choice-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  pointer-events: none;
}

/* Texto del chip */
.choice-card span {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4a5568;
  display: inline;
  transition: color 0.2s ease;
}

/* Chip SELECCIONADO → negro sólido */
.choice-card:has(input[type="radio"]:checked) {
  background: #1a1d23;
  border-color: #1a1d23;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.choice-card:has(input[type="radio"]:checked) span {
  color: #ffffff;
}

/* Hover en chip no seleccionado */
.choice-card:not(:has(input[type="radio"]:checked)):hover {
  background: #dde1e8;
  border-color: #c0c8d8;
}

/* Chip "Otro" con input texto */
.choice-card-other {
  flex-direction: column;
  align-items: flex-start;
  padding: 5px 12px;
  border-radius: var(--radius-lg);
  gap: 4px;
}

.choice-card-other span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.other-input {
  display: none;
  width: 100%;
  margin-top: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-dark);
  padding: 5px 8px;
  font-size: 0.78rem;
}

.choice-card-other input[type="radio"]:checked~.other-input,
.choice-card-other:has(input[type="radio"]:checked) .other-input {
  display: block;
  background: #f7f8fa;
}

/* ─── BOTONES DEL FORMULARIO ──────────────────────────────────────────────── */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.primary-button,
.ghost-button {
  border: 0;
  border-radius: var(--radius-md);
  padding: 9px 18px;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}

.primary-button {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  box-shadow: 0 4px 12px rgba(232, 60, 63, 0.28);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(232, 60, 63, 0.36);
}

.ghost-button {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--line-dark);
}

.ghost-button:hover {
  background: var(--bg);
  border-color: #aab4c4;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR — Panel de Resumen (Ticket Técnico)
   ═══════════════════════════════════════════════════════════════════════════ */
.summary-panel {
  background: var(--ticket-bg);
  border: 2px solid var(--ticket-border);
  border-radius: var(--radius-xl);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.06), var(--shadow-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: none;
  align-self: start;
  position: sticky;
  top: 16px;
}

.summary-panel .section-heading {
  border-bottom: 1px solid rgba(22, 163, 74, 0.25);
}

.summary-panel .section-kicker {
  color: var(--success);
}

.summary-panel .section-heading h2 {
  font-size: 0.85rem;
  color: var(--text);
}

/* Caja del ticket — estilo monospace/consola */
.summary-box {
  min-height: 220px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #f7fdf9;
  border: 1px solid rgba(22, 163, 74, 0.2);
  white-space: pre-line;
  font-family: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  font-size: 0.73rem;
  line-height: 1.65;
  color: #1a2e22;
}

.summary-box strong {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-weight: 600;
  color: #0f4d25;
}

.summary-placeholder {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.73rem;
  color: var(--muted);
  font-style: italic;
}

/* ─── BOTONES DEL SIDEBAR ─────────────────────────────────────────────────── */
.whatsapp-link {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--success);
  color: #ffffff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.32);
  white-space: nowrap;
}

.whatsapp-link:hover {
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(22, 163, 74, 0.42);
}

/* Botón copiar — outline verde, al lado del WhatsApp */
/* El botón #copySummary existe en .actions (formulario).
   En el sidebar usamos solo .whatsapp-link.
   Estilizamos también el ghost como outline verde cuando está en el sidebar */
.summary-panel .actions,
.summary-actions {
  display: flex;
  gap: 8px;
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

/* Helper note */
.helper-note {
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════════════
   VALIDACIÓN — Preservada intacta
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Estado ERROR ─────────────────────────────────────────────────────────── */
.field-error input,
.field-error select,
.field-error textarea {
  border-color: #e53e3e !important;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.15) !important;
  background-color: #fff5f5 !important;
}

.field-error-msg {
  display: none;
  font-size: 0.72rem;
  color: #e53e3e;
  margin-top: 2px;
  font-weight: 600;
  animation: valFadeIn 0.2s ease forwards;
}

.field-error .field-error-msg {
  display: block;
}

/* ── Estado ÉXITO ──────────────────────────────────────────────────────────── */
.field-success {
  position: relative;
}

.field-success input,
.field-success select,
.field-success textarea {
  border-color: #2d6a4f !important;
  border-width: 1.5px !important;
  background-color: rgba(45, 106, 79, 0.05) !important;
  box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.12) !important;
  padding-right: 34px;
}

.field-success::after {
  content: "✓";
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #2d6a4f;
  pointer-events: none;
  animation: valFadeIn 0.3s ease forwards;
}

.field-success:has(small)::after {
  bottom: 26px;
}

.field-success.field-label-check>span:first-child::after {
  content: " ✓";
  color: #2d6a4f;
  font-weight: 800;
  font-size: 0.9em;
  display: inline;
  animation: valFadeIn 0.3s ease forwards;
}

.field-success.field-label-check::after {
  display: none;
}

/* ── Botón BLOQUEADO ──────────────────────────────────────────────────────── */
.primary-button:disabled,
.ghost-button:disabled,
.whatsapp-link-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Animaciones ──────────────────────────────────────────────────────────── */
@keyframes valFadeIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fieldShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-5px);
  }

  40% {
    transform: translateX(5px);
  }

  60% {
    transform: translateX(-3px);
  }

  80% {
    transform: translateX(3px);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MEDIA QUERIES
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tablet / 1024px ─────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .summary-panel {
    position: static;
  }

  .hero-card .stat-grid {
    flex-wrap: wrap;
  }
}

/* ── Móvil / 768px ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  body {
    font-size: 13px;
  }

  .page-shell {
    width: 100%;
    padding: 0 0 24px;
  }

  .hero {
    flex-direction: column;
    padding: 10px;
    gap: 12px;
    min-height: auto;
  }

  .hero-copy {
    width: 100%;
    margin: 0;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .brand-logo {
    height: 52px !important;
    max-height: none !important;
    /* Reducido para encajar mejor en móvil */
    order: 1;
  }

  .eyebrow {
    font-size: 1.1rem;
    font-weight: 800;
    order: 2;
  }

  .hero h1 {
    position: relative;
    /* Elimina el overlap */
    left: auto;
    top: auto;
    transform: none;
    font-size: 0.9rem;
    /* Escala reducida para caber en una línea */
    white-space: normal;
    text-align: right;
    width: auto;
    margin: 0;
    margin-left: auto;
    /* Empuja a la derecha si hay espacio */
    padding-right: 4px;
    order: 3;
  }

  .hero-card {
    position: relative;
    /* Elimina el overlap */
    width: 100%;
    padding: 0;
  }

  .hero-card .stat-grid {
    width: 100%;
    overflow-x: auto;
    /* Scroll horizontal */
    padding-bottom: 4px;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .stat,
  .stat:nth-child(1),
  .stat:nth-child(2),
  .stat:nth-child(3) {
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 6px 12px;
    min-width: 100px;
    align-items: flex-end;
  }

  .stat-value {
    font-size: 1.15rem !important;
  }

  .stat:nth-child(3) .stat-value {
    font-size: 1.25rem !important;
  }

  .content-grid {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .form-panel,
  .summary-panel {
    padding: 12px 14px;
    border-radius: var(--radius-lg);
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .choice-grid {
    gap: 5px;
  }

  .strength-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .choice-card {
    padding: 5px 10px;
  }

  .choice-card span {
    font-size: 0.74rem;
  }

  input,
  select,
  textarea {
    padding: 8px 10px;
    font-size: 0.82rem;
    border-radius: var(--radius-md);
  }

  textarea {
    min-height: 70px;
  }

  .primary-button,
  .ghost-button,
  .whatsapp-link {
    width: 100%;
    text-align: center;
    justify-content: center;
    padding: 10px 14px;
    font-size: 0.82rem;
  }

  .actions {
    flex-direction: column;
    gap: 8px;
  }

  .summary-panel {
    position: static;
  }

  .summary-box {
    min-height: 140px;
    font-size: 0.7rem;
  }

  .form-block {
    margin: 8px 0;
    padding: 10px 12px;
  }
}

/* ── Utilidades ───────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}