/**
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License version 3.0
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/AFL-3.0
 *
 * @author    David Escudero Digital Studio <contacto@davidescudero.com>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
 *
 * Don't forget to prefix your containers with your own identifier
 * to avoid any conflicts with other modules.
 */

/* ─────────────────────────────────────────
   DES Custom WhatsApp – Widget Container
───────────────────────────────────────── */
.descustomwhatsapp-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ─────────────────────────────────────────
   Base Button
───────────────────────────────────────── */
.descustomwhatsapp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    position: relative;
    overflow: visible;
    background-color: transparent;
}

.descustomwhatsapp-btn:hover,
.descustomwhatsapp-btn:focus {
    box-shadow: 0 0px 5px rgba(0, 0, 0, 0.35);
    outline: none;
    text-decoration: none;
}

/* ─────────────────────────────────────────
   WhatsApp Button (business hours)
───────────────────────────────────────── */
.descustomwhatsapp-btn--whatsapp {
    background-color: #25D366;
}

.descustomwhatsapp-btn--whatsapp:hover,
.descustomwhatsapp-btn--whatsapp:focus {
    background-color: #1ebe5a;
}

/* ─────────────────────────────────────────
   Toggle Button (off-hours)
───────────────────────────────────────── */
.descustomwhatsapp-btn--toggle {
    background-color: #4a5568;
    padding: 0;
}

.descustomwhatsapp-btn--toggle:hover,
.descustomwhatsapp-btn--toggle:focus {
    background-color: #2d3748;
}

/* ─────────────────────────────────────────
   Sub-buttons (pill shape)
───────────────────────────────────────── */
.descustomwhatsapp-subbutton {
    width: auto;
    height: 48px;
    border-radius: 24px;
    padding: 0 18px 0 14px;
    gap: 10px;
    justify-content: flex-start;
}

.descustomwhatsapp-btn--gmail {
    background-color: #EA4335;
}

.descustomwhatsapp-btn--gmail:hover,
.descustomwhatsapp-btn--gmail:focus {
    background-color: #d03325;
}

.descustomwhatsapp-btn--contact {
    background-color: #1A73E8;
}

.descustomwhatsapp-btn--contact:hover,
.descustomwhatsapp-btn--contact:focus {
    background-color: #1558b0;
}

/* ─────────────────────────────────────────
   Icons (SVG via data-uri)
───────────────────────────────────────── */
.descustomwhatsapp-icon {
    display: block;
    width: 28px;
    height: 28px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.descustomwhatsapp-subbutton .descustomwhatsapp-icon {
    width: 22px;
    height: 22px;
}

/* WhatsApp brand icon */
.descustomwhatsapp-icon--whatsapp {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z'/%3E%3C/svg%3E");
}

/* Chat bubble icon (shown when toggle is closed) */
.descustomwhatsapp-icon--support {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM9 11H7V9h2v2zm4 0h-2V9h2v2zm4 0h-2V9h2v2z'/%3E%3C/svg%3E");
}

/* Close (×) icon (shown when toggle is open) */
.descustomwhatsapp-icon--close {
    display: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3E%3C/svg%3E");
}

/* Email envelope icon */
.descustomwhatsapp-icon--gmail {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z'/%3E%3C/svg%3E");
}

/* Contact page (speech bubble) icon */
.descustomwhatsapp-icon--contact {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z'/%3E%3C/svg%3E");
}

/* ─────────────────────────────────────────
   Tooltip (appears to the left of main buttons on hover)
───────────────────────────────────────── */
.descustomwhatsapp-tooltip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1;
}

.descustomwhatsapp-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(0, 0, 0, 0.75);
}

.descustomwhatsapp-btn:hover .descustomwhatsapp-tooltip,
.descustomwhatsapp-btn:focus .descustomwhatsapp-tooltip {
    opacity: 1;
}

/* Hide tooltip when toggle is open (the × icon is self-explanatory) */
.descustomwhatsapp-btn--toggle[aria-expanded='true'] .descustomwhatsapp-tooltip {
    opacity: 0 !important;
    pointer-events: none;
}

/* ─────────────────────────────────────────
   Sub-button label (inline text next to icon)
───────────────────────────────────────── */
.descustomwhatsapp-sublabel {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    letter-spacing: 0.2px;
    font-family: inherit;
}

/* ─────────────────────────────────────────
   Out-of-hours Container
───────────────────────────────────────── */
.descustomwhatsapp-outofhours {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ─────────────────────────────────────────
   Sub-buttons Panel (collapsed by default)
───────────────────────────────────────── */
.descustomwhatsapp-subbotones {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    padding-bottom: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease, padding-bottom 0.35s ease;
    pointer-events: none;
}

/* ─────────────────────────────────────────
   Open State (toggled via JS by adding .is-open to parent)
───────────────────────────────────────── */
.descustomwhatsapp-outofhours.is-open .descustomwhatsapp-subbotones {
    max-height: 200px;
    opacity: 1;
    padding-bottom: 12px;
    pointer-events: auto;
    overflow:visible;
}

.descustomwhatsapp-outofhours.is-open .descustomwhatsapp-btn--toggle {
    background-color: #e53e3e;
}

.descustomwhatsapp-outofhours.is-open .descustomwhatsapp-btn--toggle:hover,
.descustomwhatsapp-outofhours.is-open .descustomwhatsapp-btn--toggle:focus {
    background-color: #c53030;
}

.descustomwhatsapp-outofhours.is-open .descustomwhatsapp-icon--support {
    display: none;
}

.descustomwhatsapp-outofhours.is-open .descustomwhatsapp-icon--close {
    display: block;
}

/* ─────────────────────────────────────────
   Responsive – small screens
───────────────────────────────────────── */
@media (max-width: 992px){
    .descustomwhatsapp-widget{
        bottom:102px;
    }
}
@media (max-width: 480px) {
    .descustomwhatsapp-widget {
        right: 16px;
    }
    
    .descustomwhatsapp-btn {
        height: 50px;
    }
    button.descustomwhatsapp-btn,
    .descustomwhatsapp-btn--whatsapp{
        width:50px;
    }
    .descustomwhatsapp-subbutton {
        height: 44px;
        padding: 0 14px 0 10px;
    }

    .descustomwhatsapp-tooltip {
        display: none;
    }
}
