/**
 * WP WhatsApp Chat Lite - Frontend Styles
 */

.wwcl-wrapper {
    position: fixed;
    z-index: 999999;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

/* =========================================
   THEME RESET (Override Astra & others)
   ========================================= */
#wwcl-main-wrapper button,
.wwcl-wrapper button {
    all: unset; /* Completely strips theme defaults */
    box-sizing: border-box !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    margin: 0 !important;
    padding: 0 !important;
    text-transform: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
}

/* Positioning */
.wwcl-pos-bottom-right { bottom: 30px; right: 30px; flex-direction: row; }
.wwcl-pos-bottom-left  { bottom: 30px; left: 30px; flex-direction: row-reverse; }
.wwcl-pos-top-right    { top: 30px; right: 30px; flex-direction: row; align-items: flex-start; }
.wwcl-pos-top-left     { top: 30px; left: 30px; flex-direction: row-reverse; align-items: flex-start; }

/* Base Button Styling (Direct Link Presets) */
.wwcl-button {
    position: relative; z-index: 2; display: flex; align-items: center;
    background-color: #25D366; color: #ffffff; border: none; cursor: pointer;
    text-decoration: none; box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.wwcl-button:hover, .wwcl-button:focus {
    background-color: #128C7E; color: #ffffff; text-decoration: none;
    box-shadow: 0 6px 20px rgba(18, 140, 126, 0.5); outline: none; transform: scale(1.06); 
}

/* Icons & Text */
.wwcl-icon { display: flex; align-items: center; justify-content: center; }
.wwcl-custom-icon-img { width: 34px; height: 34px; object-fit: contain; display: block; }
.wwcl-text { margin-left: 10px; font-size: 15px; font-weight: 600; line-height: 1; white-space: nowrap; }

/* Pulse Animation */
.wwcl-pulse {
    position: absolute; z-index: 1; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 100%; height: 100%; background-color: rgba(37, 211, 102, 0.6);
    animation: wwcl-pulse-anim 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes wwcl-pulse-anim {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1.3); opacity: 0; }
}

/* =========================================
   STANDARD PRESETS (1 to 6)
   ========================================= */
.wwcl-preset-pill .wwcl-button { padding: 12px 20px 12px 16px; border-radius: 50px; }
.wwcl-preset-pill .wwcl-pulse { border-radius: 50px; }

.wwcl-preset-square .wwcl-button { padding: 14px 20px 14px 16px; border-radius: 12px; }
.wwcl-preset-square .wwcl-pulse { border-radius: 12px; }

.wwcl-preset-circle .wwcl-button { width: 60px; height: 60px; border-radius: 50%; justify-content: center; padding: 0; }
.wwcl-preset-circle .wwcl-pulse { border-radius: 50%; }

.wwcl-preset-expand .wwcl-button { padding: 16px; border-radius: 50px; }
.wwcl-preset-expand .wwcl-text { max-width: 0; opacity: 0; overflow: hidden; margin-left: 0; transition: max-width 0.4s ease, opacity 0.4s ease, margin 0.4s ease; }
.wwcl-preset-expand .wwcl-button:hover, .wwcl-preset-expand .wwcl-button:focus { padding: 12px 20px 12px 16px; }
.wwcl-preset-expand .wwcl-button:hover .wwcl-text, .wwcl-preset-expand .wwcl-button:focus .wwcl-text { max-width: 300px; opacity: 1; margin-left: 10px; }
.wwcl-preset-expand .wwcl-pulse { border-radius: 50px; }

.wwcl-preset-bubble .wwcl-button { width: 60px; height: 60px; border-radius: 50%; justify-content: center; padding: 0; overflow: visible; }
.wwcl-bubble-text { position: absolute; bottom: calc(100% + 15px); background: #ffffff; color: #333; padding: 10px 15px; border-radius: 8px; font-size: 14px; font-weight: 600; white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,0.1); pointer-events: none; }
.wwcl-bubble-text::after { content: ''; position: absolute; bottom: -6px; right: 20px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 6px solid #ffffff; }
.wwcl-pos-bottom-right .wwcl-bubble-text { right: 0; }
.wwcl-pos-bottom-left .wwcl-bubble-text { left: 0; right: auto; }
.wwcl-pos-bottom-left .wwcl-bubble-text::after { left: 20px; right: auto; }
.wwcl-pos-top-right .wwcl-bubble-text { top: calc(100% + 15px); bottom: auto; right: 0; }
.wwcl-pos-top-right .wwcl-bubble-text::after { top: -6px; bottom: auto; border-top: none; border-bottom: 6px solid #ffffff; right: 20px; }
.wwcl-pos-top-left .wwcl-bubble-text { top: calc(100% + 15px); bottom: auto; left: 0; right: auto; }
.wwcl-pos-top-left .wwcl-bubble-text::after { top: -6px; bottom: auto; border-top: none; border-bottom: 6px solid #ffffff; left: 20px; }
.wwcl-preset-bubble .wwcl-pulse { border-radius: 50%; }

.wwcl-preset-ghost .wwcl-button { background-color: #ffffff; color: #25D366; border: 2px solid #25D366; padding: 10px 18px 10px 14px; border-radius: 50px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); }
.wwcl-preset-ghost .wwcl-button:hover, .wwcl-preset-ghost .wwcl-button:focus { background-color: #25D366; color: #ffffff; }
.wwcl-preset-ghost .wwcl-pulse { border-radius: 50px; }

.wwcl-button:not(:has(.wwcl-text)):not(:has(.wwcl-bubble-text)) { width: 60px; height: 60px; padding: 0; justify-content: center; border-radius: 50%; }
.wwcl-button:not(:has(.wwcl-text)):not(:has(.wwcl-bubble-text)) + .wwcl-pulse { border-radius: 50%; }


/* =========================================
   PRESET 7: WATI-STYLE POPUP BOX 
   ========================================= */
.wwcl-preset-popup {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* The Trigger Button - Bulletproofed */
#wwcl-main-wrapper .wwcl-trigger-btn {
    width: 65px !important; height: 65px !important; border-radius: 50% !important;
    background-color: #00e676 !important; 
    box-shadow: 0 6px 15px rgba(0, 230, 118, 0.3) !important;
    display: flex !important; align-items: center !important; justify-content: center !important; 
    z-index: 10 !important; cursor: pointer !important;
    border: none !important; padding: 0 !important; min-width: 0 !important;
}
#wwcl-main-wrapper .wwcl-trigger-btn:hover { transform: scale(1.05) !important; background-color: #00c853 !important; }

/* The Tooltip (Matches image_bc7299.png exactly) */
.wwcl-side-tooltip {
    display: flex; align-items: center; gap: 12px;
    margin: 0 15px; 
    animation: wwcl-bounce 2s infinite;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.wwcl-tooltip-text {
    background: #ffffff; border: 1.5px solid #111;
    color: #111; font-weight: 600; font-size: 16px;
    padding: 12px 24px; border-radius: 50px;
    box-shadow: 4px 4px 0px #00e676; cursor: pointer;
    transition: transform 0.2s;
}
.wwcl-tooltip-text:hover { transform: translateY(-2px); }

/* Black Circle Close Button for Tooltip - Bulletproofed */
#wwcl-main-wrapper .wwcl-tooltip-close-btn {
    background: #111 !important; color: #fff !important;
    width: 28px !important; height: 28px !important; border-radius: 50% !important;
    border: none !important; cursor: pointer !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2) !important;
    transition: transform 0.2s !important;
    min-width: 0 !important; padding: 0 !important;
}
#wwcl-main-wrapper .wwcl-tooltip-close-btn:hover { transform: scale(1.1) !important; }

@keyframes wwcl-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Tooltip Layout based on Corner Position */
.wwcl-pos-bottom-right .wwcl-side-tooltip, .wwcl-pos-top-right .wwcl-side-tooltip { flex-direction: row; }
.wwcl-pos-bottom-left .wwcl-side-tooltip, .wwcl-pos-top-left .wwcl-side-tooltip { flex-direction: row-reverse; }

/* The Popup Window */
.wwcl-popup-window {
    position: absolute; width: 330px; background: #ffffff;
    border: 1.5px solid #111; border-radius: 20px;
    box-shadow: 6px 6px 0px #00e676;
    padding: 25px 25px 30px 25px;
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 20;
}

/* Window Positioning */
.wwcl-pos-bottom-right .wwcl-popup-window { bottom: calc(100% + 20px); right: 0; transform-origin: bottom right; }
.wwcl-pos-bottom-left .wwcl-popup-window { bottom: calc(100% + 20px); left: 0; transform-origin: bottom left; }
.wwcl-pos-top-right .wwcl-popup-window { top: calc(100% + 20px); right: 0; transform-origin: top right; }
.wwcl-pos-top-left .wwcl-popup-window { top: calc(100% + 20px); left: 0; transform-origin: top left; }

/* The pointing tail */
.wwcl-popup-window::after {
    content: ''; position: absolute; width: 25px; height: 25px;
    background: #ffffff; border-bottom: 1.5px solid #111; border-right: 1.5px solid #111;
}

/* Tail Positions based on screen corner */
.wwcl-pos-bottom-right .wwcl-popup-window::after { bottom: -13px; right: 20px; transform: rotate(45deg); box-shadow: 4px 4px 0px #00e676; }
.wwcl-pos-bottom-left .wwcl-popup-window::after { bottom: -13px; left: 20px; transform: rotate(45deg); box-shadow: 4px 4px 0px #00e676; }
.wwcl-pos-top-right .wwcl-popup-window::after { top: -13px; right: 20px; transform: rotate(225deg); }
.wwcl-pos-top-left .wwcl-popup-window::after { top: -13px; left: 20px; transform: rotate(225deg); }

/* Popup Internal Layout (Matches image_bc7220.png) */
.wwcl-popup-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 25px; }
.wwcl-popup-icon-small {
    width: 48px; height: 48px; border-radius: 50%; border: 1px solid #111;
    display: flex; align-items: center; justify-content: center;
}
.wwcl-popup-icon-small svg { width: 26px; height: 26px; }

/* The X Close Button inside the Window - Bulletproofed */
#wwcl-main-wrapper .wwcl-popup-close-btn { 
    background: transparent !important; border: none !important; 
    font-size: 32px !important; line-height: 1 !important; 
    color: #999 !important; cursor: pointer !important; 
    padding: 0 !important; min-width: 0 !important; min-height: 0 !important;
    transition: color 0.2s !important; font-weight: 300 !important;
    box-shadow: none !important;
}
#wwcl-main-wrapper .wwcl-popup-close-btn:hover { color: #111 !important; background: transparent !important; }

.wwcl-popup-body p { 
    margin: 0 0 25px 0; font-size: 20px; font-weight: 600; 
    color: #111; line-height: 1.4; 
}

/* Popup Start Chat Button */
.wwcl-popup-start-btn {
    display: flex; align-items: center; justify-content: space-between;
    background: #1e1e1e; color: #fff; text-decoration: none;
    padding: 16px 20px; border-radius: 12px;
    font-weight: 600; font-size: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.wwcl-popup-start-btn span { flex-grow: 1; margin-left: 12px; }
.wwcl-popup-start-btn:hover { background: #000; color: #fff; text-decoration: none; }

/* Active State when Popup is Open */
.wwcl-popup-active .wwcl-popup-window { opacity: 1; visibility: visible; transform: translateY(0) scale(1); pointer-events: auto; }

/* Hide Tooltip ONLY when the popup is open. */
.wwcl-popup-active .wwcl-side-tooltip { opacity: 0; visibility: hidden; pointer-events: none; }

/* =========================================
   Mobile Responsiveness
   ========================================= */
@media (max-width: 768px) {
    .wwcl-pos-bottom-right { bottom: 20px; right: 20px; }
    .wwcl-pos-bottom-left  { bottom: 20px; left: 20px; }
    .wwcl-pos-top-right    { top: 20px; right: 20px; }
    .wwcl-pos-top-left     { top: 20px; left: 20px; }

    .wwcl-text { font-size: 14px; }
    .wwcl-preset-pill .wwcl-button, .wwcl-preset-square .wwcl-button { padding: 10px 16px 10px 14px; }
    .wwcl-preset-circle .wwcl-button, .wwcl-preset-bubble .wwcl-button { width: 52px; height: 52px; }
    .wwcl-preset-expand .wwcl-button { padding: 10px 16px 10px 14px; }
    .wwcl-preset-expand .wwcl-text { max-width: 300px; opacity: 1; margin-left: 10px; }
    .wwcl-preset-ghost .wwcl-button { padding: 8px 16px 8px 12px; }

    #wwcl-main-wrapper .wwcl-trigger-btn { width: 55px !important; height: 55px !important; }
    .wwcl-side-tooltip { margin: 0 10px; gap: 8px; }
    .wwcl-tooltip-text { font-size: 14px; padding: 10px 18px; }
    
    .wwcl-popup-window { width: calc(100vw - 40px); max-width: 320px; padding: 20px; }
    .wwcl-popup-body p { font-size: 18px; }
    div#wwcl-side-tooltip{display: none;}
}