/* Global Talent Hub Chat Widget */
:root {
    --chat-bg: #0a192f;
    --chat-accent: #cfaa6d;
    --chat-text: #ffffff;
    --chat-user-bg: #1f3a5a;
    --chat-bot-bg: #112240;
    --chat-border: rgba(207, 170, 109, 0.3);
}

/* Floating Toggle Button */
#chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--chat-bg);
    border: 2px solid var(--chat-accent);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#chat-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(207, 170, 109, 0.6);
}

#chat-toggle-btn svg {
    width: 30px;
    height: 30px;
    fill: var(--chat-accent);
}

/* Chat Window */
#chat-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: rgba(10, 25, 47, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--chat-border);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#chat-widget.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Header */
.chat-header {
    padding: 15px;
    background: rgba(207, 170, 109, 0.1);
    border-bottom: 1px solid var(--chat-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 15px 15px 0 0;
}

.chat-header h3 {
    margin: 0;
    color: var(--chat-accent);
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
}

.chat-header button {
    background: none;
    border: none;
    color: var(--chat-accent);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Messages Area */
#chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--chat-accent) var(--chat-bg);
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background-color: var(--chat-accent);
    border-radius: 3px;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.bot {
    align-self: flex-start;
    background: var(--chat-bot-bg);
    border: 1px solid var(--chat-border);
    color: var(--chat-text);
    border-bottom-left-radius: 2px;
}

.message.user {
    align-self: flex-end;
    background: var(--chat-accent);
    color: #000;
    border-bottom-right-radius: 2px;
    font-weight: 500;
}

/* Input Area */
.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--chat-border);
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--chat-border);
    border-radius: 5px;
    padding: 10px;
    color: #fff;
    outline: none;
}

#chat-input:focus {
    border-color: var(--chat-accent);
}

#chat-send {
    background: var(--chat-accent);
    border: none;
    border-radius: 5px;
    padding: 0 15px;
    cursor: pointer;
    color: #000;
    transition: filter 0.2s;
}

#chat-send:hover {
    filter: brightness(1.1);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 10px 15px;
    background: var(--chat-bot-bg);
    border: 1px solid var(--chat-border);
    border-radius: 10px;
    align-self: flex-start;
    width: fit-content;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-accent);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Apply Utility Button */
.apply-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #cfaa6d 0%, #f4e4bc 100%);
    color: #000;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 10px rgba(207, 170, 109, 0.3);
}

.apply-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(207, 170, 109, 0.5);
}

/* Dynamic Apply Button (from AI response) */
.chat-apply-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #cfaa6d 0%, #f4e4bc 50%, #cfaa6d 100%);
    background-size: 200% 200%;
    color: #0a192f;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(207, 170, 109, 0.4);
    animation: shimmer 2s infinite linear;
}

.chat-apply-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(207, 170, 109, 0.6);
}

@keyframes shimmer {
    0% {
        background-position: 200% center;
    }

    100% {
        background-position: -200% center;
    }
}

/* ============================================================================
   WELCOME SCREEN (Start Chat Button)
   ============================================================================ */

.chat-welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

.welcome-content {
    text-align: center;
    max-width: 280px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--chat-accent) 0%, #f4e4bc 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(207, 170, 109, 0.3);
}

.welcome-icon svg {
    width: 40px;
    height: 40px;
    stroke: var(--chat-bg);
}

.welcome-title {
    margin: 0 0 8px;
    color: var(--chat-accent);
    font-size: 1.4rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.welcome-subtitle {
    margin: 0 0 16px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.welcome-description {
    margin: 0 0 24px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    line-height: 1.5;
}

.start-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--chat-accent) 0%, #f4e4bc 100%);
    color: var(--chat-bg);
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(207, 170, 109, 0.4);
}

.start-chat-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--chat-bg);
    transition: transform 0.3s ease;
}

.start-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(207, 170, 109, 0.6);
}

.start-chat-btn:hover svg {
    transform: translateX(3px);
}

.start-chat-btn:active {
    transform: translateY(0);
}

/* ============================================================================
   PROACTIVE GREETING BUBBLE (Production)
   ============================================================================ */

/* Main Bubble Container */
.chat-greeting-bubble {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 280px;
    background: rgba(10, 25, 47, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--chat-border);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(207, 170, 109, 0.2);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chat-greeting-bubble.visible {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* Bubble Content */
.bubble-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
}

/* AI Icon */
.bubble-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--chat-accent) 0%, #f4e4bc 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(207, 170, 109, 0.4);
}

.bubble-icon svg {
    width: 18px;
    height: 18px;
    fill: var(--chat-bg);
}

/* Text Area */
.bubble-text-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bubble-label {
    font-size: 0.7rem;
    color: var(--chat-accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Outfit', sans-serif;
}

.bubble-text {
    font-size: 0.85rem;
    color: var(--chat-text);
    line-height: 1.4;
    font-family: 'Noto Sans', sans-serif;
    margin: 0;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.bubble-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Close Button */
.bubble-close {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: rgba(207, 170, 109, 0.2);
    border: 1px solid var(--chat-accent);
    border-radius: 50%;
    color: var(--chat-accent);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    font-weight: bold;
}

/* Ensure minimum touch target for mobile */
.bubble-close::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
}

.bubble-close:hover {
    background: var(--chat-accent);
    color: var(--chat-bg);
    transform: scale(1.1);
}

.bubble-close:focus {
    outline: 2px solid var(--chat-accent);
    outline-offset: 2px;
}

/* Typing Indicator for Bubble */
.bubble-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.bubble-typing.hidden {
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.bubble-typing-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-accent);
    border-radius: 50%;
    animation: bubbleTyping 1.4s infinite ease-in-out both;
}

.bubble-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.bubble-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bubbleTyping {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Glow Effect for Chat Button when Bubble is Visible */
#chat-toggle-btn.has-notification {
    animation: buttonGlow 2s infinite ease-in-out;
}

@keyframes buttonGlow {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(207, 170, 109, 0.8), 0 0 40px rgba(207, 170, 109, 0.4);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-greeting-bubble {
        width: calc(100% - 40px);
        left: 20px;
        right: 20px;
        bottom: 90px;
    }

    .chat-welcome-screen {
        padding: 15px;
    }

    .welcome-icon {
        width: 70px;
        height: 70px;
    }

    .welcome-icon svg {
        width: 35px;
        height: 35px;
    }

    .welcome-title {
        font-size: 1.2rem;
    }

    .welcome-description {
        font-size: 0.85rem;
    }

    .start-chat-btn {
        padding: 10px 24px;
        font-size: 0.95rem;
    }
}

/* Tablet Landscape */
@media (max-width: 1024px) and (orientation: landscape) {
    .chat-greeting-bubble {
        width: 260px;
        bottom: 80px;
        right: 15px;
    }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {
    .chat-greeting-bubble,
    .bubble-text,
    .bubble-close,
    #chat-toggle-btn.has-notification {
        animation: none !important;
        transition: none !important;
    }

    .bubble-typing-dot {
        animation: none !important;
    }
}