/* Theme demo switcher — sits above theme back-to-top buttons and mobile bottom bars. */
.tds {
    --tds-ink: #16181d;
    --tds-muted: #6b7079;
    --tds-line: rgba(22, 24, 29, 0.08);
    --tds-surface: #ffffff;
    --tds-highlight: #f4f1ea;
    --tds-success: #1f8a4c;
    --tds-ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
    position: fixed;
    left: 16px;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    z-index: 2147483000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    font-family: "Plus Jakarta Sans", "Manrope", "Segoe UI", system-ui, "Noto Sans Bengali", "Hind Siliguri", sans-serif;
    font-size: 14px;
    line-height: 1.35;
    color: var(--tds-ink);
    text-align: left;
}

.tds *,
.tds *::before,
.tds *::after {
    box-sizing: border-box;
}

.tds button {
    appearance: none;
    margin: 0;
    font: inherit;
    color: inherit;
    letter-spacing: normal;
    text-transform: none;
    min-height: 0;
    min-width: 0;
    cursor: pointer;
}

.tds p {
    margin: 0;
}

.tds [hidden] {
    display: none !important;
}

/* ── Toggle ─────────────────────────────────────────── */
.tds .tds-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px 7px 7px;
    border: 0;
    border-radius: 999px;
    background: var(--tds-ink);
    color: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    transition: transform 0.2s var(--tds-ease-pop), box-shadow 0.2s ease;
    animation: tds-rise 0.5s var(--tds-ease-pop) backwards;
}

.tds .tds-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
}

.tds .tds-toggle:active {
    transform: scale(0.97);
}

.tds .tds-toggle::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: 0 0 0 0 rgba(22, 24, 29, 0.45);
    animation: tds-pulse 2.2s ease-out 1s infinite;
}

.tds.is-seen .tds-toggle::after,
.tds .tds-toggle[aria-expanded="true"]::after {
    animation: none;
}

.tds .tds-toggle__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    background: conic-gradient(var(--tds-primary, #4a7c59) 0 50%, var(--tds-accent, #c4a574) 50% 100%);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.tds .tds-toggle__icon svg {
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}

.tds .tds-toggle[aria-expanded="true"] .tds-toggle__icon {
    animation: tds-spin-in 0.45s var(--tds-ease-pop);
}

.tds .tds-toggle__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.tds .tds-toggle__eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.62);
}

.tds .tds-toggle__name {
    font-size: 14px;
    font-weight: 700;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tds .tds-toggle__chevron {
    display: grid;
    place-items: center;
    margin-left: 2px;
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.25s var(--tds-ease-pop);
}

.tds .tds-toggle[aria-expanded="true"] .tds-toggle__chevron {
    transform: rotate(180deg);
}

/* ── Speech bubble with popping words ──────────────── */
.tds .tds-bubble {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 260px;
    margin-left: 6px;
    padding: 10px 10px 10px 14px;
    border-radius: 14px;
    background: var(--tds-surface);
    border: 1px solid var(--tds-line);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.16);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transform-origin: 22px 100%;
    opacity: 0;
    transform: translateY(8px) scale(0.85);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tds .tds-bubble.is-in {
    opacity: 1;
    transform: none;
    animation: tds-bubble-pop 0.45s var(--tds-ease-pop);
}

.tds .tds-bubble::after {
    content: "";
    position: absolute;
    left: 22px;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: inherit;
    border-right: 1px solid var(--tds-line);
    border-bottom: 1px solid var(--tds-line);
    transform: rotate(45deg);
}

.tds .tds-bubble.is-success {
    background: #effaf3;
    border-color: rgba(31, 138, 76, 0.25);
}

.tds .tds-bubble.is-success .tds-bubble__text strong {
    color: var(--tds-success);
}

.tds .tds-bubble__text {
    flex: 1 1 auto;
}

.tds .tds-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(6px) scale(0.6);
    animation: tds-word-pop 0.42s var(--tds-ease-pop) forwards;
    animation-delay: var(--d, 0ms);
}

.tds .tds-bubble__close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(22, 24, 29, 0.06);
    color: var(--tds-muted);
    font-size: 16px;
    line-height: 1;
}

.tds .tds-bubble__close:hover {
    background: rgba(22, 24, 29, 0.12);
    color: var(--tds-ink);
}

/* ── Panel ─────────────────────────────────────────── */
.tds .tds-panel {
    width: 300px;
    max-height: min(70vh, 560px);
    display: flex;
    flex-direction: column;
    background: var(--tds-surface);
    border: 1px solid var(--tds-line);
    border-radius: 18px;
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    transform-origin: 24px 100%;
    opacity: 0;
    transform: translateY(12px) scale(0.92);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.tds .tds-panel.is-open {
    opacity: 1;
    transform: none;
    transition: opacity 0.22s ease, transform 0.32s var(--tds-ease-pop);
}

.tds .tds-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 14px 10px 16px;
    border-bottom: 1px solid var(--tds-line);
}

.tds .tds-panel__title {
    font-size: 15px;
    font-weight: 800;
}

.tds .tds-panel__hint {
    margin-top: 3px !important;
    font-size: 12px;
    color: var(--tds-muted);
}

.tds .tds-panel__close {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(22, 24, 29, 0.06);
    color: var(--tds-muted);
    font-size: 18px;
    line-height: 1;
}

.tds .tds-panel__close:hover {
    background: rgba(22, 24, 29, 0.12);
    color: var(--tds-ink);
}

.tds .tds-panel__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.tds .tds-panel__foot {
    padding: 8px 16px 12px;
    border-top: 1px solid var(--tds-line);
    font-size: 11px;
    color: var(--tds-muted);
}

.tds .tds-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    text-align: left;
    transition: background 0.15s ease, transform 0.15s ease;
}

.tds .tds-panel.is-open .tds-item {
    animation: tds-item-in 0.38s var(--tds-ease-pop) both;
    animation-delay: calc(var(--i, 0) * 35ms + 60ms);
}

.tds .tds-item:hover {
    background: var(--tds-highlight);
}

.tds .tds-item:hover .tds-item__go {
    opacity: 1;
    transform: translateX(0);
}

.tds .tds-item:hover .tds-swatch {
    transform: scale(1.12) rotate(-12deg);
}

.tds .tds-item.is-active {
    background: var(--tds-ink);
    color: #fff;
    cursor: default;
}

.tds .tds-item.is-active .tds-item__industry {
    color: rgba(255, 255, 255, 0.65);
}

.tds .tds-swatch {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: conic-gradient(var(--tds-primary, #333) 0 50%, var(--tds-accent, #999) 50% 100%);
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.25s var(--tds-ease-pop);
}

.tds .tds-item__text {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
}

.tds .tds-item__name {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tds .tds-item__industry {
    font-size: 12px;
    font-weight: 500;
    color: var(--tds-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tds .tds-item__badge {
    flex: 0 0 auto;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tds .tds-item__go {
    flex: 0 0 auto;
    font-size: 16px;
    color: var(--tds-muted);
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.15s ease, transform 0.2s var(--tds-ease-pop);
}

.tds .tds-toggle:focus-visible,
.tds .tds-item:focus-visible,
.tds .tds-panel__close:focus-visible,
.tds .tds-bubble__close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* ── Switching overlay ─────────────────────────────── */
.tds .tds-loading {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.tds .tds-loading.is-in {
    opacity: 1;
}

.tds .tds-loading__card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 999px;
    background: var(--tds-ink);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
    transform: scale(0.8);
    transition: transform 0.35s var(--tds-ease-pop);
}

.tds .tds-loading.is-in .tds-loading__card {
    transform: none;
}

.tds .tds-loading__spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    animation: tds-spin 0.7s linear infinite;
}

.tds.is-switching .tds-toggle,
.tds.is-switching .tds-panel {
    pointer-events: none;
}

/* ── Keyframes ─────────────────────────────────────── */
@keyframes tds-rise {
    from { opacity: 0; transform: translateY(16px) scale(0.9); }
    to { opacity: 1; transform: none; }
}

@keyframes tds-pulse {
    0% { box-shadow: 0 0 0 0 rgba(22, 24, 29, 0.4); }
    70% { box-shadow: 0 0 0 14px rgba(22, 24, 29, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 24, 29, 0); }
}

@keyframes tds-bubble-pop {
    0% { opacity: 0; transform: translateY(10px) scale(0.6); }
    100% { opacity: 1; transform: none; }
}

@keyframes tds-word-pop {
    0% { opacity: 0; transform: translateY(6px) scale(0.6); }
    100% { opacity: 1; transform: none; }
}

@keyframes tds-item-in {
    from { opacity: 0; transform: translateY(8px) scale(0.96); }
    to { opacity: 1; transform: none; }
}

@keyframes tds-spin-in {
    from { transform: rotate(-90deg) scale(0.8); }
    to { transform: none; }
}

@keyframes tds-spin {
    to { transform: rotate(360deg); }
}

/* ── Mobile: clear theme bottom app bars ───────────── */
@media (max-width: 991.98px) {
    .tds {
        left: 12px;
        bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    }

    .tds .tds-panel {
        width: min(300px, calc(100vw - 24px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .tds *,
    .tds *::before,
    .tds *::after,
    .tds .tds-toggle {
        animation: none !important;
        transition: none !important;
    }

    .tds .tds-word {
        opacity: 1;
        transform: none;
    }
}
