/* Assisted Service Mode header — self-contained addon styles.
   Scoped under #_asm; no dependency on storefront theme CSS. */

#_asm {
    --asm-red: #c0111f;
    --asm-red-dark: #8e0b16;
    --asm-red-link: #b3111f;
    --asm-amber: #ffe08a;
    --asm-green: #0f8a4a;
    --asm-green-dark: #0c7440;
    --asm-green-glow: #3ee08a;
    --asm-hover: #fff5f6;
    --asm-ink: #14161a;
    --asm-ink-soft: #4a4f57;
    --asm-ink-faint: #8a8f98;
    --asm-radius: 10px;
    --asm-result-height: 56px;
    --asm-head-height: 33px;
    --asm-font: Ubuntu, Helvetica, Arial, sans-serif;
    --asm-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    position: relative;
    z-index: 1030;
    background: var(--asm-red);
    color: #fff;
    font-family: var(--asm-font);
    font-size: 13px;
    line-height: 1.35;
    box-shadow: 0 6px 18px -6px rgba(120, 10, 20, 0.55);
}

#_asm *,
#_asm *::before,
#_asm *::after {
    box-sizing: border-box;
}

#_asm form {
    margin: 0;
}

#_asm button {
    font-family: var(--asm-font);
}

#_asm input::placeholder {
    color: #a3a8b0;
    opacity: 1;
}

@keyframes asmFadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes asmGlow {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

@keyframes asmLiveRing {
    0% { box-shadow: 0 0 0 0 rgba(46, 214, 124, 0.55); }
    70% { box-shadow: 0 0 0 8px rgba(46, 214, 124, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 214, 124, 0); }
}

.asm__inner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 12px 24px;
}

/* brand cluster */

.asm__brand {
    flex: none;
    padding-right: 16px;
    border-right: 1px solid rgba(255, 255, 255, 0.28);
}

.asm__brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    white-space: nowrap;
}

.asm__title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.asm__dot {
    position: relative;
    top: -0.1em; /* optical centre on the cap height, not the line box */
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffd9dd;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22);
    flex: none;
}

.asm__hint,
.asm__timerline {
    display: flex;
    align-items: center;
    gap: 7px;
    padding-left: 14px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
}

.asm__mono {
    font-family: var(--asm-mono);
    font-size: 12px;
    font-weight: 600;
}

.asm__timerline--warn .asm__countdown {
    color: var(--asm-amber);
}

.asm__reset-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 19px;
    padding: 0 7px;
    border: 0;
    flex: none;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.asm__reset-pill:hover {
    background: rgba(255, 255, 255, 0.32);
}

/* shared controls */

.asm__input {
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--asm-radius);
    background: #fff;
    font-family: var(--asm-font);
    font-size: 13px;
    font-weight: 500;
    color: var(--asm-ink);
    outline: none;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    min-width: 0;
}

.asm__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding: 0 18px;
    border: 0;
    flex: none;
    border-radius: var(--asm-radius);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.asm__btn--ghost {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.asm__btn--ghost:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* state 1 — login */

.asm__login {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.asm__input--username {
    flex: 1 1 150px;
}

.asm__input--password {
    flex: 1 1 130px;
}

.asm__input--store {
    flex: 0 1 110px;
}

.asm__btn--login {
    background: #fff;
    color: var(--asm-red-link);
    box-shadow: 0 2px 6px rgba(80, 6, 12, 0.28);
}

.asm__btn--login:hover {
    background: var(--asm-hover);
}

.asm__btn--login:disabled {
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.55);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
    cursor: not-allowed;
}

.asm__close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    flex: none;
    margin-left: auto;
    border-radius: var(--asm-radius);
    background: rgba(0, 0, 0, 0.18);
    color: #fff;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.asm__close:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* state 2 — customer search */

.asm__new-customer-form {
    flex: none;
}

.asm__search {
    position: relative;
    flex: 1 1 300px;
    min-width: 190px;
    max-width: 460px;
}

.asm__search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    border-radius: var(--asm-radius);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.35);
    color: var(--asm-ink-faint);
}

.asm__search-input {
    flex: 1 1 0;
    min-width: 0;
    border: 0;
    outline: none;
    font-family: var(--asm-font);
    font-size: 14px;
    font-weight: 500;
    color: var(--asm-ink);
    background: transparent;
}

.asm__search-clear {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 0;
    flex: none;
    border-radius: 50%;
    background: #f0f1f3;
    color: #5d626b;
    cursor: pointer;
}

.asm__search-clear:hover {
    background: #e2e4e8;
    color: var(--asm-ink);
}

.asm__dropdown {
    position: absolute;
    top: 48px;
    right: 0;
    width: 600px;
    min-width: 320px;
    max-width: 92vw;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 18px 40px -12px rgba(15, 18, 24, 0.35), 0 0 0 1px rgba(15, 18, 24, 0.08);
    overflow: hidden;
    animation: asmFadeIn 0.18s ease-out both;
    z-index: 40;
    color: var(--asm-ink);
}

.asm__dropdown-head,
.asm__result {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 12px;
    align-items: center;
    padding: 11px 14px;
}

.asm__dropdown-head {
    /* inside the scroller so header and rows share the same width when it scrolls */
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 14px;
    background: #f7f8f9;
    border-bottom: 1px solid #eceef1;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--asm-ink-faint);
}

.asm__dropdown-list {
    max-height: calc(var(--asm-result-height) * 10 + var(--asm-head-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #c8ccd2 transparent;
}

.asm__dropdown-list::-webkit-scrollbar {
    width: 8px;
}

.asm__dropdown-list::-webkit-scrollbar-thumb {
    background: #c8ccd2;
    border-radius: 4px;
}

.asm__result {
    min-height: var(--asm-result-height);
    scroll-margin-top: var(--asm-head-height);
    cursor: pointer;
    border-bottom: 1px solid #f2f3f5;
}

.asm__result:hover,
.asm__result--active {
    background: var(--asm-hover);
}

.asm__result-customer {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.asm__result-avatar {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fdecee;
    color: var(--asm-red-link);
    font-size: 11px;
    font-weight: 600;
    flex: none;
}

.asm__result-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.asm__result-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asm__result-dob {
    font-size: 11px;
    color: var(--asm-ink-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asm__result-email {
    font-size: 13px;
    color: var(--asm-ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asm__dropdown-empty {
    padding: 14px;
    font-size: 12px;
    color: var(--asm-ink-faint);
}

.asm__dropdown-foot {
    display: flex;
    justify-content: space-between;
    padding: 9px 14px;
    font-size: 11px;
    color: var(--asm-ink-faint);
}

.asm__start-form {
    flex: none;
}

.asm__btn--start {
    gap: 8px;
    background: var(--asm-green);
    color: #fff;
    box-shadow: 0 2px 8px rgba(8, 60, 32, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.asm__btn--start:hover {
    background: var(--asm-green-dark);
}

.asm__btn--start:disabled {
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    cursor: not-allowed;
}

/* state 3 — live session */

.asm__live {
    display: flex;
    align-items: center;
    gap: 11px;
    white-space: nowrap;
    flex: none;
    padding: 5px 16px 5px 6px;
    border-radius: 999px;
    background: var(--asm-green);
    animation: asmLiveRing 2.2s ease-out infinite;
}

.asm__live-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #fff;
    color: var(--asm-green-dark);
    font-size: 11px;
    font-weight: 700;
    flex: none;
}

.asm__live-dot {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--asm-green-glow);
    box-shadow: 0 0 0 2px var(--asm-green);
    animation: asmGlow 1.6s ease-in-out infinite;
}

.asm__live-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.asm__live-name {
    font-size: 13px;
    font-weight: 600;
}

.asm__live-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.92);
}

.asm__live-email {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.asm__live-label {
    font-weight: 700;
    letter-spacing: 0.1em;
}

.asm__end-form {
    flex: none;
}

/* agent chip */

.asm__agent {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: none;
    margin-left: auto;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
}

.asm__agent-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    white-space: nowrap;
}

.asm__agent-name {
    font-size: 13px;
    font-weight: 600;
}

.asm__agent-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

.asm__logout {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    flex: none;
    border-radius: 9px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.asm__logout svg {
    transform: translateY(-0.5px); /* optical: the power glyph is bottom-heavy */
}

.asm__logout:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* error banner */

.asm__error {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    background: var(--asm-red-dark);
    animation: asmFadeIn 0.18s ease-out both;
}

.asm__error > svg {
    flex: none;
}

.asm__error-msg {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
}

.asm__error-close {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border: 0;
    flex: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
}

.asm__error-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* responsive */

@media (max-width: 1100px) {
    .asm__brand {
        border-right: 0;
        padding-right: 0;
    }

    .asm__search {
        flex: 1 1 100%;
        max-width: none;
        order: 10;
    }

    .asm__dropdown {
        position: static;
        width: 100%;
        margin-top: 8px;
    }
}
