/**
 * WhatsApp flotante y paneles de atención y de la sucursal (inc/contact.php).
 * Se carga después de style.css (inc/assets.php).
 */

@media (max-width: 768px) {
    /* Elevar botón flotante de WhatsApp en móvil en checkout para no tapar el botón sticky */
    .woocommerce-checkout .allimport-wa-float-wrap {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
        right: 14px !important;
    }
}

@media (max-width: 768px) {
    /* La ficha ya tiene "Pedir por WhatsApp" y la barra de compra: el botón flotante tapaba el contenido */
    body.single-product .allimport-wa-float-wrap {
        display: none !important;
    }
}

.allimport-wa-float-wrap {
    position: fixed;
    bottom: 26px;
    right: 26px;
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: none;
}

.allimport-wa-float-btn {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none !important;
    position: relative;
    transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.allimport-wa-float-btn:hover {
    transform: translateY(-4px) scale(1.03);
}

.allimport-wa-float-circle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25D366 0%, #1ebe5d 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.42), 0 2px 6px rgba(0, 0, 0, 0.08);
    position: relative;
    transition: box-shadow 0.25s ease, background 0.25s ease;
}

.allimport-wa-float-btn:hover .allimport-wa-float-circle {
    background: linear-gradient(135deg, #28e06c 0%, #20c662 100%);
    box-shadow: 0 6px 28px rgba(37, 211, 102, 0.6), 0 3px 8px rgba(0, 0, 0, 0.12);
}

.allimport-wa-float-circle svg {
    width: 32px;
    height: 32px;
    fill: #ffffff;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

/* Indicador pulsante En linea */
.allimport-wa-online-pulse {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 15px;
    height: 15px;
    background-color: #22c55e;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(34, 197, 94, 0.6);
    animation: allimport-wa-pulse 2.2s infinite;
}

/* Tooltip / Globo de dialogo */
.allimport-wa-float-tooltip {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    padding: 8px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    position: relative;
    transition: all 0.25s ease;
    opacity: 0.98;
}

.allimport-wa-float-btn:hover .allimport-wa-float-tooltip {
    opacity: 1;
    transform: translateX(-4px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.allimport-wa-float-tooltip::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid #ffffff;
}

.wa-tooltip-title {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.2;
}

.wa-tooltip-action {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}

@media (max-width: 991px) {
.allimport-wa-float-wrap {
        bottom: 20px;
        right: 14px;
        z-index: 999;
    }
.allimport-wa-float-circle {
        width: 48px;
        height: 48px;
        box-shadow: 0 3px 14px rgba(37, 211, 102, 0.4);
    }
.allimport-wa-float-circle svg {
        width: 26px;
        height: 26px;
    }
.allimport-wa-float-tooltip {
        display: none !important;
    }
}

.allimport-location-drawer,
.allimport-location-drawer *,
.allimport-location-drawer *::before,
.allimport-location-drawer *::after {
    box-sizing: border-box !important;
}

.allimport-location-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: #ffffff;
    z-index: 9999999;
    /* Sin sombra mientras está cerrado: fuera de pantalla se asomaba como una franja oscura en el borde derecho */
    box-shadow: none;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

.allimport-location-drawer.is-active {
    transform: translateX(0);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.drawer-header-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    width: fit-content;
    margin-top: 1px;
}

.drawer-header-status.is-open {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.drawer-header-status.is-open .status-indicator {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
    animation: allimport-pulse-dot 1.8s infinite;
}

.drawer-header-status.is-open .status-label {
    color: #059669;
}

.drawer-header-status.is-closed {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.drawer-header-status.is-closed .status-indicator {
    width: 6px;
    height: 6px;
    background: #f59e0b;
    border-radius: 50%;
}

.drawer-header-status.is-closed .status-label {
    color: #b45309;
}

/* Mapa en el Drawer */
.allimport-drawer-map-wrap {
    position: relative;
    width: 100%;
    height: 200px;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    background: #f1f5f9;
}

.allimport-drawer-map {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.map-badge-corner {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.94);
    color: #1e293b;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(226, 232, 240, 0.9);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(6px);
}

/* Ficha de Detalles */
.allimport-drawer-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.drawer-detail-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.detail-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-icon.icon-pin { background: #eff6ff; border: 1px solid #dbeafe; }

.detail-icon.icon-ref { background: #ecfdf5; border: 1px solid #d1fae5; }

.detail-icon.icon-clock { background: #fffbeb; border: 1px solid #fef3c7; }

.detail-icon.icon-box { background: #f0fdf4; border: 1px solid #dcfce7; }

.detail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.detail-tag {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    margin-bottom: 3px;
}

.detail-primary {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.3;
}

.detail-secondary {
    font-size: 12px;
    color: #475569;
    margin-top: 1px;
}

.detail-city {
    font-size: 12px;
    font-weight: 600;
    color: #2563eb;
    margin-top: 2px;
}

.detail-ref-text {
    margin: 0;
    font-size: 13px;
    color: #334155;
    line-height: 1.35;
}

.detail-schedule-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 2px 0;
}

.schedule-days {
    color: #475569;
}

.schedule-hours {
    color: #0f172a;
    font-weight: 700;
}

.detail-schedule-row.is-closed-row .schedule-hours {
    color: #dc2626;
    font-weight: 600;
}

.detail-pickup-badge {
    font-size: 13px;
    font-weight: 700;
    color: #16a34a;
}

.detail-pickup-sub {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.3;
}

/* Botones de Acción GPS en Drawer */
.allimport-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 2px;
}

.drawer-btn {
    text-decoration: none !important;
    font-weight: 700;
    font-size: 13px;
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
    border: 0;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.drawer-btn-gmaps {
    background: #2563eb;
    color: #ffffff !important;
}

.drawer-btn-gmaps:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32);
}

.drawer-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.drawer-btn-waze {
    background: #0284c7;
    color: #ffffff !important;
    font-size: 12px;
    padding: 11px 12px;
}

.drawer-btn-waze:hover {
    background: #0369a1;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(2, 132, 199, 0.3);
}

.drawer-btn-wa {
    background: #16a34a;
    color: #ffffff !important;
    font-size: 12px;
    padding: 11px 12px;
}

.drawer-btn-wa:hover {
    background: #15803d;
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(22, 163, 74, 0.3);
}

@media (max-width: 768px) {
.allimport-location-drawer {
        width: 100vw;
        max-width: 100vw;
    }
}

@media (max-width: 768px) {
.allimport-location-drawer {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }
}

@media (max-width: 768px) {
.drawer-header-status {
        font-size: 11px !important;
    }
}

@media (max-width: 768px) {
.allimport-drawer-map-wrap {
        height: 180px !important;
    }
.detail-schedule-row {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1px !important;
        padding: 3px 0 !important;
    }
.drawer-btn-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
}

.allimport-contact-drawer,
.allimport-contact-drawer *,
.allimport-contact-drawer *::before,
.allimport-contact-drawer *::after {
    box-sizing: border-box !important;
}

.allimport-contact-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 100vw;
    background: #ffffff;
    z-index: 9999999;
    /* Sin sombra mientras está cerrado: fuera de pantalla se asomaba como una franja oscura en el borde derecho */
    box-shadow: none;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
}

.allimport-contact-drawer.is-active {
    transform: translateX(0);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.contact-header-icon {
    background: #f0fdf4 !important;
}

.contact-channel-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
    transition: all 0.2s ease;
}

.contact-channel-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.contact-channel-card.wa-card {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.contact-channel-card.wa-card:hover {
    border-color: #86efac;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.12);
}

.contact-channel-card.mail-card {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.contact-channel-card.mail-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}

.contact-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.contact-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.contact-card-icon.wa-icon {
    background: #16a34a;
    color: #ffffff;
}

.contact-card-icon.mail-icon {
    background: #2563eb;
    color: #ffffff;
}

.contact-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-badge-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.contact-number {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

.contact-number.email-text {
    font-size: 14px;
    word-break: break-all;
}

.contact-sub {
    font-size: 12px;
    color: #475569;
    line-height: 1.3;
}

.contact-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.btn-wa-green {
    background: #16a34a;
    color: #ffffff !important;
}

.btn-wa-green:hover {
    background: #15803d;
    transform: translateY(-1px);
}

.btn-mail-blue {
    background: #2563eb;
    color: #ffffff !important;
}

.btn-mail-blue:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.switch-to-location-btn {
    width: 100%;
    background: #f1f5f9;
    color: #334155;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.switch-to-location-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
}

@media (max-width: 768px) {
.allimport-contact-drawer {
        width: 100% !important;
        max-width: 100% !important;
        left: 0 !important;
        right: 0 !important;
    }
}

@media (max-width: 991px) {
body.has-sticky-buy-bar .allimport-wa-float-wrap {
        bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
        right: 14px !important;
    }
}

/* WhatsApp: sólido en los paneles de contacto; claro con borde donde acompaña a la compra */
body a.drawer-btn-wa,
body a.contact-card-btn.btn-wa-green {
    background: #16a34a !important;
    color: #ffffff !important;
}

/* En el checkout no hay burbuja de WhatsApp (en escritorio tapaba los métodos de pago) */
body.woocommerce-checkout .allimport-wa-float-wrap {
    display: none !important;
}
