/**
 * DEM Contact FAB - Frontend Styles
 */

/* CSS Custom Properties (set via inline styles in template) */
.dem-fab {
    --dem-fab-primary: #25D366;
    --dem-fab-text: #FFFFFF;
    --dem-fab-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --dem-fab-shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Container */
.dem-fab {
    position: fixed;
    z-index: 999998;
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-end;
    gap: 12px;
    font-family: 'Quicksand', sans-serif;
}

/* Position Variants */
.dem-fab--bottom-right {
    bottom: 24px;
    right: 24px;
}

.dem-fab--bottom-left {
    bottom: 24px;
    left: 24px;
    align-items: flex-start;
}

/* Main FAB Button */
.dem-fab__main {
    display: flex!important;
    flex-direction: column;
    align-content: center;
    align-items: center;
    gap: 0px;
    width: 70px !important;
    height: 70px !important;
    padding: 14px 20px !important;
    padding: 14px 20px;
    border: none!important;
    border-radius: 100px!important;
    background-color: var(--dem-fab-primary)!important;
    color: var(--dem-fab-text)!important;
    font-family: inherit;
    font-size: 10px!important;
    font-weight: 800!important;
    cursor: pointer;
    box-shadow: var(--dem-fab-shadow);
    transition: all 0.3s ease;
    animation: dem-fab-pulse 2s infinite;
}

.dem-fab__main:hover {
    box-shadow: var(--dem-fab-shadow-hover);
    transform: scale(1.05);
    animation: none;
}

.dem-fab__main:focus {
    outline: none!important;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.3), var(--dem-fab-shadow);
}

/* Pulse Animation */
@keyframes dem-fab-pulse {
    0% {
        box-shadow: var(--dem-fab-shadow), 0 0 0 0 rgba(37, 211, 102, 0.5);
    }
    70% {
        box-shadow: var(--dem-fab-shadow), 0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: var(--dem-fab-shadow), 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* Icons in Main Button */
.dem-fab__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.dem-fab__icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.dem-fab__icon--close {
    display: none;
}

/* Expanded State - Icon Switch */
.dem-fab[data-expanded="true"] .dem-fab__icon--chat {
    display: none;
}

.dem-fab[data-expanded="true"] .dem-fab__icon--close {
    display: flex;
}

/* Expanded State - Stop Pulse */
.dem-fab[data-expanded="true"] .dem-fab__main {
    animation: none;
}

/* Main Button Text */
.dem-fab__text {
    white-space: nowrap;
}

/* Options Container */
.dem-fab__options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s ease;
}

/* Expanded State - Show Options */
.dem-fab[data-expanded="true"] .dem-fab__options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Individual Option Buttons */
.dem-fab__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 50px;
    background-color: #FFFFFF;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--dem-fab-shadow);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.dem-fab__option:hover {
    box-shadow: var(--dem-fab-shadow-hover);
    transform: translateX(-5px);
    text-decoration: none;
    color: #333333;
}

/* Left position adjustment */
.dem-fab--bottom-left .dem-fab__option:hover {
    transform: translateX(5px);
}

.dem-fab__option:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.3), var(--dem-fab-shadow);
}

/* Option Icon */
.dem-fab__option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dem-fab__option-icon svg {
    width: 20px;
    height: 20px;
}

/* WhatsApp Option Styling */
.dem-fab__option--whatsapp .dem-fab__option-icon {
    background-color: #25D366;
    color: #FFFFFF;
}

.dem-fab__option--whatsapp .dem-fab__option-icon svg {
    fill: currentColor;
}

/* Phone Option Styling */
.dem-fab__option--phone .dem-fab__option-icon {
    background-color: #4285F4;
    color: #FFFFFF;
}

.dem-fab__option--phone .dem-fab__option-icon svg {
    fill: currentColor;
}

/* Option Text */
.dem-fab__option-text {
    color: #333333;
}

/* ====================== */
/* Responsive Styles      */
/* ====================== */

@media (max-width: 768px) {
    .dem-fab--bottom-right,
    .dem-fab--bottom-left {
        bottom: 16px;
    }

    .dem-fab--bottom-right {
        right: 16px;
    }

    .dem-fab--bottom-left {
        left: 16px;
    }

    .dem-fab__main {
        padding: 12px 16px;
        font-size: 14px;
    }

    .dem-fab__icon {
        width: 22px;
        height: 22px;
    }

    .dem-fab__option {
        padding: 10px 14px;
        font-size: 13px;
    }

    .dem-fab__option-icon {
        width: 32px;
        height: 32px;
    }

    .dem-fab__option-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* Hide text on very small screens, keep icon only */
@media (max-width: 480px) {
    
    .dem-fab__main {
        padding: 14px;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        justify-content: center;
    }

    .dem-fab__icon {
        width: 26px;
        height: 26px;
    }
}

/* Prevent interaction with sticky add-to-cart overlap */
body.has-sticky-atc .dem-fab {
    bottom: 90px;
}

@media (max-width: 767px) {
    body.has-sticky-atc .dem-fab {
        bottom: 130px;
    }
}
