/* ================================================================
   HindFollowers AI Assistant
   Premium Light Widget
   ================================================================ */

#hf-ai-root,
#hf-ai-root * {
    box-sizing: border-box;
}

#hf-ai-root {
    --hf-ai-primary: var(--t-primary, #111111);
    --hf-ai-text: var(--t-font, #111111);
    --hf-ai-card: var(--t-card, #ffffff);

    position: fixed;
    right: 20px;
    bottom: calc(174px + var(--footer-safe-bottom, 0px));
    z-index: 999999;
    font-family: inherit;
    color: var(--hf-ai-text);
}

/* ==================== LAUNCHER ==================== */

.hf-ai-launcher {
    width: 60px;
    height: 60px;
    border: 1.5px solid #111;
    border-radius: 50%;
    background: var(--hf-ai-primary);
    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    box-shadow:
        0 5px 0 #111,
        0 10px 24px rgba(0, 0, 0, .18);

    transition:
        transform .18s ease,
        box-shadow .18s ease;

    -webkit-tap-highlight-color: transparent;
}

.hf-ai-launcher:hover {
    transform: translateY(-2px);
    box-shadow:
        0 7px 0 #111,
        0 14px 30px rgba(0, 0, 0, .20);
}

.hf-ai-launcher:active {
    transform: translateY(3px);
    box-shadow:
        0 2px 0 #111,
        0 6px 16px rgba(0, 0, 0, .16);
}

.hf-ai-launcher svg {
    width: 27px;
    height: 27px;
    fill: currentColor;
}

/* ==================== WINDOW ==================== */

.hf-ai-window {
    position: fixed;
    right: 20px;
    bottom: 100px;

    width: min(390px, calc(100vw - 40px));
    height: min(620px, calc(100dvh - 120px));
    max-height: calc(100dvh - 120px);

    background: #fff;
    border: 1.5px solid #111;
    border-radius: 22px;

    overflow: hidden;

    display: flex;
    flex-direction: column;

    box-shadow:
        0 7px 0 #111,
        0 20px 55px rgba(0, 0, 0, .22);

    opacity: 0;
    visibility: hidden;

    transform:
        translateY(18px)
        scale(.97);

    transform-origin: bottom right;

    transition:
        opacity .2s ease,
        visibility .2s ease,
        transform .2s ease;
}

.hf-ai-window.hf-ai-open {
    opacity: 1;
    visibility: visible;
    transform:
        translateY(0)
        scale(1);
}

/* ==================== HEADER ==================== */

.hf-ai-header {
    min-height: 72px;
    padding: 13px 14px;

    display: flex;
    align-items: center;
    gap: 11px;

    background: var(--hf-ai-primary);
    color: #fff;

    border-bottom: 1.5px solid #111;
}

.hf-ai-avatar {
    width: 42px;
    height: 42px;

    flex: 0 0 42px;

    border-radius: 14px;
    border: 1.5px solid #111;

    background: #fff;
    color: var(--hf-ai-primary);

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 3px 0 #111;
}

.hf-ai-avatar svg {
    width: 23px;
    height: 23px;
    fill: currentColor;
}

.hf-ai-heading {
    min-width: 0;
    flex: 1;
}

.hf-ai-name {
    margin: 0;

    font-size: 15px;
    font-weight: 800;
    line-height: 1.25;
}

.hf-ai-status {
    margin-top: 3px;

    display: flex;
    align-items: center;
    gap: 5px;

    font-size: 11.5px;
    font-weight: 600;

    opacity: .92;
}

.hf-ai-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #63e681;
    border: 1px solid rgba(0, 0, 0, .35);
}

.hf-ai-close {
    width: 36px;
    height: 36px;

    border: 1.5px solid rgba(0, 0, 0, .65);
    border-radius: 12px;

    background: rgba(255, 255, 255, .92);
    color: #111;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    font-size: 23px;
    line-height: 1;
}

/* ==================== MESSAGES ==================== */

.hf-ai-messages {
    flex: 1;

    overflow-y: auto;
    overscroll-behavior: contain;

    padding: 17px 13px 20px;

    background:
        linear-gradient(
            180deg,
            color-mix(in srgb, var(--hf-ai-primary) 5%, white),
            #fff 150px
        );

    scrollbar-width: thin;
}

.hf-ai-row {
    width: 100%;

    display: flex;

    margin-bottom: 12px;
}

.hf-ai-row.user {
    justify-content: flex-end;
}

.hf-ai-row.assistant {
    justify-content: flex-start;
}

.hf-ai-bubble {
    max-width: 84%;

    padding: 10px 12px;

    border: 1px solid #111;

    font-size: 13px;
    line-height: 1.5;

    white-space: pre-wrap;
    word-break: break-word;
}

.hf-ai-row.assistant .hf-ai-bubble {
    border-radius: 5px 16px 16px 16px;

    background: var(--hf-ai-card);
    color: var(--hf-ai-text);

    box-shadow: 0 3px 0 #111;
}

.hf-ai-row.user .hf-ai-bubble {
    border-radius: 16px 5px 16px 16px;

    background: var(--hf-ai-primary);
    color: #fff;

    box-shadow: 0 3px 0 #111;
}

/* ==================== WELCOME ==================== */

.hf-ai-welcome {
    padding: 15px;

    border: 1.5px solid #111;
    border-radius: 18px;

    background: var(--hf-ai-card);

    box-shadow: 0 4px 0 #111;

    margin-bottom: 16px;
}

.hf-ai-welcome-title {
    margin: 0 0 6px;

    color: var(--hf-ai-text);

    font-size: 17px;
    font-weight: 850;
}

.hf-ai-welcome-text {
    margin: 0;

    color: var(--hf-ai-text);

    opacity: .8;

    font-size: 12.5px;
    line-height: 1.5;
}

/* ==================== QUICK CHIPS ==================== */

.hf-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;

    margin:
        3px 0
        14px;
}

.hf-ai-chip {
    min-height: 34px;

    padding: 7px 10px;

    border: 1px solid #111;
    border-radius: 999px;

    background: #fff;
    color: var(--hf-ai-text);

    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;

    cursor: pointer;

    box-shadow: 0 2px 0 #111;

    transition:
        transform .15s ease,
        box-shadow .15s ease;
}

.hf-ai-chip:active {
    transform: translateY(2px);
    box-shadow: none;
}

/* ==================== RESULT CARDS ==================== */

.hf-ai-results {
    display: grid;
    gap: 9px;

    width: 100%;

    margin:
        -3px 0
        14px;
}

.hf-ai-card {
    width: 100%;

    padding: 11px;

    border: 1.5px solid #111;
    border-radius: 15px;

    background: var(--hf-ai-card);
    color: var(--hf-ai-text);

    box-shadow: 0 3px 0 #111;
}

.hf-ai-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.hf-ai-card-title {
    min-width: 0;

    font-size: 12.5px;
    font-weight: 800;
    line-height: 1.4;
}

.hf-ai-badge {
    flex: 0 0 auto;

    padding: 4px 7px;

    border: 1px solid #111;
    border-radius: 999px;

    background: #fff;

    font-size: 9.5px;
    font-weight: 800;
    text-transform: capitalize;
}

.hf-ai-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;

    margin-top: 9px;
}

.hf-ai-meta {
    padding: 4px 6px;

    border-radius: 7px;

    background:
        color-mix(
            in srgb,
            var(--hf-ai-primary) 10%,
            white
        );

    font-size: 10.5px;
    font-weight: 650;
}

.hf-ai-price {
    color: var(--hf-ai-primary);
    font-weight: 850;
}

.hf-ai-card-desc {
    margin-top: 8px;

    font-size: 10.5px;
    line-height: 1.45;

    opacity: .78;

    white-space: pre-line;
}

.hf-ai-card-link {
    margin-top: 7px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 10px;
    opacity: .68;
}

/* ==================== WALLET CARD ==================== */

.hf-ai-wallet {
    text-align: center;

    padding: 16px 12px;
}

.hf-ai-wallet-label {
    font-size: 10.5px;
    font-weight: 700;
    opacity: .7;

    text-transform: uppercase;
    letter-spacing: .5px;
}

.hf-ai-wallet-amount {
    margin-top: 3px;

    color: var(--hf-ai-primary);

    font-size: 26px;
    font-weight: 900;
}

/* ==================== TYPING ==================== */

.hf-ai-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;

    min-height: 38px;

    padding: 10px 13px;

    border: 1px solid #111;
    border-radius: 5px 16px 16px 16px;

    background: #fff;

    box-shadow: 0 3px 0 #111;
}

.hf-ai-typing span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: var(--hf-ai-primary);

    animation:
        hfAiTyping 1s infinite ease-in-out;
}

.hf-ai-typing span:nth-child(2) {
    animation-delay: .15s;
}

.hf-ai-typing span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes hfAiTyping {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: .45;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ==================== INPUT ==================== */

.hf-ai-input-area {
    padding: 10px;

    display: flex;
    align-items: flex-end;
    gap: 8px;

    background: #fff;

    border-top: 1px solid #111;
}

.hf-ai-input {
    flex: 1;

    min-width: 0;
    min-height: 43px;
    max-height: 105px;

    resize: none;

    padding: 11px 12px;

    border: 1.5px solid #111;
    border-radius: 14px;

    outline: none;

    background: #fff;
    color: #111;

    font: inherit;
    font-size: 13px;
    line-height: 1.4;
}

.hf-ai-input:focus {
    box-shadow:
        0 0 0 2px
        color-mix(
            in srgb,
            var(--hf-ai-primary) 25%,
            transparent
        );
}

.hf-ai-send {
    width: 43px;
    height: 43px;

    flex: 0 0 43px;

    border: 1.5px solid #111;
    border-radius: 14px;

    background: var(--hf-ai-primary);
    color: #fff;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;

    box-shadow: 0 3px 0 #111;
}

.hf-ai-send:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #111;
}

.hf-ai-send:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.hf-ai-send svg {
    width: 19px;
    height: 19px;
    fill: currentColor;
}

/* ==================== MOBILE ==================== */

@media (max-width: 520px) {
    #hf-ai-root {
        right: 20px;
        bottom: calc(174px + var(--footer-safe-bottom, 0px));
    }

    .hf-ai-launcher {
    width: 60px;
    height: 60px;
    }

    .hf-ai-window {
        position: fixed;

        left: 10px;
        right: 10px;
        bottom: 158px;

        width: auto;

        height: min(
            610px,
            calc(100dvh - 180px)
        );

        border-radius: 20px;
    }

    .hf-ai-header {
        min-height: 68px;
    }
}
/* ================================================================
   AI SERVICE CARDS — PHASE 5B.5B
   ================================================================ */

.hf-ai-service-card {
    position: relative;
    overflow: hidden;

    padding: 13px;

    border: 1.5px solid #111;
    border-radius: 17px;

    background: var(--hf-ai-card);
    color: var(--hf-ai-text);

    box-shadow: 0 4px 0 #111;
}

.hf-ai-service-card .hf-ai-card-top {
    gap: 10px;
}

.hf-ai-service-heading {
    display: flex;
    align-items: flex-start;
    gap: 8px;

    min-width: 0;
    flex: 1;
}

.hf-ai-service-position {
    width: 28px;
    height: 28px;

    flex: 0 0 28px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1.5px solid #111;
    border-radius: 9px;

    background: var(--hf-ai-primary);
    color: #fff;

    font-size: 10px;
    font-weight: 900;
    line-height: 1;

    box-shadow: 0 2px 0 #111;
}

.hf-ai-service-card .hf-ai-card-title {
    padding-top: 2px;

    font-size: 12.5px;
    font-weight: 850;
    line-height: 1.4;

    color: var(--hf-ai-text);
}

.hf-ai-service-card .hf-ai-badge {
    background:
        color-mix(
            in srgb,
            var(--hf-ai-primary) 10%,
            var(--hf-ai-card)
        );

    color: var(--hf-ai-text);

    white-space: nowrap;
}

.hf-ai-service-rate {
    display: flex;
    align-items: baseline;
    gap: 6px;

    margin-top: 11px;
    padding: 9px 10px;

    border: 1px solid #111;
    border-radius: 11px;

    background:
        color-mix(
            in srgb,
            var(--hf-ai-primary) 7%,
            var(--hf-ai-card)
        );
}

.hf-ai-service-rate-label {
    font-size: 10px;
    font-weight: 750;
    opacity: .68;
}

.hf-ai-service-rate strong {
    color: var(--hf-ai-primary);

    font-size: 17px;
    font-weight: 900;
    line-height: 1;
}

.hf-ai-service-card .hf-ai-card-meta {
    margin-top: 8px;
}

.hf-ai-service-card .hf-ai-meta {
    border: 1px solid
        color-mix(
            in srgb,
            #111 25%,
            transparent
        );

    background:
        color-mix(
            in srgb,
            var(--hf-ai-primary) 8%,
            var(--hf-ai-card)
        );

    color: var(--hf-ai-text);

    font-size: 10px;
    font-weight: 700;
}

.hf-ai-service-details {
    margin-top: 9px;

    border-top: 1px solid
        color-mix(
            in srgb,
            #111 18%,
            transparent
        );

    padding-top: 8px;
}

.hf-ai-service-details summary {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    color: var(--hf-ai-primary);

    font-size: 10.5px;
    font-weight: 800;

    cursor: pointer;
    user-select: none;

    list-style: none;
}

.hf-ai-service-details summary::-webkit-details-marker {
    display: none;
}

.hf-ai-service-details summary::after {
    content: '›';

    display: inline-block;

    font-size: 16px;
    line-height: 1;

    transform: rotate(90deg);
    transition: transform .16s ease;
}

.hf-ai-service-details[open] summary::after {
    transform: rotate(-90deg);
}

.hf-ai-service-details .hf-ai-card-desc {
    margin-top: 8px;
    padding: 9px 10px;

    border-radius: 10px;

    background:
        color-mix(
            in srgb,
            var(--hf-ai-primary) 5%,
            var(--hf-ai-card)
        );

    color: var(--hf-ai-text);

    opacity: .86;

    font-size: 10.5px;
    line-height: 1.55;
}

@media (max-width: 520px) {
    .hf-ai-service-card {
        padding: 11px;
        border-radius: 15px;
    }

    .hf-ai-service-card .hf-ai-card-top {
        gap: 7px;
    }

    .hf-ai-service-position {
        width: 26px;
        height: 26px;

        flex-basis: 26px;

        border-radius: 8px;

        font-size: 9px;
    }

    .hf-ai-service-card .hf-ai-card-title {
        font-size: 12px;
    }

    .hf-ai-service-card .hf-ai-badge {
        padding: 4px 6px;
        font-size: 9px;
    }

    .hf-ai-service-rate {
        margin-top: 9px;
        padding: 8px 9px;
    }

    .hf-ai-service-rate strong {
        font-size: 16px;
    }
}



/* ================================================================
   HindFollowers AI — V1 FINAL POLISH
   ================================================================ */

/*
 * Keep the first restored/result card comfortably below the header
 * and give the final item enough breathing room above the composer.
 */
.hf-ai-messages {
    scroll-padding-top: 18px;
    scroll-padding-bottom: 24px;
}

.hf-ai-messages > :first-child {
    margin-top: 2px;
}

.hf-ai-results {
    padding-top: 3px;
}

/* Better long service-name handling */
.hf-ai-service-card .hf-ai-card-title {
    overflow-wrap: anywhere;
    word-break: normal;
}

/* Prevent badge/heading collisions on narrow cards */
.hf-ai-service-card .hf-ai-card-top {
    flex-wrap: wrap;
}

.hf-ai-service-card .hf-ai-badge {
    max-width: 100%;
}

/* Slightly cleaner interaction feedback */
.hf-ai-close,
.hf-ai-send,
.hf-ai-chip,
.hf-ai-launcher {
    transition:
        transform .16s ease,
        box-shadow .16s ease,
        opacity .16s ease;
}

.hf-ai-close:focus-visible,
.hf-ai-send:focus-visible,
.hf-ai-chip:focus-visible,
.hf-ai-launcher:focus-visible,
.hf-ai-input:focus-visible {
    outline: 3px solid
        color-mix(
            in srgb,
            var(--hf-ai-primary) 35%,
            transparent
        );
    outline-offset: 2px;
}

/* Disabled composer state */
.hf-ai-input:disabled {
    opacity: .65;
    cursor: not-allowed;
}

/* Avoid accidental horizontal overflow */
.hf-ai-window,
.hf-ai-messages,
.hf-ai-results,
.hf-ai-service-card {
    min-width: 0;
}

/* Respect devices with a bottom safe area */
@supports (padding: max(0px)) {
    .hf-ai-input-area {
        padding-bottom:
            max(
                10px,
                env(safe-area-inset-bottom)
            );
    }
}

/* Final mobile refinement */
@media (max-width: 520px) {
    .hf-ai-window {
        left: 8px;
        right: 8px;

        width: auto;

        max-height:
            calc(100dvh - 176px);
    }

    .hf-ai-messages {
        padding:
            15px
            11px
            20px;
    }

    .hf-ai-service-card {
        padding: 12px;
    }

    .hf-ai-bubble {
        max-width: 88%;
    }
}

/* Accessibility: avoid unnecessary animation */
@media (prefers-reduced-motion: reduce) {
    .hf-ai-window,
    .hf-ai-launcher,
    .hf-ai-close,
    .hf-ai-send,
    .hf-ai-chip {
        transition: none !important;
    }

    .hf-ai-typing span {
        animation: none !important;
    }
}
