/* Background Scroll Lock when Chatbot Modal is active */
html.cb-open,
body.cb-open {
    overflow: hidden !important;
}

/* Full-Screen Backdrop Overlay */
.chatbot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9990;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    touch-action: none;
    pointer-events: auto;
}

.chatbot-overlay.active {
    opacity: 1;
    visibility: visible;
}

.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Floating Tooltip Clue for Chatbot Identification */
.chatbot-tooltip {
    background: rgba(15, 23, 42, 0.95);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    white-space: nowrap;
    animation: floatTooltip 3s ease-in-out infinite;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-tooltip i {
    font-size: 0.9rem;
    color: #38bdf8;
}

@keyframes floatTooltip {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0f172a;
    border: 2px solid var(--primary);
    box-shadow: 0 10px 25px rgba(56, 189, 248, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: visible;
    position: relative;
    padding: 0;
}

.chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 14px 35px rgba(56, 189, 248, 0.6);
}

.chatbot-toggle img.profile-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.chatbot-toggle .profile-avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.chatbot-toggle i {
    color: #fff;
    font-size: 24px;
}

/* Robot Identification Badge on Floating Button */
.chatbot-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #0284c7, #06b6d4);
    border: 2px solid #0f172a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    left: auto;
    width: 380px;
    max-width: calc(100vw - 40px);
    margin: 0;
    height: min(530px, calc(100vh - 130px));
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 9999;
}

@media (max-width: 639px) {
    .chatbot-window {
        bottom: 90px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: 100%;
        height: min(500px, calc(100vh - 110px));
    }
}

.chatbot-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chatbot-header {
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.cb-header-clear-btn {
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #f87171;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.73rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
    white-space: nowrap;
}

.cb-header-clear-btn i {
    color: #ef4444;
    font-size: 0.82rem;
}

.cb-header-clear-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}

.cb-header-clear-btn:hover i {
    color: #ffffff;
}

.chatbot-header .bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: visible;
    position: relative;
    flex-shrink: 0;
    background: transparent;
    border: 1.5px solid var(--primary);
}

.chatbot-header .bot-avatar img.profile-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.chatbot-header .bot-avatar .profile-avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--primary);
    font-size: 1rem;
}

.header-bot-badge {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    background: #0284c7;
    border: 1.5px solid #0f172a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 8px;
    z-index: 2;
}

.chatbot-header h4 {
    margin: 0;
    color: #f3f4f6;
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
}

.chatbot-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: calc(100% - 120px) !important;
    max-height: calc(100% - 120px) !important;
    padding: 20px;
    overflow-y: auto !important;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overscroll-behavior: contain !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
}

.chatbot-messages > * {
    flex-shrink: 0 !important;
}

/* Chat Message Row Layout & Avatars */
.message-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    margin-bottom: 2px;
    flex-shrink: 0 !important;
}

.message-wrapper.bot {
    justify-content: flex-start;
}

.message-wrapper.user {
    justify-content: flex-end;
}

.msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: visible;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--primary);
    margin-bottom: 2px;
}

.msg-avatar.bot-avatar img.profile-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.msg-avatar.bot-avatar .profile-avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: #fff;
    font-size: 0.75rem;
}

.msg-bot-badge {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 15px;
    height: 15px;
    background: #0284c7;
    border: 1.5px solid #0f172a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 7px;
    z-index: 2;
}

.msg-avatar.user-avatar {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
}

.user-avatar-badge {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #0f172a;
    font-size: 0.72rem;
}

.message {
    max-width: 78%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.message.bot {
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-bottom-left-radius: 2px;
}

.message.user {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border-bottom-right-radius: 2px;
}

.chatbot-input-area {
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.chatbot-input-area input {
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    max-width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 8px 12px;
    color: #f3f4f6;
    outline: none;
    font-size: 0.95rem;
}

.chatbot-input-area input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

.chatbot-input-area button {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    background: var(--primary);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.chatbot-input-area button:hover {
    background: var(--accent);
}

.chatbot-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chat-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 5px 12px;
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-btn:hover {
    background: rgba(56, 189, 248, 0.10);
    border-color: var(--primary);
    color: var(--primary);
}

/* Custom Scrollbar for messages */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.linkedin-footer-btn:hover {
    transform: scale(1.2);
    color: #00a0dc !important;
}

/* Inline Contact Form Card Box inside Chatbot */
.chatbot-contact-box {
    align-self: flex-start;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(0, 212, 170, 0.4);
    border-radius: 14px;
    padding: 12px 14px;
    margin: 6px 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatbot-contact-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 6px;
}

.cb-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 7px 10px;
    color: #f3f4f6;
    font-size: 0.82rem;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.cb-input:focus {
    border-color: var(--primary);
    background: rgba(0, 212, 170, 0.08);
    box-shadow: 0 0 10px rgba(0, 212, 170, 0.2);
}

.cb-textarea {
    resize: none;
    height: 55px;
}

.cb-send-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), #00b894);
    color: #060910;
    border: none;
    border-radius: 8px;
    padding: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(0, 212, 170, 0.3);
    margin-top: 2px;
}

.cb-send-btn:hover {
    background: linear-gradient(135deg, #00efc2, #00d4aa);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 212, 170, 0.5);
}

.cb-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.cb-form-status {
    font-size: 0.78rem;
    line-height: 1.3;
    margin-top: 2px;
}

.cb-form-status.success {
    color: #10b981;
}

.cb-form-status.error {
    color: #ef4444;
}

/* Navigation Link Buttons inside Chatbot Messages */
.cb-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(0, 212, 170, 0.12);
    border: 1px solid rgba(0, 212, 170, 0.4);
    color: var(--primary) !important;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    margin-top: 8px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cb-nav-btn:hover {
    background: var(--primary);
    color: #060910 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 212, 170, 0.4);
}

/* Chatbot Card List & Individual Cards */
.chatbot-card-list {
    align-self: flex-start;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 6px 0;
}

.cb-card {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 3px solid var(--primary);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.25s ease;
}

.cb-card:hover {
    border-color: rgba(0, 212, 170, 0.5);
    background: rgba(17, 24, 39, 0.98);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.cb-card-title {
    font-size: 0.84rem;
    font-weight: 700;
    color: #f3f4f6;
}

.cb-card-desc {
    font-size: 0.76rem;
    color: #94a3b8;
    line-height: 1.35;
}

.cb-card-link {
    display: inline-block;
    align-self: flex-start;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    margin-top: 4px;
    transition: color 0.2s ease;
}

.cb-card-link:hover {
    color: #00efc2;
    text-decoration: underline;
}

/* Mobile Responsiveness Improvements */
@media (max-width: 639px) {
    .chatbot-container {
        bottom: 15px;
        right: 15px;
        z-index: 9999;
    }
    .chatbot-window {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        height: 70vh !important;
        max-height: 70vh !important;
        border-radius: 20px 20px 0 0 !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        overflow: hidden !important;
        z-index: 10000 !important;
        overscroll-behavior: contain !important;
    }
    .chatbot-messages {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: calc(70vh - 120px) !important;
        max-height: calc(70vh - 120px) !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        overscroll-behavior-y: contain !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-y !important;
    }
    .chatbot-input-area {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 8px 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        gap: 8px !important;
        overflow: hidden !important;
        background: rgba(15, 23, 42, 0.98) !important;
        flex-shrink: 0 !important;
    }
    .chatbot-input-area input {
        font-size: 16px !important; /* Prevents Mobile Chrome / Safari auto-zoom on input focus */
        padding: 10px 12px !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
        width: calc(100% - 50px) !important;
        max-width: calc(100% - 50px) !important;
        box-sizing: border-box !important;
    }
    .chatbot-input-area button {
        flex: 0 0 40px !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        box-sizing: border-box !important;
    }
    .chatbot-tooltip {
        display: none !important;
    }
}

/* Typing Indicator Animation */
.message.bot.typing-dots {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 10px 16px !important;
    background: rgba(15, 23, 42, 0.85) !important;
    border: 1px solid rgba(0, 212, 170, 0.25) !important;
    border-radius: 12px !important;
    min-height: 36px !important;
}

.message.bot.typing-dots span {
    width: 7px;
    height: 7px;
    background: var(--primary, #00d4aa);
    border-radius: 50%;
    display: inline-block;
    animation: cbTypingDot 1.4s infinite ease-in-out both;
}

.message.bot.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.message.bot.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes cbTypingDot {
    0%, 80%, 100% { transform: scale(0.3); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}