/* =========================================================
   TECHLIKE ASSISTANT
   Inherits the active Techlike website theme.
   ========================================================= */

:root {
    --assistant-primary: var(--bs-themecolor, #090040);
    --assistant-primary-hover: var(--bs-themehovercolor, #21156f);
    --assistant-primary-rgb: var(--bs-themecolor-rgb, 9, 0, 64);

    --assistant-text: #202124;
    --assistant-muted: #737780;
    --assistant-border: #e8eaf0;
    --assistant-surface: #ffffff;
    --assistant-background: #f7f8fc;
    --assistant-user-message: var(--assistant-primary);
    --assistant-bot-message: #f0f2f7;

    --assistant-shadow:
        0 14px 50px rgba(18, 24, 40, 0.18),
        0 3px 12px rgba(18, 24, 40, 0.08);

    --assistant-radius: 18px;
}

/* =========================================================
   FLOATING CHAT BUTTON
   Positioned above the Back to Top button.
   ========================================================= */

.techlike-assistant-toggle {
    position: fixed;
    right: 12px;
    bottom: 70px;

    width: 60px;
    height: 60px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;

    background: var(--assistant-primary);
    color: #ffffff;

    box-shadow: 0 6px 22px rgba(
        var(--assistant-primary-rgb),
        0.32
    );

    cursor: pointer;
    z-index: 1050;

    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.techlike-assistant-toggle:hover {
    background: var(--assistant-primary-hover);
    transform: translateY(-3px);

    box-shadow: 0 9px 26px rgba(
        var(--assistant-primary-rgb),
        0.38
    );
}

.techlike-assistant-toggle:focus-visible {
    outline: 3px solid rgba(
        var(--assistant-primary-rgb),
        0.3
    );

    outline-offset: 4px;
}

.assistant-toggle-icon {
    position: absolute;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 24px;

    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.assistant-icon-chat {
    opacity: 1;
    transform: scale(1);
}

.assistant-icon-close {
    opacity: 0;
    transform: scale(0.7);
}

.techlike-assistant-toggle.is-open .assistant-icon-chat {
    opacity: 0;
    transform: scale(0.7);
}

.techlike-assistant-toggle.is-open .assistant-icon-close {
    opacity: 1;
    transform: scale(1);
}

.assistant-notification-dot {
    position: absolute;
    top: 3px;
    right: 3px;

    width: 11px;
    height: 11px;

    border: 2px solid #ffffff;
    border-radius: 50%;

    background: #25c685;
}

.techlike-assistant-toggle.is-open .assistant-notification-dot {
    display: none;
}

/* =========================================================
   CHAT PANEL
   ========================================================= */

.techlike-assistant-panel {
    position: fixed;

    right: 24px;
    bottom: 160px;

    width: 390px;
    max-width: calc(100vw - 32px);

    height: 590px;
    max-height: calc(100dvh - 185px);

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background: var(--assistant-surface);
    border: 1px solid rgba(20, 25, 40, 0.08);
    border-radius: var(--assistant-radius);

    box-shadow: var(--assistant-shadow);

    z-index: 1051;

    animation: assistant-panel-enter 0.22s ease;
}

.techlike-assistant-panel[hidden] {
    display: none !important;
}

@keyframes assistant-panel-enter {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =========================================================
   HEADER
   ========================================================= */

.assistant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 16px 18px;

    background: var(--assistant-primary);
    color: #ffffff;

    flex-shrink: 0;
}

.assistant-header-identity {
    display: flex;
    align-items: center;
    gap: 11px;

    min-width: 0;
}

.assistant-avatar {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;

    font-size: 19px;
}

.assistant-header-text {
    min-width: 0;
}

.assistant-header-text h2 {
    margin: 0;

    color: #ffffff;

    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
}

.assistant-status {
    display: flex;
    align-items: center;
    gap: 6px;

    margin-top: 4px;

    color: rgba(255, 255, 255, 0.78);

    font-size: 11px;
}

.assistant-status-dot {
    width: 7px;
    height: 7px;

    flex-shrink: 0;

    border-radius: 50%;
    background: #39df9b;
}

.assistant-header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

.assistant-header-button {
    width: 34px;
    height: 34px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 8px;

    background: transparent;
    color: #ffffff;

    cursor: pointer;

    transition: background-color 0.2s ease;
}

.assistant-header-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.assistant-header-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* =========================================================
   CONTEXT STRIP
   ========================================================= */

.assistant-context {
    display: flex;
    flex-direction: column;
    gap: 3px;

    padding: 12px 18px;

    background: rgba(
        var(--assistant-primary-rgb),
        0.045
    );

    border-bottom: 1px solid var(--assistant-border);

    flex-shrink: 0;
}

.assistant-context-label {
    color: var(--assistant-primary);

    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.2px;
}

.assistant-context-text {
    color: var(--assistant-muted);

    font-size: 12px;
    line-height: 1.5;
}

/* =========================================================
   MESSAGE STREAM
   ========================================================= */

.assistant-messages {
    display: flex;
    flex-direction: column;
    gap: 15px;

    padding: 18px 15px;

    overflow-x: hidden;
    overflow-y: auto;

    flex: 1 1 auto;
    min-height: 0;

    background: var(--assistant-background);

    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.assistant-messages::-webkit-scrollbar {
    width: 5px;
}

.assistant-messages::-webkit-scrollbar-track {
    background: transparent;
}

.assistant-messages::-webkit-scrollbar-thumb {
    background: #d6d9e2;
    border-radius: 10px;
}

.assistant-message {
    display: flex;
    flex-direction: column;

    max-width: 92%;
    min-width: 0;

    animation: assistant-message-enter 0.18s ease;
}

@keyframes assistant-message-enter {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.assistant-message.assistant-message-bot {
    align-self: flex-start;
}

.assistant-message.assistant-message-user {
    align-self: flex-end;
    align-items: flex-end;
}

.assistant-message-label {
    margin: 0 0 5px 3px;

    color: var(--assistant-muted);

    font-size: 10px;
    font-weight: 700;
}

.assistant-message-bubble {
    padding: 11px 13px;

    border-radius: 14px;

    font-size: 13px;
    line-height: 1.65;

    overflow-wrap: anywhere;
    word-break: normal;
}

.assistant-message-bot .assistant-message-bubble {
    background: var(--assistant-bot-message);
    color: var(--assistant-text);

    border: 1px solid #e9ebf1;
    border-top-left-radius: 4px;
}

.assistant-message-user .assistant-message-bubble {
    background: var(--assistant-user-message);
    color: #ffffff;

    border-top-right-radius: 4px;
}

.assistant-message-bubble p {
    margin: 0 0 8px;
}

.assistant-message-bubble p:last-child {
    margin-bottom: 0;
}

.assistant-message-bubble ul {
    margin: 7px 0;
    padding-left: 19px;
}

.assistant-message-bubble li {
    margin-bottom: 4px;
}

.assistant-message-bubble a {
    color: inherit;
    text-decoration: underline;
    overflow-wrap: anywhere;
}

.assistant-message-bubble strong {
    font-weight: 700;
}

/* =========================================================
   QUICK REPLIES
   Rendered inside the assistant message stream.
   ========================================================= */

.assistant-message-options {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;

    margin-top: 10px;
    padding: 0 2px 2px;

    max-width: 100%;
}

.assistant-quick-reply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    max-width: 100%;
    padding: 8px 11px;

    border: 1px solid rgba(
        var(--assistant-primary-rgb),
        0.24
    );

    border-radius: 9px;

    background: #ffffff;
    color: var(--assistant-primary);

    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
    text-align: left;

    overflow-wrap: anywhere;

    cursor: pointer;

    transition:
        background-color 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease,
        transform 0.18s ease;
}

.assistant-quick-reply:hover:not(:disabled) {
    background: var(--assistant-primary);
    border-color: var(--assistant-primary);
    color: #ffffff;

    transform: translateY(-1px);
}

.assistant-quick-reply:focus-visible {
    outline: 2px solid var(--assistant-primary);
    outline-offset: 2px;
}

.assistant-quick-reply:disabled {
    opacity: 0.55;
    cursor: default;
}

.assistant-quick-reply.is-selected {
    background: rgba(
        var(--assistant-primary-rgb),
        0.08
    );

    border-color: var(--assistant-primary);
    color: var(--assistant-primary);
}

/* =========================================================
   TYPING INDICATOR
   ========================================================= */

.assistant-typing {
    display: flex;
    align-items: center;
    gap: 4px;

    padding: 0 18px 10px;

    background: var(--assistant-background);

    flex-shrink: 0;
}

.assistant-typing[hidden] {
    display: none !important;
}

.assistant-typing span {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: var(--assistant-primary);

    animation: assistant-typing-bounce 1s infinite ease-in-out;
}

.assistant-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.assistant-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes assistant-typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* =========================================================
   INPUT AREA
   ========================================================= */

.assistant-input-area {
    display: flex;
    align-items: center;
    gap: 9px;

    padding: 12px 14px;

    background: #ffffff;
    border-top: 1px solid var(--assistant-border);

    flex-shrink: 0;
}

.assistant-input-area input {
    width: 100%;
    min-width: 0;
    height: 43px;

    padding: 0 13px;

    border: 1px solid #e3e6ed;
    border-radius: 10px;

    outline: none;

    background: #f9fafc;
    color: var(--assistant-text);

    font-family: inherit;
    font-size: 13px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.assistant-input-area input::placeholder {
    color: #9398a4;
}

.assistant-input-area input:focus {
    background: #ffffff;
    border-color: var(--assistant-primary);

    box-shadow: 0 0 0 3px rgba(
        var(--assistant-primary-rgb),
        0.08
    );
}

.assistant-input-area button {
    width: 43px;
    height: 43px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 10px;

    background: var(--assistant-primary);
    color: #ffffff;

    font-size: 16px;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        transform 0.2s ease;
}

.assistant-input-area button:hover {
    background: var(--assistant-primary-hover);
    transform: translateY(-1px);
}

.assistant-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.assistant-input-area button:focus-visible {
    outline: 2px solid var(--assistant-primary);
    outline-offset: 3px;
}

/* =========================================================
   FOOTER
   ========================================================= */

.assistant-footer {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 8px 12px;

    background: #ffffff;

    border-top: 1px solid #f0f1f5;

    color: var(--assistant-muted);

    font-size: 10px;

    flex-shrink: 0;
}

.assistant-footer i {
    margin-right: 4px;
    color: var(--assistant-primary);
}

/* =========================================================
   MOBILE RESPONSIVENESS
   ========================================================= */

@media (max-width: 576px) {
    .techlike-assistant-toggle {
        right: 16px;
        bottom: 80px;

        width: 54px;
        height: 54px;
    }

    .assistant-toggle-icon {
        font-size: 22px;
    }

    .techlike-assistant-panel {
        right: 12px;
        bottom: 145px;

        width: calc(100vw - 24px);
        max-width: 380px;

        height: min(590px, calc(100dvh - 165px));
        max-height: calc(100dvh - 165px);

        border-radius: 15px;
    }

    .assistant-header {
        padding: 13px 14px;
    }

    .assistant-context {
        padding: 10px 14px;
    }

    .assistant-messages {
        padding: 14px 12px;
        gap: 13px;
    }

    .assistant-message {
        max-width: 96%;
    }

    .assistant-message-bubble {
        padding: 10px 11px;
        font-size: 12.5px;
    }

    .assistant-quick-reply {
        padding: 8px 10px;
        font-size: 11.5px;
    }

    .assistant-input-area {
        padding: 10px;
        gap: 7px;
    }

    .assistant-input-area input {
        height: 42px;
        font-size: 13px;
    }

    .assistant-input-area button {
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 360px) {
    .techlike-assistant-toggle {
        right: 12px;
        bottom: 74px;

        width: 50px;
        height: 50px;
    }

    .techlike-assistant-panel {
        right: 8px;
        bottom: 132px;

        width: calc(100vw - 16px);
        max-height: calc(100dvh - 150px);
    }

    .assistant-header-text h2 {
        font-size: 14px;
    }

    .assistant-header-actions {
        gap: 1px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .techlike-assistant-toggle,
    .assistant-toggle-icon,
    .assistant-quick-reply,
    .assistant-message,
    .techlike-assistant-panel {
        animation: none !important;
        transition: none !important;
    }

    .assistant-messages {
        scroll-behavior: auto;
    }
}