/**
 * Premium frontend stylesheet for WhatsApp & Email Floating Contact Widget.
 * Utilizes CSS variables, glassmorphism, flexbox layout, and smooth animations.
 */

:root {
    --waec-theme-color: #25D366; /* Default WhatsApp green */
    --waec-email-color: #4f46e5; /* Premium Indigo for mail option */
    --waec-bg-glass: rgba(255, 255, 255, 0.85);
    --waec-border-glass: rgba(255, 255, 255, 0.4);
    --waec-shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.12), 0 4px 12px -2px rgba(0, 0, 0, 0.06);
    --waec-shadow-fab: 0 8px 24px -4px rgba(37, 211, 102, 0.3), 0 4px 12px -2px rgba(0, 0, 0, 0.1);
    --waec-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Layout offsets default values, overridden dynamically by inline style properties */
    --waec-bottom-offset: 30px;
    --waec-top-offset: 30px;
    --waec-side-offset: 30px;
}

/* Container base rules */
#waec-widget {
    position: fixed;
    z-index: 999999;
    font-family: var(--waec-font-family);
    display: flex;
    flex-direction: column;
    pointer-events: none; /* Let clicks pass through empty spaces of container */
}

/* Positioning classes */
#waec-widget.waec-pos-right {
    right: var(--waec-side-offset, 30px);
    bottom: var(--waec-bottom-offset, 30px);
    align-items: flex-end;
}

#waec-widget.waec-pos-left {
    left: var(--waec-side-offset, 30px);
    bottom: var(--waec-bottom-offset, 30px);
    align-items: flex-start;
}

#waec-widget.waec-pos-top-right {
    right: var(--waec-side-offset, 30px);
    top: var(--waec-top-offset, 30px);
    bottom: auto;
    flex-direction: column-reverse; /* Places the card below the FAB */
    align-items: flex-end;
}

#waec-widget.waec-pos-top-left {
    left: var(--waec-side-offset, 30px);
    top: var(--waec-top-offset, 30px);
    bottom: auto;
    flex-direction: column-reverse; /* Places the card below the FAB */
    align-items: flex-start;
}

/* Floating Action Button (FAB) */
.waec-fab-btn {
    pointer-events: auto;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--waec-theme-color) !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--waec-shadow-fab) !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    outline: none !important;
    padding: 0;
}

/* Prevent theme colors from overriding active/focus states */
.waec-fab-btn:hover,
.waec-fab-btn:focus,
.waec-fab-btn:active,
.waec-fab-btn:visited {
    background-color: var(--waec-theme-color) !important;
    color: #ffffff !important;
    box-shadow: 0 12px 28px -2px rgba(37, 211, 102, 0.45), 0 6px 16px -2px rgba(0, 0, 0, 0.15) !important;
}

.waec-fab-btn:hover {
    transform: scale(1.08) rotate(8deg);
}

.waec-fab-btn:active {
    transform: scale(0.95);
}

.waec-fab-btn svg {
    width: 32px;
    height: 32px;
    fill: #ffffff !important;
    color: #ffffff !important;
    transition: transform 0.3s ease;
}

/* Subtle Pulsing Animation */
@keyframes waec-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.waec-fab-btn.animate-pulse {
    animation: waec-pulse 2s infinite;
}

/* Contact Options Card */
#waec-card {
    pointer-events: auto;
    width: 330px;
    background: var(--waec-bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--waec-border-glass);
    border-radius: 18px;
    box-shadow: var(--waec-shadow-card);
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    transform-origin: bottom right;
}

/* Adjust margins and origin for top-aligned positioning */
#waec-widget.waec-pos-top-right #waec-card {
    margin-bottom: 0;
    margin-top: 20px;
    transform-origin: top right;
}

#waec-widget.waec-pos-left #waec-card {
    transform-origin: bottom left;
}

#waec-widget.waec-pos-top-left #waec-card {
    margin-bottom: 0;
    margin-top: 20px;
    transform-origin: top left;
}

/* Hidden state */
.waec-card-hidden {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

/* Set reverse transform translation direction for top positions */
#waec-widget.waec-pos-top-right .waec-card-hidden,
#waec-widget.waec-pos-top-left .waec-card-hidden {
    transform: scale(0.8) translateY(-20px);
}

/* Active visible state */
.waec-card-active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0) !important;
}

/* Card Header */
.waec-card-header {
    background: linear-gradient(135deg, var(--waec-theme-color), rgba(37, 211, 102, 0.8)) !important;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff !important;
}

.waec-card-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
    color: #ffffff !important;
}

.waec-close-btn {
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.8) !important;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
}

.waec-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

/* Card Body */
.waec-card-body {
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.65);
}

.waec-card-text {
    font-size: 14px;
    line-height: 1.5;
    color: #4b5563;
    margin: 0 0 16px 0;
}

/* Buttons Styling */
.waec-btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.waec-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.waec-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.waec-action-btn:active {
    transform: translateY(0);
}

.waec-btn-icon {
    display: inline-flex;
    margin-right: 10px;
}

.waec-btn-label {
    letter-spacing: -0.1px;
}

/* WhatsApp Button styling (locked with !important to prevent active/hover color change) */
.waec-whatsapp-btn {
    background-color: var(--waec-theme-color) !important;
    color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.waec-whatsapp-btn:hover,
.waec-whatsapp-btn:focus,
.waec-whatsapp-btn:active,
.waec-whatsapp-btn:visited {
    background-color: var(--waec-theme-color) !important;
    color: #ffffff !important;
    opacity: 0.9 !important;
}

.waec-whatsapp-btn svg {
    fill: #ffffff !important;
    color: #ffffff !important;
}

/* Email Button styling (locked with !important) */
.waec-email-btn {
    background-color: var(--waec-email-color) !important;
    color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

.waec-email-btn:hover,
.waec-email-btn:focus,
.waec-email-btn:active,
.waec-email-btn:visited {
    background-color: var(--waec-email-color) !important;
    color: #ffffff !important;
    opacity: 0.9 !important;
}

.waec-email-btn svg {
    color: #ffffff !important;
}

/* SVG sizes inside buttons */
.waec-action-btn svg {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    #waec-widget.waec-pos-right {
        right: var(--waec-side-offset, 20px);
        bottom: var(--waec-bottom-offset, 20px);
    }
    
    #waec-widget.waec-pos-left {
        left: var(--waec-side-offset, 20px);
        bottom: var(--waec-bottom-offset, 20px);
    }
    
    #waec-widget.waec-pos-top-right {
        right: var(--waec-side-offset, 20px);
        top: var(--waec-top-offset, 20px);
    }
    
    #waec-widget.waec-pos-top-left {
        left: var(--waec-side-offset, 20px);
        top: var(--waec-top-offset, 20px);
    }
    
    #waec-card {
        width: calc(100vw - 40px); /* Fill screen width with padding */
        max-width: 320px;
    }
}
