/**
 * Puffin Group Live Chatbot Styles
 * Modern, responsive chatbot interface
 */

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Manrope', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4E91DA 0%, #6BAD43 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(78, 145, 218, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(78, 145, 218, 0.4);
}

.chatbot-toggle svg {
    color: white;
    transition: all 0.3s ease;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FF4757;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    animation: bounce 1s infinite;
}

/* Pulse Animation */
@keyframes pulse {
    0% {
        box-shadow: 0 8px 25px rgba(78, 145, 218, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(78, 145, 218, 0.5), 0 0 0 10px rgba(78, 145, 218, 0.1);
    }
    100% {
        box-shadow: 0 8px 25px rgba(78, 145, 218, 0.3);
    }
}

/* Bounce Animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Chatbot Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #4E91DA 0%, #6BAD43 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chatbot-avatar img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.chatbot-info {
    flex: 1;
}

.chatbot-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-info .status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-info .status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse-status 2s infinite;
}

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

.chatbot-actions {
    display: flex;
    gap: 8px;
}

.minimize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    transition: background 0.2s ease;
}

.minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #f8f9fa;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

/* Message Styles */
.message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

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

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-avatar img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.bot-message .message-text {
    background: white;
    color: #333;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.user-message .message-text {
    background: linear-gradient(135deg, #4E91DA 0%, #6BAD43 100%);
    color: white;
    border-bottom-right-radius: 6px;
}

.message-time {
    font-size: 11px;
    color: #999;
    padding: 0 4px;
}

.bot-message .message-time {
    text-align: left;
}

.user-message .message-time {
    text-align: right;
}

/* Quick Actions */
.chatbot-quick-actions {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-action-btn {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #495057;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: #4E91DA;
    color: white;
    border-color: #4E91DA;
    transform: translateY(-1px);
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: white;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #4E91DA;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Area */
.chatbot-input-area {
    background: white;
    border-top: 1px solid #eee;
}

.input-container {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

#chatbot-input {
    flex: 1;
    border: 1px solid #e9ecef;
    border-radius: 25px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: #f8f9fa;
}

#chatbot-input:focus {
    border-color: #4E91DA;
    background: white;
}

#chatbot-input::placeholder {
    color: #999;
}

.send-btn {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #4E91DA 0%, #6BAD43 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(78, 145, 218, 0.3);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 120px);
        bottom: 80px;
        right: -15px;
        border-radius: 15px;
    }
    
    .chatbot-toggle {
        width: 55px;
        height: 55px;
    }
    
    .chatbot-messages {
        padding: 15px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chatbot-quick-actions {
        padding: 12px 15px;
    }
    
    .input-container {
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        width: 100vw;
        height: 100vh;
        bottom: 0;
        right: -20px;
        border-radius: 0;
    }
    
    .chatbot-header {
        padding: 15px 20px;
    }
    
    .quick-action-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .chatbot-messages {
        background: #2d2d2d;
    }
    
    .bot-message .message-text {
        background: #3a3a3a;
        color: #e0e0e0;
    }
    
    .chatbot-quick-actions {
        background: #1a1a1a;
        border-top-color: #444;
    }
    
    .quick-action-btn {
        background: #3a3a3a;
        border-color: #555;
        color: #e0e0e0;
    }
    
    .chatbot-input-area {
        background: #1a1a1a;
        border-top-color: #444;
    }
    
    #chatbot-input {
        background: #3a3a3a;
        border-color: #555;
        color: #e0e0e0;
    }
    
    #chatbot-input:focus {
        background: #2d2d2d;
        border-color: #4E91DA;
    }
    
    .typing-indicator {
        background: #1a1a1a;
    }
}

/* Accessibility */
.chatbot-toggle:focus,
.send-btn:focus,
.minimize-btn:focus,
.quick-action-btn:focus {
    outline: 2px solid #4E91DA;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .chatbot-toggle {
        border: 2px solid #000;
    }
    
    .chatbot-window {
        border: 2px solid #000;
    }
    
    .message-text {
        border: 1px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .chatbot-toggle,
    .chatbot-window,
    .message,
    .send-btn,
    .quick-action-btn {
        animation: none;
        transition: none;
    }
    
    .notification-badge {
        animation: none;
    }
    
    .typing-indicator span {
        animation: none;
    }
}