/* Chatbot Container */
#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Chatbot Icon */
#chatbot-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

#chatbot-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
    100% {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }
}

/* Chatbot Window */
#chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

#chatbot-window.show {
    display: flex !important;
}

/* Header */
#chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chatbot-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

#chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Messages Area */
#chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

#chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chatbot-messages::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 3px;
}

#chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #b0b0b0;
}

/* Message Styles */
.user-message, .bot-message {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.user-message {
    align-items: flex-end;
}

.bot-message {
    align-items: flex-start;
}

.user-message p, .bot-message p {
    background: #667eea;
    color: white;
    padding: 12px 16px;
    border-radius: 18px;
    margin: 0;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.bot-message p {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-time {
    font-size: 11px;
    color: #888;
    margin-top: 5px;
    padding: 0 5px;
}

/* Calculator Link */
.calculator-link {
    margin-top: 10px;
}

.calc-link-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.calc-link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
    text-decoration: none;
    color: white;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots 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;
    }
}

.typing-indicator p {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #999 !important;
    font-style: italic;
    font-size: 12px;
}

/* Input Area - ENHANCED VERSION */
#chatbot-input-area {
    display: flex !important;
    padding: 20px !important;
    background: #ffffff !important;
    border-top: 2px solid #e0e0e0 !important;
    gap: 15px !important;
    position: relative !important;
    z-index: 10 !important;
    min-height: 90px !important;
    align-items: center !important;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1) !important;
    flex-shrink: 0 !important;
}

#chatbot-input {
    flex: 1 !important;
    border: 3px solid #d0d0d0 !important;
    border-radius: 30px !important;
    padding: 18px 25px !important;
    outline: none !important;
    font-size: 16px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    transition: all 0.3s ease !important;
    min-height: 24px !important;
    height: 60px !important;
    background: #f8f9fa !important;
    color: #333 !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
    resize: none !important;
    word-wrap: break-word !important;
}

#chatbot-input:focus {
    border-color: #667eea !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.2) !important;
    transform: translateY(-2px) !important;
}

#chatbot-input::placeholder {
    color: #888 !important;
    font-style: normal !important;
    font-size: 15px !important;
    font-weight: 400 !important;
}

#chatbot-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 30px !important;
    padding: 18px 35px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    min-height: 60px !important;
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    text-transform: uppercase !important;
    min-width: 100px !important;
}

#chatbot-send:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5) !important;
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4c96 100%) !important;
}

#chatbot-send:active {
    transform: translateY(-1px) !important;
}

/* Input Area - FIXED VERSION (Removed problematic CSS reset) */
#chatbot-container #chatbot-window #chatbot-input-area {
    display: flex !important;
    padding: 20px !important;
    background: #ffffff !important;
    border-top: 2px solid #e0e0e0 !important;
    gap: 15px !important;
    position: relative !important;
    z-index: 10 !important;
    min-height: 90px !important;
    align-items: center !important;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1) !important;
    flex-shrink: 0 !important;
}

#chatbot-container #chatbot-window #chatbot-input-area #chatbot-input {
    flex: 1 !important;
    border: 3px solid #d0d0d0 !important;
    border-radius: 30px !important;
    padding: 18px 25px !important;
    outline: none !important;
    font-size: 16px !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    transition: all 0.3s ease !important;
    min-height: 60px !important;
    height: 60px !important;
    max-height: 60px !important;
    background: #ffffff !important;
    color: #333333 !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
    word-wrap: break-word !important;
    width: auto !important;
    text-shadow: none !important;
    -webkit-text-fill-color: #333333 !important;
    -webkit-appearance: none !important;
}

#chatbot-container #chatbot-window #chatbot-input-area #chatbot-input:focus {
    border-color: #667eea !important;
    background: #ffffff !important;
    color: #333333 !important;
    box-shadow: 0 0 0 6px rgba(102, 126, 234, 0.2) !important;
    transform: translateY(-2px) !important;
    height: 60px !important;
    -webkit-text-fill-color: #333333 !important;
}

#chatbot-container #chatbot-window #chatbot-input-area #chatbot-input::placeholder {
    color: #999999 !important;
    font-style: normal !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    opacity: 1 !important;
    -webkit-text-fill-color: #999999 !important;
}

/* FORCE TEXT VISIBILITY - Override any theme conflicts */
#chatbot-input,
input#chatbot-input,
#chatbot-container input#chatbot-input,
#chatbot-window input#chatbot-input,
#chatbot-input-area input#chatbot-input {
    color: #333333 !important;
    background: #ffffff !important;
    -webkit-text-fill-color: #333333 !important;
    text-shadow: none !important;
    opacity: 1 !important;
}

#chatbot-input:focus,
input#chatbot-input:focus,
#chatbot-container input#chatbot-input:focus {
    color: #333333 !important;
    background: #ffffff !important;
    -webkit-text-fill-color: #333333 !important;
}

/* Ensure placeholder is visible but different from text */
#chatbot-input::placeholder,
input#chatbot-input::placeholder {
    color: #999999 !important;
    opacity: 0.7 !important;
    -webkit-text-fill-color: #999999 !important;
}

#chatbot-container #chatbot-window #chatbot-input-area #chatbot-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 30px !important;
    padding: 18px 35px !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    min-height: 60px !important;
    height: 60px !important;
    max-height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    text-transform: uppercase !important;
    min-width: 100px !important;
    width: auto !important;
}

#chatbot-container #chatbot-window #chatbot-input-area #chatbot-send:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5) !important;
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4c96 100%) !important;
}

#chatbot-container #chatbot-window #chatbot-input-area #chatbot-send:active {
    transform: translateY(-1px) !important;
}

#chatbot-container #chatbot-window #chatbot-input-area #chatbot-send:disabled,
#chatbot-container #chatbot-window #chatbot-input-area #chatbot-send.disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    transform: none !important;
    background: #cccccc !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

#chatbot-container #chatbot-window #chatbot-input-area #chatbot-send:disabled:hover,
#chatbot-container #chatbot-window #chatbot-input-area #chatbot-send.disabled:hover {
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    background: #cccccc !important;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #chatbot-container {
        bottom: 10px;
        right: 10px;
    }
    
    #chatbot-window {
        width: calc(100vw - 20px) !important;
        height: 500px !important;
        bottom: 70px;
        right: -10px;
    }
    
    #chatbot-icon {
        width: 50px;
        height: 50px;
    }
    
    #chatbot-input-area {
        padding: 15px !important;
        min-height: 80px !important;
        gap: 12px !important;
    }
    
    #chatbot-input {
        padding: 15px 20px !important;
        height: 50px !important;
        min-height: 20px !important;
        font-size: 16px !important;
        border-radius: 25px !important;
        border-width: 2px !important;
    }
    
    #chatbot-input:focus {
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2) !important;
    }
    
    #chatbot-send {
        padding: 15px 25px !important;
        height: 50px !important;
        min-height: 50px !important;
        font-size: 15px !important;
        border-radius: 25px !important;
        min-width: 80px !important;
    }
    
    .user-message p, .bot-message p {
        max-width: 90%;
        font-size: 13px;
    }
}

/* Tablet Responsiveness */
@media (max-width: 768px) and (min-width: 481px) {
    #chatbot-window {
        width: 360px !important;
        height: 520px !important;
    }
    
    #chatbot-input-area {
        padding: 18px !important;
        min-height: 85px !important;
    }
    
    #chatbot-input {
        height: 55px !important;
        font-size: 16px !important;
        padding: 16px 22px !important;
    }
    
    #chatbot-send {
        height: 55px !important;
        padding: 16px 30px !important;
        min-width: 90px !important;
    }
}