/* Chat Widget Styles */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: Arial, sans-serif;
}

/* Chat notification bubble */
.chat-notification {
    position: absolute;
    bottom: 70px;
    right: 10px;
    background: rgba(0, 65, 118, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 
        0 4px 16px rgba(0, 65, 118, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    transform: translateY(10px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    white-space: nowrap;
}

.chat-notification.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.chat-notification::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 15px;
    width: 10px;
    height: 10px;
    background: rgba(0, 65, 118, 0.95);
    transform: rotate(45deg);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--services-gradient-start), var(--services-gradient-end));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 
        0 8px 25px rgba(2, 114, 68, 0.25),
        0 4px 12px rgba(0, 65, 118, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.chat-button:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 
        0 12px 35px rgba(2, 114, 68, 0.35),
        0 6px 18px rgba(0, 65, 118, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chat-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 16px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.chat-popup.expanded {
    width: 600px;
    height: 700px;
    bottom: 50px;
    right: 50px;
}

.chat-popup.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

.chat-header {
    background: linear-gradient(135deg, 
        rgba(2, 114, 68, 0.7), 
        rgba(0, 65, 118, 0.7)
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.chat-header-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-expand, .chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.chat-expand:hover, .chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.4), 
        transparent
    );
}

.chat-title {
    font-weight: 600;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: rgba(248, 249, 250, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    position: relative;
}

/* Scroll to bottom indicator - positioned relative to chat-popup */
.scroll-to-bottom {
    position: absolute;
    bottom: 81px; /* Above the input container */
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(
        to top,
        rgba(248, 249, 250, 0.95) 0%,
        rgba(248, 249, 250, 0.6) 30%,
        rgba(248, 249, 250, 0.3) 60%,
        rgba(248, 249, 250, 0.1) 85%,
        transparent 100%
    );
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 12px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
    z-index: 10;
}

.scroll-to-bottom.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.scroll-to-bottom-label {
    background: linear-gradient(135deg, 
        rgba(2, 114, 68, 0.9), 
        rgba(0, 65, 118, 0.9)
    );
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 
        0 2px 12px rgba(0, 65, 118, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    white-space: nowrap;
    user-select: none;
}

.scroll-to-bottom:hover .scroll-to-bottom-label {
    background: linear-gradient(135deg, 
        rgba(2, 114, 68, 1), 
        rgba(0, 65, 118, 1)
    );
    transform: translateY(-1px);
    box-shadow: 
        0 4px 16px rgba(0, 65, 118, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chat-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.chat-message.bot {
    align-items: flex-start;
}

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

.message-bubble {
    max-width: 80%;
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.chat-message.bot .message-bubble {
    background: linear-gradient(135deg, 
        rgb(2, 114, 68), 
        rgb(0, 65, 118)
    );
    color: white;
    border-bottom-left-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-message.bot .message-bubble:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, 
        rgb(2, 114, 68), 
        rgb(0, 65, 118)
    );
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chat-message.user .message-bubble {
    background: rgb(30, 144, 255);
    color: white;
    border-bottom-right-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 4px 16px rgba(30, 144, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.chat-message.user .message-bubble:hover {
    transform: translateY(-1px);
    background: rgb(30, 144, 255);
    box-shadow: 
        0 6px 20px rgba(30, 144, 255, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* Formatting for bot message content */
.chat-message.bot .message-bubble p {
    margin: 0 0 12px 0;
}

.chat-message.bot .message-bubble p:last-child {
    margin-bottom: 0;
}

.chat-message.bot .message-bubble strong {
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.chat-message.bot .message-bubble ul {
    margin: 8px 0 12px 0;
    padding-left: 20px;
}

.chat-message.bot .message-bubble li {
    margin: 4px 0;
    line-height: 1.4;
}

.chat-message.bot .message-bubble br {
    line-height: 1.6;
}

.chat-input-container {
    padding: 20px 24px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    box-shadow: 
        0 -8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.chat-input-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.6), 
        transparent
    );
}

.chat-input {
    flex: 1;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 24px;
    padding: 14px 20px;
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.chat-input:focus {
    border: 1px solid rgba(0, 65, 118, 0.6);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 
        0 4px 16px rgba(0, 65, 118, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.chat-send {
    background: linear-gradient(135deg, 
        rgba(2, 114, 68, 0.9), 
        rgba(0, 65, 118, 0.9)
    );
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 12px rgba(0, 65, 118, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.chat-send:hover {
    transform: scale(1.05) translateY(-1px);
    background: linear-gradient(135deg, 
        rgba(2, 114, 68, 1), 
        rgba(0, 65, 118, 1)
    );
    box-shadow: 
        0 6px 16px rgba(0, 65, 118, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chat-send svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.typing-indicator {
    display: none;
    padding: 16px 20px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, 
        rgb(2, 114, 68), 
        rgb(0, 65, 118)
    );
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    border-bottom-left-radius: 8px;
    max-width: 80%;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    animation: typing 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 {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .chat-popup {
        width: calc(100vw - 40px) !important;
        height: calc(100vh - 120px) !important;
        bottom: 80px !important;
        right: 0 !important;
        left: auto !important;
        transform: translateX(-20px) !important;
        transition: none !important;
    }
    
    .chat-popup.expanded {
        width: calc(100vw - 40px) !important;
        height: calc(100vh - 120px) !important;
        bottom: 80px !important;
        right: 0 !important;
        transform: translateX(-20px) !important;
    }
    
    .chat-expand {
        display: none !important;
    }
    
    .chat-widget {
        bottom: 20px;
        right: 20px;
    }
}

/* Additional mobile breakpoint for smaller screens */
@media (max-width: 360px) {
    .chat-popup {
        width: calc(100vw - 20px);
        transform: translateX(-10px);
    }
    
    .chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    .chat-button {
        width: 50px;
        height: 50px;
    }
    
    .chat-button svg {
        width: 24px;
        height: 24px;
    }
}