/* ============================================================
   1TECH SOLUTIONS - CHATBOT PROFESSIONAL STYLING
   COLOR SCHEME: #2563EB (Blue) | #F97316 (Orange) | #F5F7FA (Light Gray)
   ============================================================ */

/* ---------- Widget Container ---------- */
#chatbotWidget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- Toggle Button ---------- */
.chat-toggle-btn {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #2563EB, #1D4ED8);
    color: #FFFFFF;
    cursor: pointer;
    box-shadow: 0 8px 40px rgba(37, 99, 235, 0.30);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chat-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 60px rgba(37, 99, 235, 0.45);
}

.chat-toggle-btn:active {
    transform: scale(0.92);
}

.chat-toggle-btn svg {
    width: 30px;
    height: 30px;
    stroke: currentColor;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Notification Badge */
.chat-toggle-btn .notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: #FFFFFF;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid #FFFFFF;
    animation: pulseBadge 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

@keyframes pulseBadge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ---------- Chat Window ---------- */
.chat-window {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 400px;
    max-width: 92vw;
    max-height: 560px;
    background: #FFFFFF;
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: none !important;
    transition: all 0.3s ease;
}

.chat-window.show {
    display: block !important;
    animation: chatSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes chatSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ---------- Chat Header ---------- */
.chat-header {
    background: linear-gradient(135deg, #0a1628, #1a3a5c);
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #F97316;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(249, 115, 22, 0.04);
    border-radius: 50%;
    pointer-events: none;
}

.chat-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 2;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(249, 115, 22, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid rgba(249, 115, 22, 0.25);
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.chat-avatar svg {
    width: 24px;
    height: 24px;
}

.chat-brand-info h6 {
    margin: 0;
    font-weight: 700;
    font-size: 1rem;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

.chat-brand-info h6 span {
    color: #F97316;
}

.chat-brand-info .online-status {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-brand-info .online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22C55E;
    display: inline-block;
    animation: pulseDot 2s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

.close-chat {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    width: 36px;
    height: 36px;
}

.close-chat:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

.close-chat svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* ---------- Chat Messages ---------- */
.chat-messages {
    padding: 20px 20px 16px;
    height: 300px;
    overflow-y: auto;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 4px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #E5E7EB;
    border-radius: 10px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #2563EB;
}

/* ---------- Welcome Message ---------- */
.welcome-message {
    display: flex;
    gap: 14px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    padding: 16px 20px;
    margin-bottom: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
}

.welcome-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    line-height: 1;
}

.welcome-text p {
    margin: 0;
    font-size: 0.9rem;
    color: #1F2937;
    line-height: 1.5;
    font-weight: 500;
}

.welcome-sub {
    display: block;
    font-size: 0.7rem;
    color: #9CA3AF;
    margin-top: 4px;
    font-weight: 400;
}

/* ---------- Messages ---------- */
.message {
    display: flex;
    margin-bottom: 12px;
    max-width: 85%;
    animation: messageSlide 0.3s ease forwards;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.bot {
    align-self: flex-start;
}

.message-bubble {
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.88rem;
    line-height: 1.6;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: #FFFFFF;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.15);
}

.message.bot .message-bubble {
    background: #FFFFFF;
    color: #1F2937;
    border-bottom-left-radius: 4px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
}

.message.bot .message-bubble a {
    color: #2563EB;
    font-weight: 600;
    text-decoration: none;
}
.message.bot .message-bubble a:hover {
    color: #F97316;
    text-decoration: underline;
}
.message.bot .message-bubble strong {
    color: #F97316;
}

/* ---------- Suggested Questions ---------- */
.suggested-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding: 4px 0;
}

.suggested-btn {
    background: #FFFFFF;
    border: 1.5px solid #E5E7EB;
    color: #1F2937;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    font-family: inherit;
}

.suggested-btn:hover {
    background: #2563EB;
    border-color: #2563EB;
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.15);
}

.suggested-btn:active {
    transform: scale(0.95);
}

/* ---------- Typing Indicator ---------- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 18px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    margin-bottom: 12px;
    align-self: flex-start;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.02);
}

.typing-indicator span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #2563EB;
    opacity: 0.3;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}
.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ---------- Chat Input ---------- */
.chat-input-form {
    display: flex;
    gap: 10px;
    padding: 14px 20px 20px;
    background: #FFFFFF;
    border-top: 1px solid #F1F3F5;
}

.chat-input-form input {
    flex: 1;
    padding: 12px 18px;
    border: 1.5px solid #E5E7EB;
    border-radius: 14px;
    font-size: 0.88rem;
    color: #1F2937;
    outline: none;
    transition: all 0.3s ease;
    background: #F8FAFC;
    font-family: inherit;
}

.chat-input-form input::placeholder {
    color: #9CA3AF;
}

.chat-input-form input:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.06);
    background: #FFFFFF;
}

.chat-input-form .send-btn {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: #FFFFFF;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.20);
}

.chat-input-form .send-btn:hover {
    background: linear-gradient(135deg, #1D4ED8, #1A3A8A);
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(37, 99, 235, 0.30);
}

.chat-input-form .send-btn:active {
    transform: scale(0.92);
}

.chat-input-form .send-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* ---------- Responsive ---------- */
@media (max-width: 576px) {
    #chatbotWidget {
        bottom: 16px;
        right: 16px;
    }

    .chat-window {
        width: 96vw;
        max-width: 96vw;
        max-height: 72vh;
        bottom: 72px;
        right: 0;
        border-radius: 18px;
    }

    .chat-header {
        padding: 14px 18px;
    }

    .chat-avatar {
        width: 38px;
        height: 38px;
    }

    .chat-avatar svg {
        width: 20px;
        height: 20px;
    }

    .chat-brand-info h6 {
        font-size: 0.88rem;
    }

    .chat-messages {
        height: 220px;
        padding: 16px 14px 12px;
    }

    .message-bubble {
        font-size: 0.82rem;
        padding: 10px 14px;
    }

    .message {
        max-width: 92%;
    }

    .suggested-btn {
        font-size: 0.62rem;
        padding: 5px 12px;
    }

    .chat-input-form {
        padding: 10px 14px 14px;
        gap: 8px;
    }

    .chat-input-form input {
        font-size: 0.82rem;
        padding: 10px 14px;
        border-radius: 12px;
    }

    .chat-input-form .send-btn {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }

    .chat-input-form .send-btn svg {
        width: 16px;
        height: 16px;
    }

    .chat-toggle-btn {
        width: 58px;
        height: 58px;
    }

    .chat-toggle-btn svg {
        width: 26px;
        height: 26px;
    }

    .chat-toggle-btn .notification-badge {
        width: 20px;
        height: 20px;
        font-size: 0.55rem;
    }

    .welcome-message {
        padding: 14px 16px;
    }

    .welcome-icon {
        font-size: 1.3rem;
    }

    .welcome-text p {
        font-size: 0.82rem;
    }
}

@media (max-width: 400px) {
    .chat-window {
        width: 98vw;
        max-width: 98vw;
        max-height: 68vh;
        bottom: 65px;
        border-radius: 14px;
    }

    .chat-messages {
        height: 180px;
        padding: 12px 10px 10px;
    }

    .message-bubble {
        font-size: 0.78rem;
        padding: 8px 12px;
    }

    .chat-input-form input {
        font-size: 0.78rem;
        padding: 8px 12px;
    }

    .chat-input-form .send-btn {
        width: 40px;
        height: 40px;
    }

    .chat-toggle-btn {
        width: 52px;
        height: 52px;
    }

    .chat-toggle-btn svg {
        width: 22px;
        height: 22px;
    }
}