/* ============================================================
   App Switcher — Ecosystem Product Launcher v1.0.0
   ============================================================ */


/* WOFF2 nhỏ hơn TTF 66% — browser ưu tiên WOFF2, TTF chỉ là fallback cho IE */
@font-face {
    font-family: 'Roboto-Medium';
    src: url(/fonts/Roboto/Roboto-Medium.woff2) format('woff2'),
         url(/fonts/Roboto/Roboto-Medium.ttf)   format('truetype');
    font-weight: 500;
    font-display: swap;
}

/* ---- Design tokens — đổi --asi-brand để retheme toàn bộ component ---- */
.asi-wrapper {
    --asi-brand:       #1967B1;
    --asi-brand-rgb:   25, 103, 177;
    --asi-radius:      12px;
    --asi-ease:        0.18s ease;
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* ---- Trigger button ---- */
/* display/padding dùng !important vì Bootstrap .navbar-nav .nav-link (specificity 0,2,0)
   ghi đè nếu không có, làm tăng chiều cao navbar và vỡ tab nav bên dưới */
.asi-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0.25rem !important;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    aspect-ratio: 1;
    flex-shrink: 0;
    user-select: none;
    transition: background-color 0.15s ease;
}

.asi-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.asi-btn img {
    display: block;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

/* ---- Popup ---- */
.asi-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1050;
    width: 332px;
    padding: 28px 0 20px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--asi-radius);
    box-shadow:
        0 2px 4px  rgba(0, 0, 0, 0.04),
        0 8px 20px rgba(0, 0, 0, 0.10),
        0 20px 40px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* ---- Header popup ---- */
/* width: 256px = 332 - 2×38 theo Figma */
.asi-header {
    width: 256px;
    margin: 0 auto;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(var(--asi-brand-rgb), 0.25);
}

.asi-header-box {
    font-family: 'Roboto-Medium', sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.5;
    color: var(--asi-brand);
    text-align: center;
}

/* ---- Product grid ---- */
.asi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 0;
    padding: 0 16px;
    margin-top: 17px;
}

/* ---- Product item ---- */
.asi-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    width: 108px;
    margin: 0 auto;
    padding: 8px 6px;
    gap: 6px;
    border: none;
    border-radius: 10px;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    outline: none;
    user-select: none;
    transition:
        background-color var(--asi-ease),
        box-shadow      var(--asi-ease),
        transform       var(--asi-ease);
}

.asi-item:hover {
    background-color: rgba(var(--asi-brand-rgb), 0.07);
    box-shadow: 0 4px 12px rgba(var(--asi-brand-rgb), 0.12);
    transform: translateY(-2px);
    text-decoration: none;
}

.asi-item:active {
    background-color: rgba(var(--asi-brand-rgb), 0.13);
    box-shadow: 0 1px 3px rgba(var(--asi-brand-rgb), 0.10);
    transform: translateY(0);
}

.asi-item:focus-visible {
    outline: 2px solid rgba(var(--asi-brand-rgb), 0.5);
    outline-offset: 2px;
}

.asi-item img {
    display: block;
    flex-shrink: 0;
    width: 88px;
    height: 28px;
    object-fit: contain;
}

.asi-item:hover img,
.asi-item:active img {
    mix-blend-mode: multiply;
}

/* ---- Description text ---- */
.asi-item-desc {
    font-size: 12px;
    line-height: 1.4;
    color: #5A5A5A;
    text-align: center;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--asi-ease);
}

.asi-item:hover .asi-item-desc {
    color: var(--asi-brand);
}

/* ---- Accessibility: tắt animation cho user đã bật prefers-reduced-motion ---- */
@media (prefers-reduced-motion: reduce) {
    .asi-btn,
    .asi-item,
    .asi-item-desc { transition: none; }

    .asi-item:hover { transform: none; }
}

/* ---- Responsive — 767.98px theo Bootstrap 4 breakpoint standard ---- */
@media (max-width: 767.98px) {
    .asi-popup {
        width: calc(100vw - 16px);
        right: -8px;
    }

    .asi-grid {
        grid-template-columns: 1fr;
    }
}
