/* ==========================================================================
   Modal base + Variation Switcher
   ========================================================================== */

.tsc-modal {
    position: fixed;
    inset: 0;
    /* Must beat .tsc-cart__bottombar (11111111111). Using !important so it
       wins over the per-modal id overrides that set lower values. */
    z-index: 99999999999 !important;
    display: none;
}
.tsc-modal.is-open { display: block; }

.tsc-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.tsc-modal.is-open .tsc-modal__backdrop { opacity: 1; }

.tsc-modal__sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: env(safe-area-inset-bottom);
}
.tsc-modal.is-open .tsc-modal__sheet { transform: translateY(0); }

.tsc-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #ececef;
}
.tsc-modal__title {
    font-size: 16px;
    font-weight: 600;
    color: #161823;
    margin: 0;
}
.tsc-modal__close {
    background: none !important;
    border: 0;
    padding: 4px;
    cursor: pointer;
    color: #8a8b91 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tsc-modal__body {
    flex: 1;
    overflow-y: auto;
    padding: 2em;
}

.tsc-modal__loading,
.tsc-modal__error {
    text-align: center;
    padding: 30px 16px;
    color: #8a8b91;
    font-size: 14px;
}
.tsc-modal__error { color: #dc2626; }

/* Currently-selected variation header */
.tsc-modal__current {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.tsc-modal__current-thumb {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f5f5f7;
}
.tsc-modal__current-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tsc-modal__current-info {
    flex: 1;
    min-width: 0;
}
.tsc-modal__current-price {
    color: #161823;
    font-size: 18px;
    font-weight: 600;
}
.tsc-modal__current-price .woocommerce-Price-amount { color: #161823; }
.tsc-modal__current-stock {
    font-size: 12px;
    color: #8a8b91;
    margin-top: 4px;
}

.tsc-modal__attribute { margin-bottom: 18px; }
.tsc-modal__attribute-label {
    font-size: 13px;
    color: #8a8b91;
    margin-bottom: 8px;
}
.tsc-modal__attribute-label strong {
    color: #161823;
    font-weight: 600;
}
.tsc-modal__attribute-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tsc-modal__option {
    background: #f5f5f7 !important;
    border: 1.5px solid transparent;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13px;
    color: #161823 !important;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.tsc-modal__option.is-selected {
    background: #f0f0f0 !important;
    color: #161823 !important;
    border-color: #161823;
}
.tsc-modal__option.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: line-through;
}

.tsc-modal__footer {
    padding: 12px 16px;
    border-top: 1px solid #ececef;
}
.tsc-modal__confirm {
    display: block;
    width: 100%;
    background: var(--global-palette-btn-bg, #161823) !important;
    color: var(--global-palette-btn, #fff) !important;
    border: 0;
    border-radius: 999px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.tsc-modal__confirm:disabled {
    background: #ececef !important;
    color: #8a8b91 !important;
    cursor: not-allowed;
}