/*
 * calculator.css
 *
 * Estilos del front-end para la Calculadora de Tarifas Telecom.
 *
 * Los colores y tipografía los controla PHP a través de Custom Properties CSS
 * (variables --tc-*) inyectadas por el componente React desde el objeto
 * de apariencia almacenado en wp_options.
 *
 * Sistema de layout: CSS Grid + Flexbox. Sin dependencias externas.
 */

/* ── Reset de ámbito ───────────────────────────────────────────────────────── */
.telecom-calc-wrapper *,
.telecom-calc-wrapper *::before,
.telecom-calc-wrapper *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.telecom-calc-wrapper {
  font-family: var(--tc-font, inherit);
  color: var(--tc-text, #1a1a2e);
}

/* ── Layout principal: 2 columnas en desktop, 1 en móvil ───────────────────── */
.tc-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  align-items: start;
  padding: 24px 0;
}

@media (max-width: 900px) {
  .tc-layout {
    grid-template-columns: 1fr;
  }
}

/* ── Configurador (columna izquierda) ──────────────────────────────────────── */
.tc-configurator {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── Sección ───────────────────────────────────────────────────────────────── */
.tc-section {
  background: var(--tc-card-bg, #fff);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--tc-radius, 12px);
  padding: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease;
}

.tc-section:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.tc-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.tc-section-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.tc-custom-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.tc-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tc-text, #1a1a2e);
}

/* ── Grid de tarjetas de opción ────────────────────────────────────────────── */
.tc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.tc-cards-grid--small {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

/* ── Tarjeta de opción seleccionable ───────────────────────────────────────── */
.tc-option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--tc-radius, 12px);
  background: #fafafa;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.18s, background 0.18s, transform 0.1s;
  user-select: none;
}

.tc-option-card:hover {
  border-color: var(--tc-primary, #6c3bff);
  background: #f0eaff;
  transform: translateY(-2px);
}

.tc-option-card:focus-visible {
  outline: 2px solid var(--tc-primary, #6c3bff);
  outline-offset: 2px;
}

/* Estado seleccionado */
.tc-option-card.tc-selected {
  border-color: var(--tc-primary, #6c3bff);
  background: var(--tc-primary, #6c3bff);
  color: #fff;
}

.tc-option-card.tc-selected .tc-card-price {
  color: rgba(255, 255, 255, 0.9);
}

.tc-card-label {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.tc-card-sublabel {
  font-size: 0.72rem;
  opacity: 0.7;
}

.tc-card-price {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--tc-accent, #ff6b6b);
  margin-top: 4px;
}

/* ── Bloque de línea móvil ──────────────────────────────────────────────────── */
.tc-line-block {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.1);
}

.tc-line-block:last-of-type {
  border-bottom: none;
  margin-bottom: 12px;
}

.tc-line-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.tc-line-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--tc-primary, #6c3bff);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Descuento badge ────────────────────────────────────────────────────────── */
.tc-discount-badge {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--tc-accent, #ff6b6b);
  font-weight: 600;
}

.tc-badge-discount {
  background: var(--tc-accent, #ff6b6b);
  color: #fff;
  border-radius: 20px;
  padding: 1px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  vertical-align: middle;
}

/* ── Botones ────────────────────────────────────────────────────────────────── */
.tc-btn-add,
.tc-btn-remove,
.tc-btn-contratar {
  border: none;
  cursor: pointer;
  font-family: var(--tc-font, inherit);
  font-weight: 600;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  border-radius: var(--tc-radius, 12px);
}

.tc-btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 2px dashed var(--tc-primary, #6c3bff);
  color: var(--tc-primary, #6c3bff);
  padding: 10px 20px;
  font-size: 0.88rem;
  width: 100%;
  justify-content: center;
}

.tc-btn-add:hover {
  background: rgba(108, 59, 255, 0.06);
}

.tc-btn-remove {
  background: transparent;
  border: 1px solid rgba(255, 80, 80, 0.4);
  color: #e03f3f;
  padding: 4px 12px;
  font-size: 0.75rem;
}

.tc-btn-remove:hover {
  background: rgba(255, 80, 80, 0.08);
}

/* ── Panel de resumen (columna derecha) ─────────────────────────────────────── */
.tc-summary {
  position: sticky;
  top: 24px;
  background: var(--tc-card-bg, #fff);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--tc-radius, 12px);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(108, 59, 255, 0.1);
}

.tc-summary-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--tc-primary, #6c3bff);
  color: var(--tc-primary, #6c3bff);
}

.tc-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  padding: 7px 0;
  gap: 8px;
}

.tc-summary-row span:first-child {
  color: var(--tc-text, #1a1a2e);
  opacity: 0.8;
}

.tc-summary-row span:last-child {
  font-weight: 600;
  white-space: nowrap;
}

.tc-summary-instalacion span:last-child {
  color: #2ecc71;
  font-weight: 700;
}

.tc-summary-divider {
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin: 14px 0;
}

.tc-summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.tc-total-price {
  font-size: 1.6rem;
  color: var(--tc-accent, #ff6b6b);
  font-weight: 800;
  line-height: 1;
}

/* ── Botón Contratar ────────────────────────────────────────────────────────── */
.tc-btn-contratar {
  display: block;
  width: 100%;
  padding: 16px 24px;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  background: var(--tc-primary, #6c3bff);
  color: #fff !important;
  border-radius: var(--tc-radius, 12px);
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px rgba(108, 59, 255, 0.35);
}

.tc-btn-contratar:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(108, 59, 255, 0.4);
}

.tc-btn-contratar:active {
  transform: translateY(0);
}

/* ── Responsive: en móvil el summary va al final ────────────────────────────── */
@media (max-width: 900px) {
  .tc-summary {
    position: static;
    order: -1; /* Aparece arriba en móvil para precios visibles */
    order: 1;  /* En realidad al final (sobrescribe) */
  }
}

@media (max-width: 480px) {
  .tc-section {
    padding: 16px;
  }

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

  .tc-total-price {
    font-size: 1.3rem;
  }
}
