/* ===================================
   Greenhill Media - AI Assistant UI (Polish v2)
   =================================== */

:root {
    --chat-width: 400px;
    --chat-height: 620px;
    --chat-bg: rgba(13, 17, 23, 0.9);
    --chat-border: rgba(255, 255, 255, 0.08);
    --chat-border-bright: rgba(255, 255, 255, 0.15);
    --chat-accent: #10B981; /* Sharper Emerald */
    --chat-accent-deep: #059669;
    --chat-accent-glow: rgba(16, 185, 129, 0.2);
    --chat-text-main: #F9FAFB;
    --chat-text-muted: #9CA3AF;
    --chat-radius: var(--radius-lg);
    --chat-shadow-deep: 0 30px 60px -12px rgba(0, 0, 0, 0.6), 0 18px 36px -18px rgba(0, 0, 0, 0.7);
}

/* Base Polish */
.chat-trigger, .whatsapp-fab, .chat-panel {
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* WhatsApp FAB - Premium Branded */
.whatsapp-fab {
    position: fixed;
    bottom: 40px;
    left: 40px;
    z-index: 1000;
    width: 56px;
    height: 56px;
    background: #075E54; /* Darker, more professional WhatsApp green */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--chat-radius);
    color: #25D366; /* Bright green for the icon only */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.2, 1, 0.3, 1);
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.whatsapp-fab::after {
    content: '';
    position: absolute;
    inset: -2px;
    border: 1px solid rgba(37, 211, 102, 0.2);
    border-radius: calc(var(--chat-radius) + 2px);
    opacity: 0;
    transition: opacity 0.3s;
}

.whatsapp-fab:hover {
    transform: translateY(-5px);
    background: #128C7E;
    color: white;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px rgba(37, 211, 102, 0.2);
}

.whatsapp-fab:hover::after {
    opacity: 1;
}

.whatsapp-fab svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
}

/* Assistant Trigger - Minimalist Pro */
.chat-trigger {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 1000;
    padding: 14px 28px;
    background: #111827;
    color: white;
    border-radius: var(--chat-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    letter-spacing: 0.02em;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.2, 1, 0.3, 1);
    border: 1px solid var(--chat-border);
}

.chat-trigger::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}

.chat-trigger:hover {
    transform: translateY(-4px);
    border-color: var(--chat-accent);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 15px var(--chat-accent-glow);
}

.chat-trigger .status-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-accent);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--chat-accent);
    position: relative;
}

/* Chat Panel - Enterprise Glass */
.chat-panel {
    position: fixed;
    bottom: 115px;
    right: 40px;
    width: var(--chat-width);
    height: var(--chat-height);
    background: var(--chat-bg);
    backdrop-filter: blur(30px) saturate(150%);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: var(--chat-shadow-deep);
    transform: translateY(30px) scale(0.98);
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

/* Grain Texture Overlay */
.chat-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Cfilter id='noiseFilter'%3%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3%3C/filter%3%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3%3C/svg%3");
    opacity: 0.03;
    pointer-events: none;
}

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

.chat-header {
    padding: 24px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--chat-text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.01em;
}

.chat-header h3 span {
    filter: grayscale(0.2);
}

.close-chat {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--chat-text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--chat-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: var(--chat-border-bright);
}

/* Messages - Professional Hierarchy */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    max-width: 80%;
    padding: 14px 18px;
    border-radius: var(--chat-radius);
    font-size: 0.9rem;
    line-height: 1.6;
    position: relative;
    opacity: 0;
    transform: translateY(10px);
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.03);
    color: var(--chat-text-main);
    border: 1px solid var(--chat-border);
    border-left: 2px solid var(--chat-accent);
}

.message.user {
    align-self: flex-end;
    background: #1F2937;
    color: white;
    border: 1px solid var(--chat-border-bright);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Input Area - Clean & Sharp */
.chat-input-area {
    padding: 20px 24px 28px;
    background: rgba(0, 0, 0, 0.2);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
}

.chat-input-wrapper input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--chat-border);
    border-radius: var(--chat-radius);
    padding: 12px 16px;
    color: white;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s;
}

.chat-input-wrapper input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--chat-accent);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.send-btn {
    background: var(--chat-accent);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--chat-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.2, 1, 0.3, 1);
}

.send-btn:hover {
    background: var(--chat-accent-deep);
    transform: scale(1.05);
}

/* Animations JS will trigger */
.message.reveal {
    animation: messageReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes messageReveal {
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile Polish */
@media (max-width: 480px) {
    .chat-panel {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .chat-trigger {
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-fab {
        bottom: 20px;
        left: 20px;
    }
}
