/* ═══════════════════════════════════════════════════════
   VISA ASSISTANT CHAT WIDGET — Premium Styles v3
   ═══════════════════════════════════════════════════════ */

#fhu-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Toggle Button ── */
#fhu-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent, #d7b46a);
    color: var(--bg, #09090b);
    border: none;
    box-shadow: 0 4px 20px rgba(215, 180, 106, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

#fhu-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(215, 180, 106, 0.45);
}

#fhu-chat-toggle.chat-toggle--active {
    transform: scale(0.9);
    opacity: 0.7;
}

/* ── Unread Badge ── */
.chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg, #09090b);
    animation: badgePop 0.3s ease;
}

.chat-badge.hidden {
    display: none;
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }

    60% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* ── Proactive Greeting Bubble ── */
.chat-proactive {
    position: absolute;
    bottom: 72px;
    right: 0;
    background: var(--bg-surface, #18181b);
    border: 1px solid var(--border, #27272a);
    border-radius: 12px;
    padding: 10px 32px 10px 14px;
    color: #fafafa;
    font-size: 13px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    white-space: nowrap;
    animation: proactiveSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transition: opacity 0.2s;
}

.chat-proactive.hidden {
    display: none;
}

.chat-proactive__close {
    position: absolute;
    top: 4px;
    right: 6px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
}

.chat-proactive__close:hover {
    color: rgba(255, 255, 255, 0.8);
}

@keyframes proactiveSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Chat Window ── */
#fhu-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 540px;
    background: var(--bg-surface, #18181b);
    border: 1px solid var(--border, #27272a);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#fhu-chat-window.hidden {
    opacity: 0;
    transform: scale(0.85) translateY(10px);
    pointer-events: none;
}

/* ── Header ── */
.chat-header {
    background: var(--panel, #27272a);
    padding: 12px 14px;
    border-bottom: 1px solid var(--border, #27272a);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header__info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent, #d7b46a);
    color: #09090b;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.chat-header__status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.45);
}

.chat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.chat-header__actions {
    display: flex;
    gap: 2px;
}

.chat-header-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.chat-header-btn:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
}

/* ── Messages ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 5px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Message Bubbles */
.message {
    max-width: 88%;
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

.msg-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent, #d7b46a);
    color: var(--bg, #09090b);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 14px;
}

.msg-bubble {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.msg-content {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.bot {
    align-self: flex-start;
}

.message.bot .msg-content {
    background: var(--panel, #27272a);
    color: #fafafa;
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.user .msg-content {
    background: var(--accent, #d7b46a);
    color: #09090b;
    border-bottom-right-radius: 4px;
}

/* Timestamp */
.msg-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.25);
    padding: 0 4px;
}

.message.user .msg-time {
    text-align: right;
}

/* Message Animation */
.msg-animate {
    animation: msgSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes msgSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Links inside chat */
.chat-link {
    color: var(--accent, #d7b46a);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chat-link:hover {
    opacity: 0.8;
}

.msg-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Fira Code', monospace;
}

/* ── Typing Indicator ── */
.typing-indicator {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 6px;
}

.typing-indicator .msg-bubble {
    display: none;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--panel, #27272a);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    animation: typingBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.typing-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    font-style: italic;
}

/* ── Footer Hint ── */
.chat-footer-hint {
    padding: 4px 14px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.2);
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* ── Input Area ── */
.chat-input-area {
    padding: 10px 12px;
    border-top: 1px solid var(--border, #27272a);
    display: flex;
    gap: 8px;
    background: var(--bg-surface, #18181b);
}

.chat-input-area input {
    flex: 1;
    background: #09090b;
    border: 1px solid var(--border, #27272a);
    padding: 10px 14px;
    border-radius: 10px;
    color: #fff;
    outline: none;
    font-size: 13.5px;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--accent, #d7b46a);
}

.chat-input-area input:disabled {
    opacity: 0.5;
}

.chat-input-area input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chat-input-area button {
    background: var(--accent, #d7b46a);
    border: none;
    border-radius: 10px;
    width: 42px;
    cursor: pointer;
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-input-area button:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

/* ── Options Buttons ── */
.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
    padding-left: 28px;
}

.chat-option-btn {
    background: transparent;
    border: 1px solid var(--accent, #d7b46a);
    color: var(--accent, #d7b46a);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    animation: optionFadeIn 0.3s ease both;
    white-space: nowrap;
}

@keyframes optionFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-option-btn:hover {
    background: var(--accent, #d7b46a);
    color: var(--bg, #000);
    transform: translateY(-1px);
}

.chat-option-btn:disabled {
    cursor: default;
    pointer-events: none;
}

.chat-option-btn--used {
    opacity: 0.35;
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.3);
}

.chat-option-btn--selected {
    opacity: 0.6;
    background: var(--accent, #d7b46a);
    color: var(--bg, #000);
    border-color: var(--accent, #d7b46a);
}

/* ═══════════════════════════════════════════════════════
   COUNTRY CAROUSEL
   ═══════════════════════════════════════════════════════ */
.chat-carousel {
    position: relative;
    margin: 4px 0;
    padding: 0 2px 0 28px;
}

.chat-carousel__track {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0;
}

.chat-carousel__track::-webkit-scrollbar {
    display: none;
}

.chat-carousel__card {
    flex: 0 0 120px;
    scroll-snap-align: start;
    background: var(--panel, #27272a);
    border: 1px solid var(--border, #27272a);
    border-radius: 12px;
    padding: 12px 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.chat-carousel__card:hover {
    border-color: var(--accent, #d7b46a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.carousel-card__flag {
    font-size: 38px;
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 40px;
}

.carousel-card__flag img {
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.carousel-card__name {
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 3px;
}

.carousel-card__price {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent, #d7b46a);
}

.carousel-card__time {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 2px;
}

.chat-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-surface, #18181b);
    border: 1px solid var(--border, #27272a);
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2;
}

.chat-carousel__arrow:hover {
    background: var(--accent, #d7b46a);
    color: var(--bg, #000);
}

.chat-carousel__arrow--left {
    left: 20px;
}

.chat-carousel__arrow--right {
    right: -4px;
}

/* ═══════════════════════════════════════════════════════
   INLINE APPLICATION FORM
   ═══════════════════════════════════════════════════════ */
.chat-inline-form {
    background: var(--panel, #27272a);
    border: 1px solid var(--border, #27272a);
    border-radius: 14px;
    overflow: hidden;
    margin: 4px 0;
    margin-left: 28px;
    max-width: calc(100% - 28px);
}

.inline-form__header {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: rgba(215, 180, 106, 0.1);
    border-bottom: 1px solid var(--border, #27272a);
}

.inline-form__fields {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inline-form__input {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border, #27272a);
    background: #09090b;
    color: #fff;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.inline-form__input:focus {
    border-color: var(--accent, #d7b46a);
}

.inline-form__input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.inline-form__input:disabled {
    opacity: 0.5;
}

select.inline-form__input {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

select.inline-form__input option {
    background: #09090b;
    color: #fff;
}

.inline-form__submit {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 8px;
    background: var(--accent, #d7b46a);
    color: #09090b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.inline-form__submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.inline-form__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.inline-form__submit--done {
    background: #22c55e;
    color: #fff;
}

/* ═══════════════════════════════════════════════════════
   CHAT HISTORY SEPARATOR
   ═══════════════════════════════════════════════════════ */
.chat-history-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 12px;
}

.chat-history-sep::before,
.chat-history-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.chat-history-sep span {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.25);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
    #fhu-chat-widget {
        bottom: 12px;
        right: 12px;
    }

    #fhu-chat-window {
        width: calc(100vw - 24px);
        height: calc(100vh - 100px);
        bottom: 72px;
        right: 0;
        border-radius: 12px;
    }

    #fhu-chat-toggle {
        width: 52px;
        height: 52px;
    }

    .chat-proactive {
        display: none !important;
    }
}