/**
 * Evie Chatbot Widget - Premium Luxury Dark Theme v2
 * Liquid Glass / Glassmorphism design
 *
 * @package Evosion_Chatbot
 */

/* ================================================================
   CSS Custom Properties
   ================================================================ */
:root {
    --evie-primary: #f15b26;
    --evie-primary-hover: #e04510;
    --evie-primary-glow: rgba(241, 91, 38, 0.4);
    --evie-accent: #1a2b2e;
    --evie-accent-deep: #0a1215;
    --evie-surface: #162225;
    --evie-surface-light: #1e3236;
    --evie-surface-hover: #223a3f;
    --evie-border: rgba(255, 255, 255, 0.06);
    --evie-border-light: rgba(255, 255, 255, 0.1);
    --evie-text: #ffffff;
    --evie-text-secondary: rgba(255, 255, 255, 0.7);
    --evie-text-muted: rgba(255, 255, 255, 0.4);
    --evie-radius: 24px;
    --evie-radius-sm: 16px;
    --evie-radius-xs: 10px;
    --evie-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
    --evie-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --evie-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ================================================================
   Widget Container
   ================================================================ */
#evie-chatbot-widget {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 999999;
    font-family: var(--evie-font);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#evie-chatbot-widget *,
#evie-chatbot-widget *::before,
#evie-chatbot-widget *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ================================================================
   Toggle Button - Large, Eye-catching, Premium Glow
   ================================================================ */
.evie-toggle-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--evie-primary), #d94a18);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 20px rgba(241, 91, 38, 0.35),
        0 8px 40px rgba(241, 91, 38, 0.15);
    transition: all 0.4s var(--evie-ease);
    position: relative;
    z-index: 3;
    animation: evie-btn-glow 3s ease-in-out infinite;
}

/* Ring 1 - slow expanding outer ring */
.evie-toggle-btn::before {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(241, 91, 38, 0.5);
    z-index: -1;
    animation: evie-ring-expand 2.5s ease-out infinite;
}

/* Ring 2 - delayed second ring */
.evie-toggle-btn::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(241, 91, 38, 0.4);
    z-index: -1;
    animation: evie-ring-expand 2.5s ease-out 0.8s infinite;
}

/* Pulse rings hidden - using only ::before/::after on button */
.evie-pulse-ring {
    display: none;
}

.evie-toggle-btn:hover {
    transform: scale(1.12) translateY(-3px);
    box-shadow:
        0 8px 30px rgba(241, 91, 38, 0.5),
        0 16px 60px rgba(241, 91, 38, 0.2);
}

.evie-toggle-btn:active {
    transform: scale(0.95);
}

.evie-toggle-btn svg {
    width: 30px;
    height: 30px;
    transition: transform 0.3s var(--evie-ease);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* Avatar image in toggle button */
.evie-icon-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    position: absolute;
    inset: 0;
}

.evie-widget--open .evie-icon-avatar {
    display: none;
}

.evie-widget--open .evie-icon-close {
    display: block;
}

.evie-icon-close {
    display: none;
}

/* Hide rings when chat is open */
.evie-widget--open .evie-toggle-btn {
    animation: none;
}

.evie-widget--open .evie-toggle-btn::before,
.evie-widget--open .evie-toggle-btn::after {
    animation: none;
    opacity: 0;
}

.evie-widget--open .evie-pulse-ring {
    animation: none;
    opacity: 0;
}

/* Button subtle inner glow */
@keyframes evie-btn-glow {
    0%, 100% {
        box-shadow:
            0 4px 20px rgba(241,91,38,0.35),
            0 8px 40px rgba(241,91,38,0.15),
            inset 0 0 12px rgba(255,255,255,0.1);
    }
    50% {
        box-shadow:
            0 4px 24px rgba(241,91,38,0.5),
            0 8px 48px rgba(241,91,38,0.25),
            inset 0 0 16px rgba(255,255,255,0.15);
    }
}

/* Ring expanding outward and fading */
@keyframes evie-ring-expand {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* ================================================================
   Chat Panel - Glassmorphism, Generous Spacing
   ================================================================ */
.evie-chat-panel {
    position: absolute;
    bottom: 84px;
    right: 0;
    width: 420px;
    height: 620px;
    max-height: calc(100vh - 140px);
    background: linear-gradient(170deg, #0e1a1d 0%, #0a1215 50%, #0d1619 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--evie-radius);
    box-shadow: var(--evie-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.5s var(--evie-ease);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Ambient glow inside panel */
.evie-chat-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(241,91,38,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 90%, rgba(76,194,192,0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    border-radius: var(--evie-radius);
}

.evie-widget--open .evie-chat-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* ================================================================
   Header - Premium Glass Bar
   ================================================================ */
.evie-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--evie-border);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

/* Gradient line under header */
.evie-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(241,91,38,0.3), transparent);
}

.evie-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(241, 91, 38, 0.3);
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(241, 91, 38, 0.15);
}

.evie-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.evie-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--evie-text);
    letter-spacing: 0.01em;
}

.evie-status {
    font-size: 12px;
    color: #4ade80;
    display: flex;
    align-items: center;
    gap: 6px;
}

.evie-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
    animation: evie-status-pulse 2s ease-in-out infinite;
}

@keyframes evie-status-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.evie-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--evie-border-light);
    background: rgba(255, 255, 255, 0.04);
    color: var(--evie-text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.evie-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--evie-text);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ================================================================
   Messages Area - Generous Padding
   ================================================================ */
.evie-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
    scroll-behavior: smooth;
}

.evie-messages::-webkit-scrollbar {
    width: 4px;
}

.evie-messages::-webkit-scrollbar-track {
    background: transparent;
}

.evie-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.evie-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ================================================================
   Message Bubbles - Larger, More Padding
   ================================================================ */
.evie-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: evie-msg-in 0.4s var(--evie-ease) both;
}

.evie-message--bot {
    align-self: flex-start;
}

.evie-message--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

@keyframes evie-msg-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.evie-message__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 4px;
    border: 1.5px solid rgba(241, 91, 38, 0.2);
}

.evie-message--user .evie-message__avatar {
    display: none;
}

.evie-message__content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.evie-message__bubble {
    padding: 16px 22px;
    border-radius: 18px;
    font-size: 15.5px;
    line-height: 1.65;
    min-width: 60px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.evie-message--bot .evie-message__bubble {
    background: var(--evie-surface);
    color: var(--evie-text);
    border: 1px solid var(--evie-border-light);
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.evie-message--user .evie-message__bubble {
    background: linear-gradient(135deg, var(--evie-primary), #d94a18);
    color: #ffffff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 12px rgba(241, 91, 38, 0.25);
}

.evie-message__time {
    font-size: 11px;
    color: var(--evie-text-muted);
    padding: 0 6px;
}

.evie-message--user .evie-message__time {
    text-align: right;
}

/* Bold text */
.evie-message__bubble strong,
.evie-message__bubble b {
    font-weight: 700;
}

/* Welcome Video */
.evie-video-bubble {
    padding: 8px !important;
    background: var(--evie-accent-deep) !important;
    border: 1px solid var(--evie-border-light) !important;
    overflow: hidden;
    max-width: 340px;
}

.evie-welcome-video {
    width: 100%;
    border-radius: 14px;
    display: block;
    max-height: 300px;
    object-fit: cover;
}

.evie-welcome-video-wrap {
    max-width: 90% !important;
}

/* ================================================================
   Typing Indicator - Elegant Bounce
   ================================================================ */
.evie-typing {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    max-width: 85%;
    animation: evie-msg-in 0.3s var(--evie-ease) both;
}

.evie-typing__avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(241, 91, 38, 0.2);
}

.evie-typing__dots {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 16px 20px;
    background: var(--evie-surface);
    border: 1px solid var(--evie-border-light);
    border-radius: 20px;
    border-bottom-left-radius: 6px;
}

.evie-typing__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--evie-text-muted);
    animation: evie-dot-bounce 1.4s ease-in-out infinite;
}

.evie-typing__dot:nth-child(2) { animation-delay: 0.15s; }
.evie-typing__dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes evie-dot-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ================================================================
   Quick Action Buttons - Glass Pills
   ================================================================ */
.evie-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 6px 0;
    animation: evie-msg-in 0.4s var(--evie-ease) both;
    animation-delay: 0.15s;
}

.evie-action-btn {
    padding: 12px 22px;
    border: 1px solid var(--evie-border-light);
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    color: var(--evie-text-secondary);
    font-family: var(--evie-font);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--evie-ease);
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.evie-action-btn:hover {
    background: rgba(241, 91, 38, 0.1);
    border-color: rgba(241, 91, 38, 0.3);
    color: var(--evie-text);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(241, 91, 38, 0.1);
}

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

/* ================================================================
   Input Area - BIG, Prominent, Impossible to Miss
   ================================================================ */
.evie-input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--evie-border);
    background: rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

/* Gradient line above input */
.evie-input-area::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
}

.evie-input-field {
    flex: 1;
    background: var(--evie-surface);
    border: 1.5px solid var(--evie-border-light);
    border-radius: 28px;
    padding: 16px 24px;
    color: var(--evie-text);
    font-family: var(--evie-font);
    font-size: 16px;
    line-height: 1.4;
    outline: none;
    transition: all 0.3s ease;
    min-height: 54px;
}

.evie-input-field::placeholder {
    color: var(--evie-text-muted);
    font-size: 15px;
}

.evie-input-field:focus {
    border-color: var(--evie-primary);
    box-shadow: 0 0 0 3px rgba(241, 91, 38, 0.12);
    background: var(--evie-surface-light);
}

.evie-send-btn {
    width: 54px;
    height: 54px;
    min-width: 54px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--evie-primary), #d94a18);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--evie-ease);
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(241, 91, 38, 0.3);
}

.evie-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(241, 91, 38, 0.4);
}

.evie-send-btn:active {
    transform: scale(0.95);
}

.evie-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.evie-send-btn svg {
    width: 22px;
    height: 22px;
}

/* ================================================================
   Powered By Footer
   ================================================================ */
.evie-powered {
    text-align: center;
    padding: 10px;
    font-size: 11px;
    color: var(--evie-text-muted);
    background: rgba(0, 0, 0, 0.15);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.evie-powered a {
    color: var(--evie-primary);
    text-decoration: none;
    font-weight: 600;
}

.evie-powered a:hover {
    text-decoration: underline;
}

/* ================================================================
   Submitting State
   ================================================================ */
.evie-submitting {
    text-align: center;
    padding: 12px;
    color: var(--evie-text-muted);
    font-size: 13px;
    font-style: italic;
}

/* ================================================================
   Mobile Responsive - Full Screen Takeover
   ================================================================ */
@media (max-width: 480px) {
    #evie-chatbot-widget {
        bottom: 16px;
        right: 16px;
    }

    .evie-toggle-btn {
        width: 60px;
        height: 60px;
    }

    .evie-toggle-btn svg {
        width: 26px;
        height: 26px;
    }

    .evie-chat-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .evie-header {
        padding: 18px 20px;
        padding-top: max(18px, env(safe-area-inset-top));
    }

    .evie-messages {
        padding: 20px;
    }

    .evie-message {
        max-width: 90%;
    }

    .evie-message__bubble {
        padding: 20px 24px;
        font-size: 15px;
    }

    .evie-input-area {
        padding: 16px 20px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .evie-input-field {
        padding: 16px 22px;
        font-size: 16px;
        min-height: 52px;
    }

    .evie-send-btn {
        width: 50px;
        height: 50px;
        min-width: 50px;
    }

    .evie-action-btn {
        padding: 10px 18px;
        font-size: 13px;
    }
}

/* ================================================================
   Tablet
   ================================================================ */
@media (min-width: 481px) and (max-width: 768px) {
    .evie-chat-panel {
        width: 380px;
        height: 580px;
    }
}

/* ================================================================
   Reduced Motion
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
    .evie-toggle-btn,
    .evie-chat-panel,
    .evie-message,
    .evie-actions,
    .evie-action-btn,
    .evie-typing__dot {
        animation: none !important;
        transition-duration: 0.15s !important;
    }

    .evie-toggle-btn::before {
        animation: none !important;
        display: none;
    }
}

/* ================================================================
   Focus States for Accessibility
   ================================================================ */
.evie-toggle-btn:focus-visible,
.evie-close-btn:focus-visible,
.evie-send-btn:focus-visible,
.evie-action-btn:focus-visible {
    outline: 2px solid var(--evie-primary);
    outline-offset: 3px;
}

.evie-input-field:focus-visible {
    outline: none;
}

/* ================================================================
   Hide reCAPTCHA badge globally
   ================================================================ */
.grecaptcha-badge,
body .grecaptcha-badge,
iframe[title="reCAPTCHA"] {
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}
