/**
 * Chat Widget Styles - Floating Button
 * 
 * @package Iraq_AI_Shop
 */

:root {
    --widget-accent: #25d366;
    --widget-accent-hover: #22c55e;
    --widget-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Floating Button */
.ias-widget-btn {
    position: fixed;
    bottom: 20px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--widget-accent);
    border: none;
    box-shadow: var(--widget-shadow);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, background 0.3s;
}

.ias-widget-btn--left {
    left: 20px;
}

.ias-widget-btn--right {
    right: 20px;
}

.ias-widget-btn:hover {
    transform: scale(1.1);
    background: var(--widget-accent-hover);
}

.ias-widget-btn__icon {
    font-size: 28px;
    color: white;
}

/* Pulse Animation */
.ias-widget-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--widget-accent);
    animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Welcome Tooltip */
.ias-widget-tooltip {
    position: fixed;
    bottom: 90px;
    z-index: 9998;
    background: white;
    color: #1a1a1a;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: var(--widget-shadow);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    max-width: 250px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.ias-widget-tooltip--left {
    left: 20px;
}

.ias-widget-tooltip--right {
    right: 20px;
}

.ias-widget-tooltip--visible {
    opacity: 1;
    transform: translateY(0);
}

.ias-widget-tooltip::after {
    content: '';
    position: absolute;
    bottom: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

.ias-widget-tooltip--left::after {
    left: 24px;
}

.ias-widget-tooltip--right::after {
    right: 24px;
}

.ias-widget-tooltip__close {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: transparent;
    border: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
}

/* Modal Container */
.ias-widget-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s;
}

.ias-widget-modal--open {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity 0.3s;
}

.ias-widget-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.ias-widget-modal__content {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 480px;
    max-height: 700px;
    background: #0b141a;
    border-radius: 16px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.ias-widget-modal--open .ias-widget-modal__content {
    transform: scale(1);
}

.ias-widget-modal__close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.4);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ias-widget-modal__iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Mobile Fullscreen */
@media (max-width: 767px) {
    .ias-widget-modal__content {
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .ias-widget-modal__close {
        top: max(12px, env(safe-area-inset-top, 0px));
    }
}

/* Hide widget on chat page */
body.ias-chat-page .ias-widget-btn,
body.ias-chat-page .ias-widget-tooltip {
    display: none !important;
}