/**
 * Livewellcraft Footer Styles
 * 
 * Structure:
 * 1. Footer Base & Layout
 * 2. Logo Contrast Handling
 * 3. Floating Action Buttons
 * 4. WhatsApp Chat Panel
 * 5. Animations & Transitions
 */

/* ==========================================================================
   1. Footer Base & Layout
   ========================================================================== */

.lwc-footer {
    position: relative;
}

/* Subtle texture overlay for premium feel */
.lwc-footer::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20'%3E%3Cpath d='M0 0l20 20 M20 0l-20 20' stroke='%23ffffff' stroke-width='0.5' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
}

/* ==========================================================================
   2. Logo Contrast Handling
   ========================================================================== */

/* Default: logo for dark backgrounds (light version) */
.lwc-logo-light {
    filter: brightness(0) invert(1);
    opacity: 0.95;
    transition: opacity 0.2s ease;
}

.lwc-footer-logo:hover .lwc-logo-light {
    opacity: 1;
}

/* Chat panel footer logo: dark version for light background */
.lwc-wa-footer-logo {
    height: 14px;
    width: auto;
    margin-left: 4px;
    filter: brightness(0) saturate(100%) invert(10%) sepia(15%) saturate(1000%) hue-rotate(200deg);
    opacity: 0.7;
}

/* ==========================================================================
   3. Floating Action Buttons
   ========================================================================== */

.lwc-floating-actions {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}

.lwc-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.lwc-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.lwc-fab:active {
    transform: translateY(0);
}

/* Back to Top Button */
.lwc-fab-secondary {
    background-color: #1A1A2E;
    color: #D4A017;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.lwc-fab-secondary.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lwc-fab-secondary:hover {
    background-color: #22223A;
}

/* WhatsApp Button */
.lwc-fab-whatsapp {
    position: relative;
    background-color: #25D366;
    color: white;
}

.lwc-fab-whatsapp:hover {
    background-color: #20c35e;
}

/* Pulse animation for WhatsApp button */
.lwc-fab-whatsapp::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: #25D366;
    opacity: 0;
    animation: lwc-pulse 2s ease-out infinite;
}

@keyframes lwc-pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.5;
    }
    70% {
        transform: scale(1.15);
        opacity: 0;
    }
    100% {
        transform: scale(1.15);
        opacity: 0;
    }
}

/* ==========================================================================
   4. WhatsApp Chat Panel
   ========================================================================== */

.lwc-wa-panel {
    position: fixed;
    bottom: 90px;
    right: 24px;
    width: 360px;
    max-width: calc(100vw - 48px);
    background: #FAF9F7;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    overflow: hidden;
}

.lwc-wa-panel.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Panel Header */
.lwc-wa-header {
    background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lwc-wa-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lwc-wa-avatar {
    width: 44px;
    height: 44px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.lwc-wa-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lwc-wa-title {
    color: white;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
}

.lwc-wa-subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    line-height: 1.3;
}

.lwc-wa-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    line-height: 1;
}

.lwc-wa-close:hover {
    opacity: 1;
}

/* Panel Body */
.lwc-wa-body {
    padding: 20px;
    background: #ece5dd;
}

/* Welcome Bubble */
.lwc-wa-bubble {
    background: white;
    padding: 14px 16px;
    border-radius: 0 12px 12px 12px;
    margin-bottom: 20px;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    position: relative;
}

.lwc-wa-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 8px 0;
    border-color: transparent white transparent transparent;
}

/* Form Styles */
.lwc-wa-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lwc-wa-field input,
.lwc-wa-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: #333;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.lwc-wa-field input::placeholder,
.lwc-wa-field textarea::placeholder {
    color: #999;
}

.lwc-wa-field input:focus,
.lwc-wa-field textarea:focus {
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.lwc-wa-field textarea {
    min-height: 80px;
    resize: vertical;
    line-height: 1.5;
}

/* Submit Button */
.lwc-wa-submit {display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: #25D366;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.lwc-wa-submit:hover {
    background: #20c35e;
}

.lwc-wa-submit:active {
    transform: scale(0.98);
}

/* Panel Footer */
.lwc-wa-footer {
    background: #FAF9F7;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 11px;
    color: #888;
    border-top: 1px solid #eee;
}

.lwc-wa-online-dot {
    width: 8px;
    height: 8px;
    background: #25D366;
    border-radius: 50%;
    animation: lwc-blink 2s ease-in-out infinite;
}

@keyframes lwc-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.lwc-wa-online-text {
    color: #25D366;
    font-weight: 500;
}

.lwc-wa-divider {
    color: #ccc;
}

.lwc-wa-powered {
    color: #aaa;
}

/* ==========================================================================
   5. Responsive Adjustments
   ========================================================================== */

@media (max-width: 640px) {
    .lwc-floating-actions {
        bottom: 16px;
        right: 16px;
        gap: 10px;
    }
    
    .lwc-fab {
        width: 48px;
        height: 48px;
    }
    
    .lwc-wa-panel {
        bottom: 80px;
        right: 16px;
        width: calc(100vw - 32px);
        max-height: calc(100vh - 120px);
    }
    
    .lwc-wa-body {
        padding: 16px;
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* ==========================================================================
   6. Overlay for Mobile
   ========================================================================== */

.lwc-wa-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lwc-wa-overlay.is-active {
    opacity: 1;
    visibility: visible;
}
