/* UpLiftTeck AI Chatbot - Futuristic Design */

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    font-family: 'Roboto', sans-serif;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00CFFD 0%, #007DA3 100%);
    border: 2px solid #00CFFD;
    box-shadow: 
        0 8px 25px rgba(0, 207, 253, 0.3),
        0 0 20px rgba(0, 207, 253, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    margin-bottom: 80px; /* Space for scroll-to-top button */
}

.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, #00CFFD, transparent);
    animation: rotate 3s linear infinite;
    opacity: 0.7;
}

.chatbot-toggle::after {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00CFFD 0%, #007DA3 100%);
}

@keyframes rotate {
    to {
        transform: rotate(360deg);
    }
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 
        0 12px 35px rgba(0, 207, 253, 0.4),
        0 0 30px rgba(0, 207, 253, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.chatbot-toggle-icon {
    position: relative;
    z-index: 1;
    color: #ffffff;
    font-size: 24px;
    transition: all 0.3s ease;
}

.chatbot-toggle.active .chatbot-toggle-icon {
    transform: rotate(45deg);
}

/* Chatbot Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    max-height: 500px;
    background: linear-gradient(145deg, #0D1B2A 0%, #1B263B 100%);
    border-radius: 20px;
    border: 1px solid #00CFFD;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 207, 253, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(90deg, #00CFFD 0%, #007DA3 100%);
    padding: 15px 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: visible;
    flex-shrink: 0;
    z-index: 1;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shine 3s infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes shine {
    0% { left: -100%; }
    50% { left: 100%; }
    100% { left: 100%; }
}

.chatbot-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.chatbot-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00ff88;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 50%;
    transition: all 0.2s ease;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
}

.chatbot-close i {
    display: block;
    font-size: 18px;
    line-height: 1;
    color: #ffffff;
    z-index: 101;
    position: relative;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: scale(1.1);
}

.chatbot-close:active {
    background: rgba(255, 255, 255, 0.4) !important;
    transform: scale(0.95);
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #00CFFD, #007DA3);
    border-radius: 3px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    animation: messageSlide 0.3s ease-out;
}

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

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #00CFFD 0%, #007DA3 100%);
    color: #ffffff;
    border-bottom-right-radius: 5px;
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    color: #E0E6ED;
    border: 1px solid rgba(0, 207, 253, 0.2);
    border-bottom-left-radius: 5px;
    position: relative;
}

.message.bot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #00CFFD, transparent);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    max-width: 80px;
    align-self: flex-start;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00CFFD;
    animation: typingDot 1.4s infinite ease-in-out;
}

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chatbot Input */
.chatbot-input-container {
    padding: 15px 20px;
    border-top: 1px solid rgba(0, 207, 253, 0.2);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 207, 253, 0.3);
    border-radius: 25px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.chatbot-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.chatbot-input:focus {
    border-color: #00CFFD;
    box-shadow: 0 0 15px rgba(0, 207, 253, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00CFFD 0%, #007DA3 100%);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
}

.chatbot-send:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(0, 207, 253, 0.4);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    color: #A9BCD0;
    font-size: 13px;
    padding: 20px;
    line-height: 1.5;
}

.welcome-message .brand {
    color: #00CFFD;
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-window {
        width: calc(100vw - 30px);
        max-width: 350px;
        height: calc(100vh - 30px);
        max-height: calc(100vh - 30px);
        bottom: 15px;
        right: 0;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
    }
    
    .chatbot-messages {
        flex: 1;
        min-height: 0;
        height: auto;
        overflow-y: auto;
    }
    
    .chatbot-toggle {
        width: 55px;
        height: 55px;
        margin-bottom: 70px;
    }
    
    .chatbot-toggle-icon {
        font-size: 22px;
    }
    
    .chatbot-input-container {
        flex-shrink: 0;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        position: fixed !important;
        bottom: 10px !important;
        right: 10px !important;
        left: auto !important;
        z-index: 999 !important;
    }
    
    .chatbot-toggle {
        position: relative !important;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px) !important;
        height: 70vh !important;
        max-height: 600px !important;
        min-height: 400px !important;
        bottom: 10px !important;
        top: auto !important;
        right: 10px !important;
        left: auto !important;
        transform: translateY(20px) scale(0.95) !important;
        margin: 0 !important;
        border-radius: 15px;
        position: fixed !important;
        box-sizing: border-box !important;
        z-index: 10000 !important;
    }
    
    .chatbot-window.active {
        transform: translateY(0) scale(1) !important;
    }
    
    .chatbot-close {
        z-index: 10001 !important;
        position: relative !important;
        pointer-events: auto !important;
        background: rgba(255, 255, 255, 0.2) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    
    .chatbot-close i {
        display: block !important;
        font-size: 20px !important;
        color: #ffffff !important;
        z-index: 10002 !important;
        position: relative !important;
    }
    
    .chatbot-messages {
        padding: 15px;
        flex: 1;
        min-height: 0;
        max-height: none;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .message {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .chatbot-header {
        padding: 12px 15px;
        flex-shrink: 0;
        min-height: 50px;
    }
    
    .chatbot-title {
        font-size: 14px;
    }
    
    .chatbot-input-container {
        padding: 10px 12px !important;
        flex-shrink: 0 !important;
        position: relative !important;
        z-index: 10;
        min-height: 60px;
        box-sizing: border-box;
    }
    
    .chatbot-input {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    .chatbot-send {
        width: 36px;
        height: 36px;
        font-size: 14px;
        flex-shrink: 0;
    }
}

/* Extra small devices and landscape mobile */
@media (max-width: 480px) and (max-height: 600px) {
    .chatbot-window {
        height: 65vh !important;
        max-height: 500px !important;
        min-height: 350px !important;
        bottom: 10px !important;
    }
}

/* Very small screens */
@media (max-width: 480px) and (max-height: 500px) {
    .chatbot-window {
        height: 60vh !important;
        max-height: 450px !important;
        min-height: 300px !important;
        bottom: 10px !important;
    }
    
    .chatbot-messages {
        padding: 10px;
    }
    
    .chatbot-input-container {
        padding: 8px 10px !important;
        min-height: 55px;
    }
}

/* Safe area support for devices with notches */
@supports (padding: max(0px)) {
    @media (max-width: 480px) {
        .chatbot-container {
            bottom: max(10px, env(safe-area-inset-bottom));
            right: max(10px, env(safe-area-inset-right));
            left: max(10px, env(safe-area-inset-left));
        }
        
        .chatbot-window {
            bottom: max(70px, calc(60px + env(safe-area-inset-bottom)));
        }
    }
}
