/**
 * Public Front-end Stylesheet for Recruitment Chatbot
 */

#rc-chatbot-widget {
    position: fixed;
    z-index: 999999;
    font-family: var(--rc-font-family);
    box-sizing: border-box;
}

#rc-chatbot-widget *,
#rc-chatbot-widget *::before,
#rc-chatbot-widget *::after {
    box-sizing: border-box;
}

/* Positions */
.rc-position-bottom-right {
    bottom: 24px;
    right: 24px;
}

.rc-position-bottom-left {
    bottom: 24px;
    left: 24px;
}

/* Floating Action Button (FAB) */
.rc-chatbot-launcher-bubble {
    position: absolute;
    bottom: 10px;
    right: 72px;
    max-width: 190px;
    min-height: 38px;
    padding: 9px 13px;
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
    color: #1e293b;
    font-family: var(--rc-font-family);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
    animation: rcBubbleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.rc-position-bottom-left .rc-chatbot-launcher-bubble {
    left: 72px;
    right: auto;
}

.rc-chatbot-launcher-bubble::after {
    content: "";
    position: absolute;
    right: -7px;
    bottom: 13px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    transform: rotate(-45deg);
}

.rc-position-bottom-left .rc-chatbot-launcher-bubble::after {
    left: -7px;
    right: auto;
    transform: rotate(135deg);
}

.rc-chatbot-fab {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--rc-primary-color);
    color: var(--rc-header-text-color);
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.rc-chatbot-fab:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
}

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

.rc-chatbot-fab svg {
    transition: transform 0.3s ease;
}

.rc-fab-icon-open,
.rc-fab-icon-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.rc-fab-icon-close {
    width: 44px;
    height: 44px;
    margin: auto;
    border-radius: 50%;
    background-color: var(--rc-fab-close-bg-color);
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
}

.rc-fab-icon-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* Pulsing waves behind FAB */
.rc-fab-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--rc-primary-color);
    top: 0;
    left: 0;
    z-index: -1;
    opacity: 0.4;
    animation: rcPulse 2.5s infinite;
}

@keyframes rcPulse {
    0% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.3); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}

/* Chat Window */
.rc-chatbot-window {
    position: absolute;
    width: 380px;
    height: 580px;
    background-color: #ffffff;
    border-radius: var(--rc-border-radius);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
}

.rc-position-bottom-right .rc-chatbot-window {
    bottom: 76px;
    right: 0;
    transform-origin: bottom right;
}

.rc-position-bottom-left .rc-chatbot-window {
    bottom: 76px;
    left: 0;
    transform-origin: bottom left;
}

.rc-chatbot-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Chat Header */
.rc-chat-header {
    background-color: var(--rc-primary-color);
    color: var(--rc-header-text-color);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.rc-chat-avatar-wrapper {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.rc-chat-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.rc-chat-avatar-default {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.rc-chat-avatar-default svg {
    color: var(--rc-header-text-color);
}

.rc-online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background-color: #10b981;
    border: 2px solid var(--rc-primary-color);
    border-radius: 50%;
}

.rc-chat-header-text {
    flex: 1;
    min-width: 0;
}

.rc-chat-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.rc-chat-subtitle {
    font-size: 11px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rc-chat-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--rc-header-text-color);
    opacity: 0.75;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: opacity 0.2s ease;
}

.rc-chat-close-btn:hover {
    opacity: 1;
}

/* Chat Messages */
.rc-chat-messages {
    flex: 1;
    background-color: #f8fafc;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* Message Rows */
.rc-msg-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.rc-msg-row.user {
    justify-content: flex-end;
}

.rc-msg-avatar-wrapper {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.rc-msg-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.rc-msg-avatar-default {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rc-msg-avatar-default svg {
    color: #ffffff;
    width: 14px;
    height: 14px;
}

.rc-msg-bubble {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 75%;
    word-break: break-all;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    animation: rcBubbleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.rc-msg-bubble.bot {
    background-color: var(--rc-bot-bubble-color);
    color: var(--rc-bot-bubble-text-color);
    border-radius: var(--rc-border-radius) var(--rc-border-radius) var(--rc-border-radius) 4px;
}

.rc-msg-bubble.user {
    background-color: var(--rc-user-bubble-color);
    color: var(--rc-user-bubble-text-color);
    border-radius: var(--rc-border-radius) var(--rc-border-radius) 4px var(--rc-border-radius);
}

/* Validation Feedback Bubble */
.rc-msg-bubble.validation-error {
    background-color: #fee2e2;
    color: #ef4444;
    border-radius: var(--rc-border-radius);
    border: 1px solid #fecaca;
    font-size: 12px;
}

/* Typing Indicator */
.rc-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
}

.rc-typing-dot {
    width: 6px;
    height: 6px;
    background-color: #94a3b8;
    border-radius: 50%;
    animation: rcTyping 1.4s infinite ease-in-out both;
}

.rc-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.rc-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes rcTyping {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Interactive Option Pills */
.rc-pills-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: 38px;
    animation: rcBubbleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.rc-question-list,
.rc-after-answer-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-left: 38px;
    animation: rcBubbleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.rc-question-btn,
.rc-secondary-action-btn,
.rc-primary-action-btn,
.rc-chat-apply-btn {
    width: 100%;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;
    padding: 10px 13px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.rc-question-btn,
.rc-secondary-action-btn {
    background-color: #ffffff;
    border: 1px solid #dbe3ee;
    color: #1e293b;
}

.rc-question-btn:hover,
.rc-secondary-action-btn:hover {
    border-color: var(--rc-primary-color);
    color: var(--rc-primary-color);
    transform: translateY(-1px);
}

.rc-primary-action-btn,
.rc-chat-apply-btn {
    background-color: var(--rc-primary-color);
    border: 1px solid var(--rc-primary-color);
    color: var(--rc-header-text-color);
    text-align: center;
}

.rc-primary-action-btn:hover,
.rc-chat-apply-btn:hover {
    filter: brightness(0.96);
    transform: translateY(-1px);
}

.rc-chat-action-footer {
    background-color: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 12px;
}

.rc-pill-btn {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    background-color: #ffffff;
    border: 1px solid var(--rc-primary-color);
    color: var(--rc-primary-color);
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.rc-pill-btn:hover {
    background-color: var(--rc-primary-color);
    color: var(--rc-header-text-color);
    transform: translateY(-1px);
}

.rc-pill-btn:active {
    transform: translateY(0);
}

/* Form Footer inputs */
.rc-chat-input-form {
    background-color: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 12px;
}

.rc-chat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f1f5f9;
    border-radius: 9999px;
    padding: 4px 6px 4px 14px;
    border: 1px solid transparent;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.rc-chat-input-container:has(input:focus),
.rc-chat-input-container:has(textarea:focus) {
    border-color: var(--rc-primary-color);
    background-color: #ffffff;
}

.rc-chat-input-container input,
.rc-chat-input-container textarea {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 13px;
    color: #1e293b;
    padding: 6px 0;
}

.rc-chat-input-container textarea {
    resize: none;
    height: 36px;
    border-radius: 12px;
}

.rc-chat-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--rc-primary-color);
    color: var(--rc-header-text-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    outline: none;
}

.rc-chat-send-btn:hover {
    transform: scale(1.05);
}

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

.rc-chat-send-btn svg {
    transform: rotate(45deg) translate(1px, -1px);
}


.rc-chatbot-launcher-bubble {
    width: max-content;
    max-width: min(320px, calc(100vw - 120px));
    white-space: nowrap;
}

.rc-chatbot-fab.rc-has-custom-closed-icon {
    background: transparent;
    box-shadow: none;
    padding: 0;
    overflow: visible;
}

.rc-chatbot-fab.rc-has-custom-closed-icon:hover {
    box-shadow: none;
}

.rc-chatbot-fab.rc-has-custom-closed-icon .rc-fab-pulse {
    display: none;
}

.rc-chatbot-fab.rc-has-custom-closed-icon .rc-fab-icon-img {
    border-radius: 0;
    object-fit: contain;
}

.rc-has-custom-avatar .rc-chat-avatar,
.rc-has-custom-avatar .rc-msg-avatar.rc-custom-avatar-img {
    border: none;
    border-radius: 0;
    object-fit: contain;
    background: transparent;
}

.rc-has-custom-avatar .rc-chat-avatar-wrapper,
.rc-has-custom-avatar .rc-msg-avatar-wrapper {
    background: transparent;
}

.rc-has-custom-avatar .rc-online-indicator {
    display: none;
}

/* Custom Scrollbar */
.rc-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.rc-chat-messages::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

.rc-chat-messages::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Custom Styles for Form Validation elements */
.rc-chat-input-container input:invalid,
.rc-chat-input-container textarea:invalid {
    box-shadow: none;
}

/* -------------------------------------------------------------
 * Responsive Layout (Mobile optimization)
 * ------------------------------------------------------------- */
@media (max-width: 480px) {
    #rc-chatbot-widget {
        bottom: 0;
        right: 0;
        left: 0;
    }

    .rc-chatbot-fab {
        position: fixed;
        bottom: 16px;
        right: 16px;
    }

    .rc-chatbot-launcher-bubble {
        position: fixed;
        right: 86px;
        bottom: 23px;
        max-width: calc(100vw - 112px);
        white-space: nowrap;
    }

    /* Screen Takeover for chatbot window */
    .rc-chatbot-window {
        position: fixed;
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        border-radius: 0;
        border: none;
        max-height: 100%;
    }

    .rc-msg-bubble {
        max-width: 80%;
    }
}
