/*=============================================================
    ISSI ASSISTANT
    Loaded on every site page. Tokens come from theme.css.
*=============================================================*/

#ukm-assistant {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1060;
    font-family: var(--ukm-text);
    transition: bottom 0.35s var(--ukm-ease);
}

#ukm-assistant.is-lifted {
    bottom: 96px;
}

/*--- Launcher: a rally roundel ---*/
.asst-launcher {
    display: flex;
    align-items: center;
    height: 60px;
    padding: 0;
    border: 0;
    border-radius: 30px;
    background: var(--ukm-navy-deep);
    color: var(--ukm-white);
    box-shadow: 0 0 0 3px var(--ukm-white), 0 0 0 6px var(--ukm-red), 0 18px 34px -12px rgba(0, 17, 63, 0.65);
    cursor: pointer;
    transition: background-color 0.25s var(--ukm-ease), transform 0.25s var(--ukm-ease);
}

.asst-launcher:hover {
    background: var(--ukm-navy);
    transform: translateY(-2px);
}

.asst-launcher:focus-visible {
    outline: 3px solid var(--ukm-navy);
    outline-offset: 8px;
}

.asst-launcher__icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
}

.asst-launcher__icon svg {
    width: 26px;
    height: 26px;
}

.asst-launcher__label {
    max-width: 0;
    overflow: hidden;
    font-family: var(--ukm-display);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    transition: max-width 0.5s var(--ukm-ease), opacity 0.3s, padding 0.5s var(--ukm-ease);
}

#ukm-assistant.is-intro .asst-launcher__label,
.asst-launcher:hover .asst-launcher__label {
    max-width: 160px;
    padding-right: 22px;
    opacity: 1;
}

#ukm-assistant.is-open .asst-launcher__label {
    max-width: 0;
    padding-right: 0;
    opacity: 0;
}

/*--- Panel ---*/
.asst-panel {
    position: absolute;
    right: 0;
    bottom: 80px;
    display: flex;
    flex-direction: column;
    width: 390px;
    height: min(640px, calc(100vh - 150px));
    padding: 0; /* the base stylesheet pads every <section> */
    overflow: hidden;
    background: var(--ukm-white);
    border-top: 4px solid var(--ukm-red);
    box-shadow: 0 40px 80px -30px rgba(0, 17, 63, 0.55), 0 0 0 1px var(--ukm-line);
    transform-origin: bottom right;
    animation: asst-in 0.35s var(--ukm-ease);
}

.asst-panel[hidden] {
    display: none;
}

.asst-head {
    display: flex;
    flex: none;
    align-items: center;
    gap: 12px;
    padding: 14px 10px 14px 16px;
    background: var(--ukm-navy-deep);
    color: var(--ukm-white);
}

.asst-avatar {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ukm-white);
    box-shadow: 0 0 0 2px var(--ukm-navy-deep), 0 0 0 4px var(--ukm-red);
    color: var(--ukm-navy-deep);
    font-family: var(--ukm-display);
    font-size: 15px;
    font-weight: 600;
}

.asst-title {
    margin: 0;
    font-family: var(--ukm-display);
    font-size: 19px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ukm-white);
}

.asst-sub {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.7);
}

.asst-reset,
.asst-close {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: transparent;
    color: var(--ukm-white);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.asst-reset {
    margin-left: auto;
}

.asst-reset svg {
    width: 18px;
    height: 18px;
}

.asst-reset:hover,
.asst-close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.asst-reset:focus-visible,
.asst-close:focus-visible {
    outline: 3px solid var(--ukm-white);
    outline-offset: -3px;
}

/*--- Conversation ---*/
.asst-log {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    padding: 16px 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--ukm-paper);
}

.asst-msg {
    max-width: 90%;
    padding: 10px 13px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.asst-msg--bot {
    align-self: flex-start;
    background: var(--ukm-white);
    border: 1px solid var(--ukm-line);
    border-left: 3px solid var(--ukm-navy);
    color: var(--ukm-body);
}

.asst-msg--user {
    align-self: flex-end;
    background: var(--ukm-navy);
    color: var(--ukm-white);
}

.asst-msg strong {
    color: var(--ukm-ink);
}

.asst-msg a:not(.asst-btn) {
    color: var(--ukm-navy);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--ukm-red);
    text-underline-offset: 2px;
}

.asst-msg p {
    margin: 8px 0 0;
}

.asst-note {
    padding-left: 8px;
    border-left: 2px solid var(--ukm-red);
    font-size: 12px;
    line-height: 1.45;
}

.asst-typing {
    display: flex;
    gap: 4px;
    padding: 14px;
}

.asst-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ukm-navy);
    animation: asst-dot 1s infinite ease-in-out;
}

.asst-typing span:nth-child(2) { animation-delay: 0.15s; }
.asst-typing span:nth-child(3) { animation-delay: 0.3s; }

/* Competition card inside a message */
.asst-card {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: var(--ukm-white);
    border: 1px solid var(--ukm-line);
}

.asst-card img {
    flex: none;
    width: 76px;
    height: 57px;
    object-fit: cover;
    background: var(--ukm-navy);
}

.asst-card__body {
    flex: 1;
    min-width: 0;
}

.asst-msg a.asst-card__name {
    display: block;
    color: var(--ukm-ink);
    font-family: var(--ukm-display);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.15;
    text-decoration: none;
    text-transform: uppercase;
}

.asst-card__alt {
    margin: 2px 0 0 !important;
    font-family: var(--ukm-display);
    font-size: 11.5px;
    letter-spacing: 0.05em;
    text-transform: uppercase !important;
    color: var(--ukm-red);
}

.asst-card__meta {
    margin: 4px 0 0 !important;
    font-size: 12.5px;
}

.asst-card__meta del {
    font-size: 11.5px;
}

.asst-bar {
    height: 3px;
    margin-top: 6px;
    background: var(--ukm-grey);
}

.asst-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--ukm-navy), var(--ukm-red));
}

.asst-card__sub {
    margin: 4px 0 0 !important;
    font-size: 11.5px;
}

.asst-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.asst-btn,
.asst-btn:focus {
    display: inline-flex;
    align-items: center;
    height: 30px;
    padding: 0 10px;
    border: 1.5px solid var(--ukm-navy);
    border-radius: 2px;
    background: var(--ukm-white);
    color: var(--ukm-navy);
    font-family: var(--ukm-display);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
}

.asst-btn:hover {
    background: var(--ukm-navy);
    color: var(--ukm-white);
}

.asst-btn--red,
.asst-btn--red:focus {
    border-color: var(--ukm-red);
    background: var(--ukm-red);
    color: var(--ukm-white);
}

.asst-btn--red:hover {
    border-color: var(--ukm-red-deep);
    background: var(--ukm-red-deep);
    color: var(--ukm-white);
}

.asst-btn:focus-visible,
.asst-chip:focus-visible,
.asst-msg a:focus-visible {
    outline: 3px solid var(--ukm-red);
    outline-offset: 2px;
}

/* Lists: results, steps */
.asst-results,
.asst-steps,
.asst-list {
    margin: 10px 0 !important;
    padding: 0;
}

.asst-results li {
    padding: 8px 0;
    border-bottom: 1px solid var(--ukm-line);
}

.asst-msg .asst-results a:not(.asst-btn) {
    color: var(--ukm-ink);
    font-family: var(--ukm-display);
    font-size: 14px;
    text-decoration: none;
    text-transform: uppercase;
}

.asst-results small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
}

.asst-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    background: var(--ukm-grey);
    color: var(--ukm-ink);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    vertical-align: 2px;
}

.asst-tag--win {
    background: var(--ukm-red);
    color: var(--ukm-white);
}

.asst-tag--open {
    background: var(--ukm-navy);
    color: var(--ukm-white);
}

.asst-steps {
    padding-left: 18px !important;
}

.asst-steps li {
    margin-bottom: 4px;
    list-style: decimal;
}

.asst-list {
    padding-left: 16px !important;
}

.asst-list li {
    list-style: disc;
}

/* Skill question before adding to cart */
.asst-question {
    margin: 10px 0 0 !important;
    padding: 10px 12px;
    background: var(--ukm-navy-deep);
    color: var(--ukm-white);
    font-family: var(--ukm-display);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
}

/* Form inside a message (password reset email) */
.asst-inline {
    margin-top: 12px;
}

.asst-inline__label {
    display: block;
    margin-bottom: 6px;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ukm-body);
}

.asst-inline__row {
    display: flex;
    gap: 6px;
}

.asst-inline input {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 10px;
    border: 1.5px solid var(--ukm-navy);
    border-radius: 2px;
    background: var(--ukm-white);
    color: var(--ukm-ink);
    font-size: 15px;
}

.asst-inline input:focus-visible {
    outline: 3px solid var(--ukm-red);
    outline-offset: 1px;
}

.asst-inline input[aria-invalid="true"] {
    border-color: var(--ukm-red);
}

.asst-inline .asst-btn {
    flex: none;
    height: 40px;
}

.asst-inline__error {
    margin: 6px 0 0 !important;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ukm-red);
}

.asst-inline.is-done {
    opacity: 0.55;
}

.asst-inline.is-done .asst-btn {
    cursor: default;
}

/* Small text button inside lists (Remove) */
.asst-link {
    display: inline-block;
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ukm-red);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.asst-link:hover {
    text-decoration: underline;
}

/* Help: grouped, tappable examples */
.asst-group {
    margin: 14px 0 6px !important;
    font-family: var(--ukm-display);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase !important;
    color: var(--ukm-red);
}

.asst-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.asst-example {
    padding: 6px 10px;
    border: 1px solid var(--ukm-line);
    border-radius: 2px;
    background: var(--ukm-paper);
    color: var(--ukm-ink);
    font-size: 12.5px;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}

.asst-example:hover {
    border-color: var(--ukm-navy);
    background: var(--ukm-white);
}

/* Compare table */
.asst-table {
    margin-top: 10px;
    overflow-x: auto;
}

.asst-compare {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.asst-compare th,
.asst-compare td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--ukm-line);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}

.asst-compare thead th {
    border-bottom: 2px solid var(--ukm-ink);
    font-family: var(--ukm-display);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
}

.asst-compare tbody th {
    font-weight: 500;
    color: var(--ukm-body);
}

.asst-compare td {
    color: var(--ukm-ink);
    font-weight: 500;
}

/*--- Quick replies, input, footer ---*/
.asst-chips {
    display: flex;
    flex: none;
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
    background: var(--ukm-white);
    border-top: 1px solid var(--ukm-line);
    scrollbar-width: none;
}

.asst-chips:empty {
    display: none;
}

.asst-chips::-webkit-scrollbar {
    display: none;
}

.asst-chip {
    flex: none;
    height: 34px;
    padding: 0 12px;
    border: 1.5px solid var(--ukm-navy);
    border-radius: 2px;
    background: var(--ukm-white);
    color: var(--ukm-navy);
    font-family: var(--ukm-display);
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.asst-chip:hover {
    background: var(--ukm-navy);
    color: var(--ukm-white);
}

.asst-form {
    display: flex;
    flex: none;
    border-top: 1px solid var(--ukm-line);
}

.asst-form input {
    flex: 1;
    min-width: 0;
    height: 52px;
    padding: 0 14px;
    border: 0;
    background: var(--ukm-white);
    color: var(--ukm-ink);
    font-size: 15px;
}

.asst-form input:focus-visible {
    outline: 2px solid var(--ukm-navy);
    outline-offset: -2px;
}

.asst-form button {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 0;
    background: var(--ukm-red);
    color: var(--ukm-white);
    cursor: pointer;
}

.asst-form button:hover {
    background: var(--ukm-red-deep);
}

.asst-form button:focus-visible {
    outline: 3px solid var(--ukm-navy);
    outline-offset: -3px;
}

.asst-form button svg {
    width: 20px;
    height: 20px;
}

.asst-foot {
    flex: none;
    margin: 0;
    padding: 6px 12px 8px;
    background: var(--ukm-white);
    font-size: 11px;
    text-align: center;
    color: var(--ukm-body);
}

.asst-foot a {
    color: var(--ukm-navy);
    text-decoration: underline;
}

/*--- Motion ---*/
@keyframes asst-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
}

@keyframes asst-dot {
    0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
    #ukm-assistant,
    #ukm-assistant * {
        animation: none !important;
        transition: none !important;
    }
}

/*--- Phones: full-screen panel ---*/
html.asst-locked {
    overflow: hidden;
}

@media (max-width: 575.98px) {
    #ukm-assistant {
        right: 16px;
        bottom: 16px;
    }

    #ukm-assistant.is-lifted {
        bottom: 88px;
    }

    .asst-launcher,
    .asst-launcher__icon {
        height: 56px;
    }

    .asst-launcher__icon {
        width: 56px;
    }

    #ukm-assistant.is-open .asst-launcher {
        display: none;
    }

    /* Icon only on phones, so the launcher never covers page buttons */
    #ukm-assistant.is-intro .asst-launcher__label,
    .asst-launcher:hover .asst-launcher__label {
        max-width: 0;
        padding-right: 0;
        opacity: 0;
    }

    .asst-panel {
        position: fixed;
        inset: 0;
        width: auto;
        height: auto;
        border-top: 0;
        animation-name: asst-up;
    }

    .asst-head {
        padding-top: calc(14px + env(safe-area-inset-top));
    }

    .asst-foot {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }

    .asst-msg {
        max-width: 94%;
    }

    @keyframes asst-up {
        from { transform: translateY(100%); }
    }
}
