/* Live Chat Overlay Styles - Exact Match to live.html */

.live-chat-overlay {
    position: absolute;
    top: var(--live-overlay-offset, 0);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    background: var(--main-bg, #0a0a0a);
    z-index: 900;
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: clamp(16px, 4vw, 40px);
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.live-chat-container {
    width: 100%;
    max-width: 1100px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: clamp(24px, 4vw, 48px);
    position: relative;
    z-index: 1;
    margin: 0 auto;
}

.live-chat-header {
    padding: 40px 20px 30px;
    text-align: center;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.live-chat-time {
    font-size: 15px;
    color: var(--text-faded, #888);
    font-weight: 400;
}

.live-chat-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--input-bg, rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(20px);
    border-radius: 25px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ffffff);
    font-size: 15px;
    font-weight: 500;
}

.live-chat-dot {
    width: 8px;
    height: 8px;
    background: #ff4757;
    border-radius: 50%;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0%, 100% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); 
    }
    50% { 
        opacity: 0.8; 
        box-shadow: 0 0 0 8px rgba(255, 71, 87, 0); 
    }
}

.live-chat-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 20;
}

.live-chat-close:hover {
    background: var(--nav-active-bg, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ffffff);
}

.live-chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Messages Container - Shown when messages exist */
.live-chat-messages-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    min-height: 0;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.live-chat-messages-container::-webkit-scrollbar {
    width: 8px;
}

.live-chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.live-chat-messages-container::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.2));
    border-radius: 4px;
}

.live-chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--bg-active, rgba(255, 255, 255, 0.3));
}

/* Voice Interface - Shown by default */
.live-chat-voice-interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
}

.live-chat-waveform-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 60px;
    width: 100%;
}

.live-chat-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 200px;
    position: relative;
    z-index: 2;
}

.live-chat-wave {
    width: 5px;
    background: linear-gradient(180deg, #00d4ff 0%, #7b2ff7 100%);
    border-radius: 10px;
    transition: height 0.1s ease;
}

.live-chat-glow-orb {
    display: none;
}

@keyframes orbPulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 0.5; 
    }
    50% { 
        transform: scale(1.15); 
        opacity: 0.7; 
    }
}

.live-chat-status-container {
    text-align: center;
    padding: 0 30px;
}

.live-chat-status-text {
    font-size: 24px;
    color: var(--text-primary, #ffffff);
    font-weight: 500;
    margin-bottom: 12px;
    opacity: 0.95;
    display: none !important; /* Hidden for clean UI */
}

.live-chat-status-subtext {
    font-size: 15px;
    color: var(--text-faded, #888);
    line-height: 1.6;
    display: none !important; /* Hidden for clean UI */
}

.live-chat-listening-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 8px 18px;
    background: var(--input-bg, rgba(0, 212, 255, 0.1));
    border-radius: 20px;
    border: 1px solid var(--border-color, rgba(0, 212, 255, 0.3));
}

.live-chat-listening-text {
    font-size: 13px;
    color: var(--accent, #00d4ff);
    font-weight: 500;
}

.live-chat-controls {
    margin-top: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.live-chat-control-button {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    background: var(--input-main-bg, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #fff);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.live-chat-control-button:hover {
    transform: translateY(-2px);
    border-color: var(--accent, rgba(255, 255, 255, 0.4));
}

.live-chat-control-button.danger {
    background: rgba(255, 77, 79, 0.15);
    border-color: rgba(255, 77, 79, 0.5);
    color: #ff6b6f;
}

.live-chat-control-button.danger:hover {
    background: rgba(255, 77, 79, 0.25);
}

.live-chat-control-button.responding,
.live-chat-control-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.live-chat-control-button.responding .live-chat-control-label {
    color: var(--text-tertiary, #aaa);
}

.live-chat-control-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.live-chat-control-icon svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.live-chat-control-icon .icon-play {
    display: none;
}

.live-chat-control-button.paused .icon-pause {
    display: none;
}

.live-chat-control-button.paused .icon-play {
    display: block;
}

.live-chat-control-label {
    font-size: 11px;
    letter-spacing: 0.02em;
}

.live-chat-control-button.paused .live-chat-control-icon svg {
    transition: transform 0.2s ease;
}

.live-chat-control-button.paused .live-chat-control-label {
    color: var(--accent, #ffc400);
}

.live-chat-listening-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 8px 18px;
    background: var(--input-bg, rgba(0, 212, 255, 0.1));
    border-radius: 20px;
    border: 1px solid var(--border-color, rgba(0, 212, 255, 0.3));
}

.live-chat-listening-dot {
    width: 6px;
    height: 6px;
    background: var(--accent, #00d4ff);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.8); }
}

.live-chat-listening-text {
    font-size: 13px;
    color: var(--accent, #00d4ff);
    font-weight: 500;
}

/* Message Styles */
.live-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.live-chat-message-user {
    align-self: flex-end;
    align-items: flex-end;
}

.live-chat-message-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.live-chat-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 14px;
}

.live-chat-message-user .live-chat-message-content {
    background: var(--input-main-bg, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ffffff);
    border-bottom-right-radius: 4px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.live-chat-message-assistant .live-chat-message-content {
    background: var(--input-bg, rgba(255, 255, 255, 0.05));
    color: var(--text-primary, #ffffff);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.live-typing-indicator {
    display: inline-block;
    animation: typing 1.4s infinite;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* Live Chat Button in Input Container */
.live-chat-button {
    background: transparent;
    border: none;
    color: var(--text-secondary, rgba(255, 255, 255, 0.6));
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

.live-chat-button:hover {
    background: var(--nav-active-bg, rgba(255, 255, 255, 0.1));
    color: var(--text-primary, #ffffff);
}

.live-chat-button svg {
    width: 18px;
    height: 18px;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .live-chat-container {
        max-width: 1200px;
        padding: 48px;
    }

    .live-chat-waveform {
        height: 250px;
        gap: 6px;
    }

    .live-chat-wave {
        width: 6px;
    }

    .live-chat-status-text {
        font-size: 28px;
    }

    .live-chat-status-subtext {
        font-size: 16px;
    }

}

@media (min-width: 1024px) {
    .live-chat-container {
        max-width: 1300px;
        border-radius: 32px;
        background: var(--main-bg, rgba(10, 10, 10, 0.85));
        backdrop-filter: blur(20px);
    }

    .live-chat-waveform {
        height: 280px;
        gap: 7px;
    }

    .live-chat-wave {
        width: 7px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .live-chat-container {
        padding: 20px;
    }
    
    .live-chat-header {
        padding: 30px 20px 20px;
    }
    
    .live-chat-messages-container {
        padding: 16px;
        padding-top: 60px;
        padding-bottom: calc(140px + env(safe-area-inset-bottom));
    }
    
    .live-chat-message {
        max-width: 85%;
    }
}
