/**
 * GuestSEO WhatsApp Widget Styles
 *
 * Edge-hugging slide-in widget
 *
 * @package GuestSEO
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */

.guestseo-whatsapp {
    --wa-bg: rgba(255, 255, 255, 0.8);
    --wa-text: #075e54;
    --wa-green: #25D366;
    --wa-top-offset: 15%;
    --wa-font-size: 14px;
    --wa-font-family: inherit;
    --wa-radius: 15px;
}

/* ==========================================================================
   Base Widget
   ========================================================================== */

.guestseo-whatsapp {
    position: fixed;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.guestseo-whatsapp.visible {
    opacity: 1;
    visibility: visible;
}

.guestseo-whatsapp.dismissed {
    display: none !important;
}

/* ==========================================================================
   Link & Content
   ========================================================================== */

.guestseo-whatsapp-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--wa-bg);
    color: var(--wa-text);
    text-decoration: none;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 8px 24px rgba(0, 0, 0, 0.12),
        0 16px 48px rgba(0, 0, 0, 0.1);
    font-family: var(--wa-font-family);
    font-size: var(--wa-font-size);
    font-weight: 500;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.guestseo-whatsapp-link:hover {
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.18),
        0 12px 32px rgba(0, 0, 0, 0.15),
        0 20px 56px rgba(0, 0, 0, 0.12);
    color: var(--wa-text);
}

.guestseo-whatsapp-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--wa-green);
    flex-shrink: 0;
}

.guestseo-whatsapp-icon svg {
    width: 100%;
    height: 100%;
}

.guestseo-whatsapp-text {
    white-space: nowrap;
}

/* ==========================================================================
   Close Button
   ========================================================================== */

.guestseo-whatsapp-close {
    position: absolute;
    top: -8px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #666;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.guestseo-whatsapp:hover .guestseo-whatsapp-close {
    opacity: 1;
}

.guestseo-whatsapp-close:hover {
    background: #333;
}

/* ==========================================================================
   Position: Right (default) - hugs right edge
   ========================================================================== */

.guestseo-whatsapp.pos-right {
    right: 0;
    left: auto;
    top: var(--wa-top-offset);
    transform: translateX(100%);
}

.guestseo-whatsapp.pos-right.visible {
    transform: translateX(0);
}

.guestseo-whatsapp.pos-right .guestseo-whatsapp-link {
    /* Round only left corners (inner side) */
    border-radius: var(--wa-radius) 0 0 var(--wa-radius);
}

.guestseo-whatsapp.pos-right .guestseo-whatsapp-close {
    left: -8px;
    right: auto;
}

/* ==========================================================================
   Position: Left - hugs left edge
   ========================================================================== */

.guestseo-whatsapp.pos-left {
    left: 0;
    right: auto;
    top: var(--wa-top-offset);
    transform: translateX(-100%);
}

.guestseo-whatsapp.pos-left.visible {
    transform: translateX(0);
}

.guestseo-whatsapp.pos-left .guestseo-whatsapp-link {
    /* Round only right corners (inner side) */
    border-radius: 0 var(--wa-radius) var(--wa-radius) 0;
}

.guestseo-whatsapp.pos-left .guestseo-whatsapp-close {
    right: -8px;
    left: auto;
}

/* ==========================================================================
   Position: Top - hugs top edge
   ========================================================================== */

.guestseo-whatsapp.pos-top {
    top: 0;
    left: 50%;
    right: auto;
    transform: translate(-50%, -100%);
}

.guestseo-whatsapp.pos-top.visible {
    transform: translate(-50%, 0);
}

.guestseo-whatsapp.pos-top .guestseo-whatsapp-link {
    /* Round only bottom corners (inner side) */
    border-radius: 0 0 var(--wa-radius) var(--wa-radius);
    padding-top: 8px;
    padding-bottom: 8px;
}

.guestseo-whatsapp.pos-top .guestseo-whatsapp-close {
    top: auto;
    bottom: -8px;
    right: -8px;
}

/* ==========================================================================
   Position: Bottom-Left - hugs left edge, 15% from bottom
   ========================================================================== */

.guestseo-whatsapp.pos-bottom-left {
    left: 0;
    right: auto;
    top: auto;
    bottom: 15%;
    transform: translateX(-100%);
}

.guestseo-whatsapp.pos-bottom-left.visible {
    transform: translateX(0);
}

.guestseo-whatsapp.pos-bottom-left .guestseo-whatsapp-link {
    border-radius: 0 var(--wa-radius) var(--wa-radius) 0;
}

.guestseo-whatsapp.pos-bottom-left .guestseo-whatsapp-close {
    right: -8px;
    left: auto;
}

/* ==========================================================================
   Position: Bottom-Right - hugs right edge, 15% from bottom
   ========================================================================== */

.guestseo-whatsapp.pos-bottom-right {
    right: 0;
    left: auto;
    top: auto;
    bottom: 15%;
    transform: translateX(100%);
}

.guestseo-whatsapp.pos-bottom-right.visible {
    transform: translateX(0);
}

.guestseo-whatsapp.pos-bottom-right .guestseo-whatsapp-link {
    border-radius: var(--wa-radius) 0 0 var(--wa-radius);
}

.guestseo-whatsapp.pos-bottom-right .guestseo-whatsapp-close {
    left: -8px;
    right: auto;
}

/* ==========================================================================
   Responsive: Tablet (768px - 1024px)
   ========================================================================== */

@media (max-width: 1024px) and (min-width: 769px) {
    .guestseo-whatsapp.tablet-right {
        right: 0 !important;
        left: auto !important;
        top: var(--wa-top-offset) !important;
        transform: translateX(100%) !important;
    }
    
    .guestseo-whatsapp.tablet-right.visible {
        transform: translateX(0) !important;
    }
    
    .guestseo-whatsapp.tablet-right .guestseo-whatsapp-link {
        border-radius: var(--wa-radius) 0 0 var(--wa-radius) !important;
    }
    
    .guestseo-whatsapp.tablet-left {
        left: 0 !important;
        right: auto !important;
        top: var(--wa-top-offset) !important;
        transform: translateX(-100%) !important;
    }
    
    .guestseo-whatsapp.tablet-left.visible {
        transform: translateX(0) !important;
    }
    
    .guestseo-whatsapp.tablet-left .guestseo-whatsapp-link {
        border-radius: 0 var(--wa-radius) var(--wa-radius) 0 !important;
    }
    
    .guestseo-whatsapp.tablet-top {
        top: 0 !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -100%) !important;
    }
    
    .guestseo-whatsapp.tablet-top.visible {
        transform: translate(-50%, 0) !important;
    }
    
    .guestseo-whatsapp.tablet-top .guestseo-whatsapp-link {
        border-radius: 0 0 var(--wa-radius) var(--wa-radius) !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }
}

/* ==========================================================================
   Responsive: Mobile (< 769px)
   ========================================================================== */

@media (max-width: 768px) {
    .guestseo-whatsapp.mobile-right {
        right: 0 !important;
        left: auto !important;
        top: var(--wa-top-offset) !important;
        transform: translateX(100%) !important;
    }
    
    .guestseo-whatsapp.mobile-right.visible {
        transform: translateX(0) !important;
    }
    
    .guestseo-whatsapp.mobile-right .guestseo-whatsapp-link {
        border-radius: var(--wa-radius) 0 0 var(--wa-radius) !important;
    }
    
    .guestseo-whatsapp.mobile-left {
        left: 0 !important;
        right: auto !important;
        top: var(--wa-top-offset) !important;
        transform: translateX(-100%) !important;
    }
    
    .guestseo-whatsapp.mobile-left.visible {
        transform: translateX(0) !important;
    }
    
    .guestseo-whatsapp.mobile-left .guestseo-whatsapp-link {
        border-radius: 0 var(--wa-radius) var(--wa-radius) 0 !important;
    }
    
    .guestseo-whatsapp.mobile-top {
        top: 0 !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -100%) !important;
    }
    
    .guestseo-whatsapp.mobile-top.visible {
        transform: translate(-50%, 0) !important;
    }
    
    .guestseo-whatsapp.mobile-top .guestseo-whatsapp-link {
        border-radius: 0 0 var(--wa-radius) var(--wa-radius) !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }
    
    /* Bottom-left position */
    .guestseo-whatsapp.mobile-bottom-left {
        left: 0 !important;
        right: auto !important;
        top: auto !important;
        bottom: 15% !important;
        transform: translateX(-100%) !important;
    }
    
    .guestseo-whatsapp.mobile-bottom-left.visible {
        transform: translateX(0) !important;
    }
    
    .guestseo-whatsapp.mobile-bottom-left .guestseo-whatsapp-link {
        border-radius: 0 var(--wa-radius) var(--wa-radius) 0 !important;
    }
    
    /* Bottom-right position */
    .guestseo-whatsapp.mobile-bottom-right {
        right: 0 !important;
        left: auto !important;
        top: auto !important;
        bottom: 15% !important;
        transform: translateX(100%) !important;
    }
    
    .guestseo-whatsapp.mobile-bottom-right.visible {
        transform: translateX(0) !important;
    }
    
    .guestseo-whatsapp.mobile-bottom-right .guestseo-whatsapp-link {
        border-radius: var(--wa-radius) 0 0 var(--wa-radius) !important;
    }
    
    /* Icon-only mode for side positions */
    .guestseo-whatsapp.mobile-icon-only .guestseo-whatsapp-text {
        display: none;
    }
    
    .guestseo-whatsapp.mobile-icon-only .guestseo-whatsapp-link {
        padding: 14px;
    }
    
    .guestseo-whatsapp.mobile-icon-only .guestseo-whatsapp-icon {
        width: 32px;
        height: 32px;
    }
    
    /* Close button always visible on mobile */
    .guestseo-whatsapp-close {
        opacity: 0.7;
    }
}

/* ==========================================================================
   Icon Only Mode
   ========================================================================== */

.guestseo-whatsapp.icon-only .guestseo-whatsapp-text {
    display: none;
}

.guestseo-whatsapp.icon-only .guestseo-whatsapp-link {
    padding: 14px;
}

.guestseo-whatsapp.icon-only .guestseo-whatsapp-icon {
    width: 32px;
    height: 32px;
}

/* ==========================================================================
   Animate Mode: Collapse to icon only
   ========================================================================== */

.guestseo-whatsapp.animate-mode .guestseo-whatsapp-link {
    transition: padding 0.3s ease;
}

.guestseo-whatsapp.animate-mode .guestseo-whatsapp-text {
    transition: opacity 0.3s ease, max-width 0.3s ease;
    max-width: 300px;
    overflow: hidden;
}

.guestseo-whatsapp.animate-mode.collapsed .guestseo-whatsapp-text {
    opacity: 0;
    max-width: 0;
    padding: 0;
    margin: 0;
}

.guestseo-whatsapp.animate-mode.collapsed .guestseo-whatsapp-link {
    padding: 14px;
    gap: 0;
}

/* Expand on hover when collapsed */
.guestseo-whatsapp.animate-mode.collapsed:hover .guestseo-whatsapp-text {
    opacity: 1;
    max-width: 300px;
}

.guestseo-whatsapp.animate-mode.collapsed:hover .guestseo-whatsapp-link {
    padding: 14px 20px;
    gap: 10px;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .guestseo-whatsapp {
        transition: opacity 0.2s ease, visibility 0.2s ease;
    }
}

/* Focus state */
.guestseo-whatsapp-link:focus {
    outline: 2px solid var(--wa-green);
    outline-offset: 2px;
}

.guestseo-whatsapp-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
