/* Chat Widget Styles */
#chat-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Montserrat', 'Raleway', system-ui, sans-serif;
}

/* Chat Icon */
.chat-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4F8F84, #3A756A);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(79, 143, 132, 0.4);
    transition: all 0.3s ease;
    position: relative;
    z-index: 10001;
}

.chat-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(79, 143, 132, 0.6);
}

.chat-icon:active {
    transform: scale(0.95);
}

.chat-icon .fa-comments {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: 90vw;
    height: 500px;
    max-height: 70vh;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-window.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #4F8F84, #3A756A);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chat-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    margin: 2px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.online {
    background: #4CAF50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 5px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.chat-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    padding: 5px;
    line-height: 1;
}

.chat-close-btn:hover {
    opacity: 1;
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8faf9;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Hide scrollbar but keep functionality */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(79, 143, 132, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(79, 143, 132, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(79, 143, 132, 0.5);
}

/* Message Styles */
.message-user,
.message-bot,
.message-agent {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: messageAppear 0.3s ease;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-user {
    align-self: flex-end;
}

.message-bot,
.message-agent {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.5;
}

.message-user .message-content {
    background: linear-gradient(135deg, #4F8F84, #7FB7AE);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bot .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message-agent .message-content {
    background: linear-gradient(135deg, #F26A8D, #FF8CA8);
    color: white;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    padding: 0 8px;
}

.message-user .message-time {
    text-align: right;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    margin-bottom: 10px;
}

.welcome-message .message-content {
    background: white;
    border: 2px dashed rgba(79, 143, 132, 0.3);
}

.suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.suggestion-btn {
    background: rgba(79, 143, 132, 0.1);
    border: 1px solid rgba(79, 143, 132, 0.2);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    color: #4F8F84;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.suggestion-btn:hover {
    background: rgba(79, 143, 132, 0.2);
    transform: translateY(-2px);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #888;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input Area */
.chat-input-area {
    border-top: 1px solid #e0e0e0;
    padding: 15px 20px;
    background: white;
    flex-shrink: 0;
}

.input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
    resize: none;
    max-height: 100px;
    min-height: 20px;
    line-height: 1.5;
}

#chat-input:focus {
    border-color: #4F8F84;
}

.send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #4F8F84, #7FB7AE);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(79, 143, 132, 0.3);
}

.send-btn:active {
    transform: scale(0.95);
}

.input-hint {
    text-align: center;
    margin-top: 8px;
}

.input-hint small {
    color: #888;
    font-size: 11px;
}

/* Transfer Notice */
.transfer-notice {
    background: rgba(79, 143, 132, 0.1);
    border: 1px solid rgba(79, 143, 132, 0.3);
    border-radius: 10px;
    padding: 15px;
    margin: 10px 0;
    text-align: center;
}

.transfer-notice p {
    margin: 0 0 10px 0;
    color: #4F8F84;
    font-weight: 500;
}

.transfer-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.transfer-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.transfer-btn.yes {
    background: #4F8F84;
    color: white;
}

.transfer-btn.no {
    background: #f0f0f0;
    color: #666;
}

.transfer-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    #chat-widget-container {
        bottom: 20px;
        right: 20px;
    }
    
    .chat-window {
        width: calc(100vw - 40px);
        height: 60vh;
        max-width: none;
        max-height: none;
        bottom: 70px;
        right: 0;
    }
    
    .chat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .message-user,
    .message-bot,
    .message-agent {
        max-width: 90%;
    }
}

/* Accessibility */
#chat-input:focus,
.send-btn:focus,
.chat-close-btn:focus,
.suggestion-btn:focus,
.transfer-btn:focus {
    outline: 2px solid #4F8F84;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    #chat-widget-container {
        display: none !important;
    }
}


.system-message {
    text-align: center;
    margin: 10px 0;
    font-size: 12px;
    color: #666;
}

.system-message.error {
    color: #e74c3c;
    font-weight: bold;
}

.system-message.info {
    color: #3498db;
}

/* Enhanced chat styles */
.message.bot-message {
    background: linear-gradient(135deg, #4F8F84 0%, #3a6b61 100%);
    color: white;
    border-radius: 20px 20px 20px 5px;
    margin: 10px 50px 10px 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(79, 143, 132, 0.2);
    position: relative;
    animation: slideIn 0.3s ease-out;
}

.message.bot-message p {
    margin: 10px 0;
    line-height: 1.6;
}

.message.bot-message p:first-child {
    margin-top: 0;
}

.message.bot-message p:last-child {
    margin-bottom: 0;
}

.message.bot-message strong {
    color: #ffd700;
    font-weight: 600;
}

.message.bot-message em {
    font-style: italic;
    opacity: 0.9;
}

.message.bot-message .numbered-item {
    margin: 8px 0;
    padding-left: 20px;
    position: relative;
}

.message.bot-message .numbered-item:before {
    content: attr(data-number);
    position: absolute;
    left: 0;
    top: 0;
    color: #ffd700;
    font-weight: bold;
}

.message.bot-message a {
    color: #ffd700;
    text-decoration: underline;
    transition: opacity 0.3s;
}

.message.bot-message a:hover {
    opacity: 0.8;
}

/* Animation for new messages */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 15px;
    margin: 10px 50px 10px 15px;
    background: linear-gradient(135deg, #4F8F84 0%, #3a6b61 100%);
    border-radius: 20px 20px 20px 5px;
    color: white;
}

.typing-dots {
    display: flex;
    gap: 4px;
    margin-left: 10px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Quick response buttons */
.quick-responses {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 50px 15px 15px;
}

.quick-response-btn {
    background: rgba(79, 143, 132, 0.1);
    border: 2px solid #4F8F84;
    color: #4F8F84;
    padding: 8px 16px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.quick-response-btn:hover {
    background: #4F8F84;
    color: white;
    transform: translateY(-2px);
}

/* Chat suggestions */
.chat-suggestions {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin: 20px;
    border: 1px solid #e9ecef;
}

.chat-suggestions h4 {
    color: #4F8F84;
    margin-bottom: 15px;
    font-size: 16px;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.suggestion-btn {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.suggestion-btn:hover {
    background: #4F8F84;
    color: white;
    border-color: #4F8F84;
    transform: translateY(-2px);
}

/* Enhanced input area */
.chat-input-enhanced {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 25px;
    padding: 10px 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

.chat-input-enhanced input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px;
    font-size: 16px;
}

.input-actions {
    display: flex;
    gap: 10px;
}

.input-action-btn {
    background: none;
    border: none;
    color: #4F8F84;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.3s;
}

.input-action-btn:hover {
    color: #3a6b61;
}