/**
 * distance-styles.css — Precios por Distancia
 */

/* ── Notices en ficha de producto ─────────────────────────────────────────── */
.pzdist-product-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    border: 1px solid transparent;
    font-size: 14px;
    line-height: 1.5;
}

.pzdist-product-notice--no-location {
    background: #fffbf0;
    border-color: #1746BE;
}

.pzdist-product-notice--out-of-range {
    background: #fff5f5;
    border-color: #f5c6c6;
}

.pzdist-product-notice--in-range {
    background: #f0fff4;
    border-color: #9ae6b4;
}

.pzdist-product-notice--calculating {
    background: #f0f4ff;
    border-color: #b3c6f5;
}

.pzdist-product-notice--error {
    background: #fff8f0;
    border-color: #f5c89a;
}

.pzdist-notice-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.pzdist-notice-body {
    flex: 1;
}

.pzdist-notice-body strong {
    display: block;
    margin-bottom: 4px;
    font-size: 15px;
}

.pzdist-notice-body p {
    margin: 0 0 10px;
    color: #555;
}

/* ── Botón de geolocalización ─────────────────────────────────────────────── */
.pzdist-btn-get-location {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #2c3e50;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

.pzdist-btn-get-location:hover {
    background: #1a252f;
    color: #fff;
}

.pzdist-btn-link {
    background: none;
    border: none;
    color: #0073aa;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    text-decoration: none;
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pzdist-btn-link:hover {
    color: #005080;
    text-decoration: none;
}

/* ── Status de geolocalización ─────────────────────────────────────────────── */
.pzdist-location-status {
    display: inline-block;
    margin-left: 10px;
    font-size: 13px;
    color: #666;
}

/* ── Mensaje de precio en tarjeta de producto ────────────────────────────── */
.pzdist-price-msg {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    line-height: 1.6;
}

.pzdist-price-msg--no-location {
    color: #856404;
    background: #fff3cd;
    cursor: pointer;
}

.pzdist-price-msg--no-location:hover {
    background: #ffe69c;
}

.pzdist-price-msg--out-of-range {
    color: #842029;
    background: #f8d7da;
}

.pzdist-price-msg--contact {
    color: #0c5460;
    background: #d1ecf1;
}

/* ── Badge de distancia — oculto hasta que JS lo active ─────────────────── */
/* Nota: el badge se muestra vía JS con la clase pzdist-badge-visible */

/* ── Etiqueta de zona ────────────────────────────────────────────────────── */
.pzdist-zone-label {
    display: inline-block;
    font-size: 11px;
    color: #555;
    background: #f0f0f0;
    padding: 2px 7px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ── Bloqueo de compra si está fuera de rango ────────────────────────────── */
body.pzdist-out-of-range .single_add_to_cart_button,
body.pzdist-no-location .single_add_to_cart_button {
    opacity: 0.4;
    pointer-events: none;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .pzdist-product-notice {
        flex-direction: column;
        gap: 8px;
    }
}

/* ── Iconos SVG inline ───────────────────────────────────────────────────── */
.pzdist-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    line-height: 1;
}

.pzdist-notice-icon .pzdist-icon {
    width: 20px;
    height: 20px;
}

@keyframes pzdist-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.pzdist-icon--spin {
    animation: pzdist-spin 0.9s linear infinite;
}

.pzdist-btn-get-location .pzdist-icon {
    width: 16px;
    height: 16px;
}

.pzdist-btn-link .pzdist-icon {
    width: 14px;
    height: 14px;
}

.pzdist-price-msg .pzdist-icon {
    width: 14px;
    height: 14px;
}

/* ════════════════════════════════════════════════════════
   CHECKOUT: Aviso de localidad de servicio
   ════════════════════════════════════════════════════════ */

.pzdist-checkout-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    border: 1px solid transparent;
    font-size: 0.95em;
    line-height: 1.5;
}

.pzdist-checkout-notice--in-range {
    background-color: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

.pzdist-checkout-notice--no-location {
    background-color: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}

.pzdist-checkout-notice .pzdist-notice-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.pzdist-checkout-notice .pzdist-notice-body {
    flex: 1;
}

.pzdist-checkout-notice .pzdist-notice-body strong {
    display: block;
    margin-bottom: 2px;
    font-weight: 600;
}

.pzdist-checkout-notice .pzdist-notice-body p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.85;
}

.pzdist-checkout-notice--in-range a,
.pzdist-checkout-notice--in-range button {
    color: #166534;
    text-decoration: none;
}

.pzdist-checkout-notice--no-location a,
.pzdist-checkout-notice--no-location button {
    color: #92400e;
    text-decoration: none;
}

/* ════════════════════════════════════════════════════════
   SKELETON: precio cargando (cuando hay cookie pero la página
   estaba cacheada y PHP no pudo calcular el precio)
   ════════════════════════════════════════════════════════ */

.pzdist-price-skeleton {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

.pzdist-price-skeleton > span {
    display: inline-block;
    width: 90px;
    height: 1.2em;
    border-radius: 4px;
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: pzdist-shimmer 1.4s infinite;
    vertical-align: middle;
}

@keyframes pzdist-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ════════════════════════════════════════════════════════
   POPUP DE UBICACIÓN
   ════════════════════════════════════════════════════════ */

/* Overlay */
.pzdist-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 20, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.pzdist-popup-overlay.pzdist-popup-visible {
    opacity: 1;
    pointer-events: all;
}

/* Card */
.pzdist-popup-card {
    background: #fff;
    border-radius: 20px;
    max-width: 420px;
    width: 100%;
    padding: 36px 32px 28px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.22), 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    position: relative;
    text-align: center;
}

.pzdist-popup-overlay.pzdist-popup-visible .pzdist-popup-card {
    transform: translateY(0) scale(1);
}

/* Ícono principal */
.pzdist-popup-icon-wrap {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #1746BE;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    position: relative;
}

.pzdist-popup-icon-wrap::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.12);
}

.pzdist-popup-icon-wrap svg {
    color: #fff;
    position: relative;
    z-index: 1;
}

/* Textos */
.pzdist-popup-title {
    font-size: 26px !important;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
    letter-spacing: -0.3px;
    line-height: 1.25;
}

.pzdist-popup-subtitle {
    font-size: 0.88rem;
    color: #64748b;
    margin: 0 0 24px;
    line-height: 1.6;
}

/* Razones (lista con íconos) */
.pzdist-popup-reasons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
    text-align: left;
}

.pzdist-popup-reason {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 11px 13px;
}

.pzdist-popup-reason-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: #1746BE;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.pzdist-popup-reason-icon svg {
    color: #fff;
}

.pzdist-popup-reason-text {
    font-size: 0.82rem;
    color: #334155;
    line-height: 1.5;
}

.pzdist-popup-reason-text strong {
    display: block;
    color: #0f172a;
    font-weight: 600;
    margin-bottom: 1px;
}

/* Botones */
.pzdist-popup-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100% !important;
    padding: 14px 20px;
    background: #1746BE !important;
    color: #fff !important;
    border: none;
    border-radius: 12px;
    font-size: 13px !important;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 4px 14px rgba(23, 70, 190, 0.4);
    letter-spacing: 0.1px;
    margin-bottom: 10px;
}

.pzdist-popup-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(23, 70, 190, 0.5);
    background: #1338a0;
}

.pzdist-popup-btn-primary:active {
    transform: translateY(0);
}

.pzdist-popup-btn-secondary {
    display: block;
    width: 100% !important;
    padding: 12px 20px;
    background: #fff !important;
    color: #1746BE !important;
    border: none;
    border-radius: 12px;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    margin-bottom: 0;
}

.pzdist-popup-btn-secondary:hover {
    transform: translateY(-1px);
}

/* Estado: calculando */
.pzdist-popup-card.pzdist-popup-calculating .pzdist-popup-btn-primary {
    opacity: 0.7;
    pointer-events: none;
}

.pzdist-popup-calculating-msg {
    display: none;
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 8px;
}

.pzdist-popup-card.pzdist-popup-calculating .pzdist-popup-calculating-msg {
    display: block;
}

/* Estado: error */
.pzdist-popup-error-msg {
    display: none;
    font-size: 0.82rem;
    color: #dc2626;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 12px;
    margin-top: 10px;
    text-align: left;
}

.pzdist-popup-error-msg.pzdist-popup-error-visible {
    display: block;
}

/* ════════════════════════════════════════════════════════
   WIDGET FLOTANTE DE DISTANCIA (esquina inferior derecha)
   ════════════════════════════════════════════════════════ */

.pzdist-distance-badge {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999980;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1.5px solid #1746BE !important;
    border-radius: 50px;
    padding: 8px 14px 8px 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.pzdist-distance-badge.pzdist-badge-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
    animation: pzdist-badge-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes pzdist-badge-in {
    from { opacity: 0; transform: translateY(12px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.pzdist-distance-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.16);
}

.pzdist-badge-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1746BE !important;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pzdist-badge-dot svg {
    color: #fff;
}

.pzdist-badge-text {
    line-height: 1.2;
}

.pzdist-badge-text-km {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    display: block;
}

.pzdist-badge-text-label {
    font-size: 0.7rem;
    color: #94a3b8;
    display: block;
}

/* Tooltip al hover */
.pzdist-distance-badge::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: #0f172a;
    color: #fff;
    font-size: 0.75rem;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.pzdist-distance-badge::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    right: 18px;
    border: 5px solid transparent;
    border-top-color: #0f172a;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.pzdist-distance-badge:hover::before,
.pzdist-distance-badge:hover::after {
    opacity: 1;
    transform: translateY(0);
}
