/* ==================== VARIABLES CSS ==================== */
:root {
    --primary-blue: #2563eb;
    --primary-orange: #f97316;
    --bg-dark: #1a1a2e;
    --bg-light: #f8f9fa;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    color: var(--text-dark);
    background: var(--bg-light);
}

/* ==================== CHATBOT CONTAINER ==================== */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    transition: all 0.3s ease;
    animation: slideUp 0.4s ease;
}

.chatbot-container.closed {
    display: none;
    animation: slideDown 0.4s ease;
}

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

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

/* ==================== CHATBOT HEADER ==================== */
.chatbot-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1d4ed8 100%);
    color: var(--white);
    padding: 20px;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.header-title h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.header-title .status-text {
    font-size: 12px;
    opacity: 0.9;
    font-weight: 500;
}

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

.header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* ==================== MESSAGES CONTAINER ==================== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--white);
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ==================== MESSAGE STYLES ==================== */
.message {
    display: flex;
    animation: fadeIn 0.3s ease;
    max-width: 100%;
}

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

.bot-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-content {
    max-width: 85%;
    word-wrap: break-word;
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 14px;
}

.bot-message .message-content {
    background: var(--bg-light);
    color: var(--text-dark);
    border-left: 3px solid var(--primary-blue);
}

.user-message .message-content {
    background: var(--primary-blue);
    color: var(--white);
}

.message-content p {
    margin-bottom: 8px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul {
    margin-left: 20px;
    margin-top: 8px;
}

.message-content li {
    margin-bottom: 6px;
}

/* ==================== WELCOME MESSAGE ==================== */
.message.welcome .message-content {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(249, 115, 22, 0.05) 100%);
}

.quick-links {
    list-style: none;
    margin-left: 0;
    padding: 12px 0;
}

.quick-links li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.quick-links li:last-child {
    border-bottom: none;
}

.cta-text {
    font-weight: 600;
    margin-top: 12px;
    color: var(--primary-blue);
}

/* ==================== TYPING INDICATOR ==================== */
.typing-indicator {
    display: none;
    padding: 12px 16px;
    background: var(--bg-light);
    border-radius: 12px;
    width: fit-content;
    margin-left: 0;
    border-left: 3px solid var(--primary-blue);
}

.typing-indicator.active {
    display: flex;
    gap: 6px;
    align-items: center;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary-blue);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

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

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

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

/* ==================== CHATBOT FOOTER ==================== */
.chatbot-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: var(--white);
    border-radius: 0 0 12px 12px;
}

.chat-input-form {
    display: flex;
    gap: 8px;
}

#message-input {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

#message-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

#message-input::placeholder {
    color: var(--text-light);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #1d4ed8 100%);
    border: none;
    color: var(--white);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

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

/* ==================== CHATBOT TOGGLE BUTTON ==================== */
.chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-orange) 100%);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.4);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-toggle.hidden {
    display: none;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
    }
    50% {
        box-shadow: 0 10px 40px rgba(37, 99, 235, 0.5);
    }
}

/* ==================== RESPONSIVE MOBILE ==================== */
@media (max-width: 768px) {
    .chatbot-container {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        left: 0;
        top: 0;
    }

    .chatbot-toggle {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }

    .message-content {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
    }

    .header-title h2 {
        font-size: 16px;
    }

    .message-content {
        font-size: 13px;
    }
}

/* ==================== LOADING STATE ==================== */
.sending {
    opacity: 0.6;
    pointer-events: none;
}

/* ==================== UTILITY CLASSES ==================== */
.highlight {
    background: rgba(249, 115, 22, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
    color: var(--primary-orange);
}

.price-range {
    background: rgba(37, 99, 235, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    color: var(--primary-blue);
}

/* ==================== SCROLLBAR SMOOTH ==================== */
html {
    scroll-behavior: smooth;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .chatbot-container,
    .chatbot-toggle {
        display: none !important;
    }
}
