/**
 * Chat Agent CSS
 * Premium styling for conversion-focused chat widget
 */

/* Chat Widget Container */
#chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Toggle Button */
.chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    outline: none;
    box-shadow: none;
}

.chat-toggle:focus {
    outline: none;
    box-shadow: none;
}

.chat-toggle img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.chat-toggle:hover img {
    transform: scale(1.06);
}

.chat-toggle.active {
    transform: rotate(90deg);
}

/* Chat Container */
.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: 500px;
    max-height: 70vh;
    background: var(--cinematic-glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--cinematic-glass-border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: chat-slide-up 0.3s ease-out;
}

@keyframes chat-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--cinematic-glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 18, 30, 0.8);
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--cinematic-text-white);
}

.chat-close {
    background: none;
    border: none;
    color: var(--cinematic-text-light);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

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

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

/* Message Styles */
.chat-message {
    max-width: 80%;
    animation: message-fade-in 0.3s ease-out;
}

@keyframes message-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.agent-message {
    align-self: flex-start;
}

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

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.agent-message .message-content {
    background: rgba(255, 255, 255, 0.1);
    color: var(--cinematic-text-white);
    border-top-left-radius: 4px;
}

.user-message .message-content {
    background: linear-gradient(135deg, var(--cinematic-gold-light), var(--cinematic-gold-dark));
    color: var(--cinematic-dark);
    border-top-right-radius: 4px;
}

/* Typing Indicator */
.typing-indicator .message-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cinematic-text-light);
    animation: typing-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input Area */
.chat-input {
    padding: 20px;
    border-top: 1px solid var(--cinematic-glass-border);
    background: rgba(15, 18, 30, 0.8);
}

/* Options Container */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-button {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--cinematic-glass-border);
    border-radius: 12px;
    color: var(--cinematic-text-white);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.option-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.option-button:active {
    transform: translateY(0);
}

/* Email Input */
.email-input-container {
    display: flex;
    gap: 10px;
}

.email-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--cinematic-glass-border);
    border-radius: 12px;
    color: var(--cinematic-text-white);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
}

.email-input:focus {
    outline: none;
    border-color: var(--cinematic-gold-light);
    background: rgba(255, 255, 255, 0.15);
}

.email-input::placeholder {
    color: var(--cinematic-text-light);
    opacity: 0.7;
}

.email-submit {
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--cinematic-gold-light), var(--cinematic-gold-dark));
    border: none;
    border-radius: 12px;
    color: var(--cinematic-dark);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.email-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(245, 196, 108, 0.4);
}

.email-submit:active {
    transform: translateY(0);
}

/* CTA Container */
.cta-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cta-primary {
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--cinematic-gold-light), var(--cinematic-gold-dark));
    border: none;
    border-radius: 12px;
    color: var(--cinematic-dark);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.cta-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 196, 108, 0.5);
}

.cta-secondary {
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--cinematic-glass-border);
    border-radius: 12px;
    color: var(--cinematic-text-white);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.cta-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

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

/* Hidden Class */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 480px) {
    #chat-widget {
        bottom: 20px;
        right: 20px;
    }
    
    .chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .chat-container {
        width: calc(100vw - 40px);
        max-width: none;
        bottom: 70px;
        right: 0;
        height: 60vh;
    }
    
    .chat-header {
        padding: 16px;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .chat-input {
        padding: 16px;
    }
    
    .email-input-container {
        flex-direction: column;
    }
    
    .cta-container {
        flex-direction: column;
    }
}

/* Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    .chat-toggle,
    .option-button,
    .email-submit,
    .cta-primary,
    .cta-secondary {
        transition: none;
    }
    
    .chat-container {
        animation: none;
    }
    
    .chat-message {
        animation: none;
    }
    
    .typing-dot {
        animation: none;
    }
}

/* Chat Icon Styling */
.chat-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    display: block;
}

/* Entrance Animation */
.chat-toggle {
    animation: fadeInUp 0.5s ease;
}

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

/* Mobile Safety */
@media (max-width: 480px) {
    .chat-toggle {
        bottom: 20px;
        right: 16px;
    }
}
