/**
 * dtfcalc.css — Estilos de la calculadora flotante DTF Calc v3.0.0
 * Compatible con Warehouse 4.7.2 — usa variables CSS del tema cuando es posible
 */

/* ============================================================
   VARIABLES
   ============================================================ */
:root {
  --dtfcalc-primary: #e63312;
  --dtfcalc-primary-dark: #c42a0e;
  --dtfcalc-secondary: #2d2d2d;
  --dtfcalc-bg: #ffffff;
  --dtfcalc-bg-light: #f8f9fa;
  --dtfcalc-border: #dee2e6;
  --dtfcalc-text: #333333;
  --dtfcalc-text-muted: #6c757d;
  --dtfcalc-success: #28a745;
  --dtfcalc-danger: #dc3545;
  --dtfcalc-warning: #ffc107;
  --dtfcalc-radius: 8px;
  --dtfcalc-shadow: 0 4px 24px rgba(0,0,0,0.15);
  --dtfcalc-z-index: 9999;
  --dtfcalc-panel-width: 400px;
  --dtfcalc-panel-max-height: 85vh;
}

/* ============================================================
   WIDGET CONTENEDOR
   ============================================================ */
.dtfcalc-widget {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--dtfcalc-z-index);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================================
   BOTÓN FLOTANTE
   ============================================================ */
.dtfcalc-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--dtfcalc-primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  cursor: pointer;
  box-shadow: var(--dtfcalc-shadow);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s, transform 0.2s;
  white-space: nowrap;
}

.dtfcalc-toggle:hover,
.dtfcalc-toggle:focus {
  background: var(--dtfcalc-primary-dark);
  transform: translateY(-2px);
  outline: 2px solid var(--dtfcalc-primary);
  outline-offset: 2px;
}

.dtfcalc-toggle-icon {
  font-size: 18px;
  line-height: 1;
}

/* ============================================================
   PANEL
   ============================================================ */
.dtfcalc-panel {
  position: fixed;
  bottom: 80px;
  left: 50%;
  width: var(--dtfcalc-panel-width);
  max-width: calc(100vw - 48px);
  max-height: var(--dtfcalc-panel-max-height);
  background: var(--dtfcalc-bg);
  border-radius: var(--dtfcalc-radius);
  box-shadow: var(--dtfcalc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(-50%) translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s;
  z-index: var(--dtfcalc-z-index);
}

.dtfcalc-panel.dtfcalc-panel-open {
  transform: translateX(-50%) translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Cabecera */
.dtfcalc-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--dtfcalc-primary);
  color: #fff;
  flex-shrink: 0;
}

.dtfcalc-panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.dtfcalc-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 18px;
  border-radius: 4px;
  transition: background 0.15s;
}

.dtfcalc-close:hover {
  background: rgba(255,255,255,0.2);
}

/* Cuerpo */
.dtfcalc-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--dtfcalc-border) transparent;
}

/* Pie */
.dtfcalc-panel-footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--dtfcalc-border);
  background: var(--dtfcalc-bg);
  flex-shrink: 0;
}

/* ============================================================
   PASOS
   ============================================================ */
.dtfcalc-step {
  margin-bottom: 20px;
}

.dtfcalc-step-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dtfcalc-primary);
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--dtfcalc-primary);
}

.dtfcalc-step-hidden {
  display: none;
}

/* ============================================================
   CAMPOS
   ============================================================ */
.dtfcalc-field {
  margin-bottom: 14px;
}

.dtfcalc-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--dtfcalc-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.dtfcalc-field-hidden {
  display: none;
}

.dtfcalc-select,
.dtfcalc-input,
.dtfcalc-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--dtfcalc-border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--dtfcalc-text);
  background: var(--dtfcalc-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.dtfcalc-select:focus,
.dtfcalc-input:focus,
.dtfcalc-textarea:focus {
  border-color: var(--dtfcalc-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(230, 51, 18, 0.1);
}

.dtfcalc-textarea {
  resize: vertical;
  min-height: 70px;
}

/* ============================================================
   EXTRAS (checkboxes)
   ============================================================ */
.dtfcalc-extras {
  background: var(--dtfcalc-bg-light);
  border-radius: 6px;
  padding: 12px;
  margin-top: 8px;
}

.dtfcalc-extras-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--dtfcalc-text-muted);
  margin: 0 0 8px;
}

.dtfcalc-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
  font-size: 13px;
}

.dtfcalc-checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--dtfcalc-primary);
  cursor: pointer;
}

.dtfcalc-extra-price {
  color: var(--dtfcalc-text-muted);
  font-size: 11px;
}

/* ============================================================
   RADIO DISEÑO
   ============================================================ */
.dtfcalc-diseno-opciones {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.dtfcalc-radio-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 2px solid var(--dtfcalc-border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 13px;
}

.dtfcalc-radio-label:has(input:checked) {
  border-color: var(--dtfcalc-primary);
  background: rgba(230, 51, 18, 0.04);
}

.dtfcalc-radio-label input[type="radio"] {
  accent-color: var(--dtfcalc-primary);
}

/* ============================================================
   UPLOAD
   ============================================================ */
.dtfcalc-upload-zone {
  border: 2px dashed var(--dtfcalc-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
  background: var(--dtfcalc-bg-light);
}

.dtfcalc-upload-zone:hover,
.dtfcalc-upload-zone.dtfcalc-dragover {
  border-color: var(--dtfcalc-primary);
  background: rgba(230, 51, 18, 0.03);
}

.dtfcalc-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.dtfcalc-upload-placeholder p {
  margin: 6px 0 4px;
  font-size: 13px;
}

.dtfcalc-upload-placeholder small {
  color: var(--dtfcalc-text-muted);
  font-size: 11px;
}

.dtfcalc-upload-status {
  margin-top: 8px;
  font-size: 13px;
}

.dtfcalc-upload-ok { color: var(--dtfcalc-success); }
.dtfcalc-upload-error { color: var(--dtfcalc-danger); }
.dtfcalc-uploading { color: var(--dtfcalc-text-muted); }

/* ============================================================
   RESULTADO / PRECIO
   ============================================================ */
.dtfcalc-resultado {
  background: var(--dtfcalc-bg-light);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 16px;
  border: 1px solid var(--dtfcalc-border);
}

.dtfcalc-resultado-visible {
  border-color: var(--dtfcalc-primary);
}

.dtfcalc-desglose-linea {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--dtfcalc-text-muted);
  padding: 2px 0;
}

.dtfcalc-precio-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--dtfcalc-border);
}

.dtfcalc-precio-label {
  font-size: 13px;
  color: var(--dtfcalc-text-muted);
}

.dtfcalc-precio-valor {
  font-size: 22px;
  font-weight: 700;
  color: var(--dtfcalc-primary);
}

.dtfcalc-precio-iva {
  font-size: 11px;
  color: var(--dtfcalc-text-muted);
}

.dtfcalc-ubicacion-preview {
  margin-top: 8px;
}

.dtfcalc-ubicacion-preview-img {
  max-width: 100%;
  max-height: 80px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--dtfcalc-border);
}

/* ============================================================
   TABLA DE TARIFAS (mini)
   ============================================================ */
.dtfcalc-mini-tabla {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  margin-top: 8px;
}

.dtfcalc-mini-tabla th {
  background: var(--dtfcalc-bg-light);
  padding: 4px 8px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--dtfcalc-border);
}

.dtfcalc-mini-tabla td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--dtfcalc-border);
}

.dtfcalc-mini-tabla tr.dtfcalc-tarifa-activa {
  background: rgba(230, 51, 18, 0.08);
  font-weight: 600;
  color: var(--dtfcalc-primary);
}

.dtfcalc-tarifa-info {
  margin-top: 8px;
}

/* ============================================================
   BOTONES
   ============================================================ */
.dtfcalc-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.dtfcalc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dtfcalc-btn-primary {
  background: var(--dtfcalc-primary);
  color: #fff;
}

.dtfcalc-btn-primary:hover:not(:disabled) {
  background: var(--dtfcalc-primary-dark);
}

.dtfcalc-btn-secondary {
  background: var(--dtfcalc-bg-light);
  color: var(--dtfcalc-text);
  border: 1px solid var(--dtfcalc-border);
}

.dtfcalc-btn-secondary:hover:not(:disabled) {
  background: var(--dtfcalc-border);
}

/* ============================================================
   MENSAJES
   ============================================================ */
.dtfcalc-messages,
.dtfcalc-conf-messages {
  margin-top: 10px;
}

.dtfcalc-message {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
}

.dtfcalc-msg-ok {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.dtfcalc-msg-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.dtfcalc-msg-warn {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
}

/* ============================================================
   AYUDA
   ============================================================ */
.dtfcalc-ayuda {
  padding: 12px 20px;
  border-top: 1px solid var(--dtfcalc-border);
  background: var(--dtfcalc-bg-light);
}

.dtfcalc-ayuda details > summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--dtfcalc-text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.dtfcalc-ayuda-contenido {
  margin-top: 10px;
  font-size: 13px;
  color: var(--dtfcalc-text);
}

/* ============================================================
   VERIFICACIÓN DISEÑO
   ============================================================ */
.dtfcalc-verificando { color: var(--dtfcalc-text-muted); font-size: 12px; }
.dtfcalc-verificado-ok { color: var(--dtfcalc-success); font-size: 12px; font-weight: 600; }
.dtfcalc-verificado-no { color: var(--dtfcalc-text-muted); font-size: 12px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .dtfcalc-widget {
    bottom: 16px;
    right: 16px;
    left: 16px;
    transform: none;
  }

  .dtfcalc-panel {
    width: auto;
    left: 16px;
    right: 16px;
    bottom: 70px;
    transform: translateY(20px) scale(0.95);
  }

  .dtfcalc-panel.dtfcalc-panel-open {
    transform: translateY(0) scale(1);
  }

  .dtfcalc-toggle-text {
    display: none;
  }

  .dtfcalc-toggle {
    border-radius: 50%;
    padding: 14px;
  }

  .dtfcalc-panel-footer {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dtfcalc-panel,
  .dtfcalc-toggle {
    transition: none;
  }
}

/* ============================================================
   v4.0.25 — Aviso opciones, servicios de diseño, cerrar ayuda
   ============================================================ */

/* Aviso bajo "Opciones adicionales" */
.dtfcalc-extras-aviso {
  font-size: 12px;
  line-height: 1.4;
  color: #6b6b6b;
  background: #f7f7f7;
  border-left: 3px solid #d2342a;
  padding: 8px 10px;
  margin: 0 0 12px;
  border-radius: 4px;
}

/* Lista de servicios de diseño en el widget */
.dtfcalc-servicio-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.dtfcalc-servicio-item:hover {
  border-color: #d2342a;
  background: #fdf6f5;
}

.dtfcalc-servicio-nombre {
  font-weight: 600;
  font-size: 14px;
}

.dtfcalc-servicio-precio {
  font-weight: 600;
  color: #d2342a;
  margin-left: 6px;
}

.dtfcalc-servicio-desc {
  color: #777;
  font-size: 12px;
  line-height: 1.3;
}

.dtfcalc-servicios-vacio,
.dtfcalc-servicios-error {
  font-size: 13px;
  color: #888;
  padding: 8px 0;
}

/* Botón cerrar ayuda */
.dtfcalc-ayuda-cerrar {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: #d2342a;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}

.dtfcalc-ayuda-cerrar:hover {
  background: #b32c23;
}
