/* Замена Telegram WebApp MainButton / BackButton для браузера */

.shop-webapp-main-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    padding: 0 16px calc(12px + env(safe-area-inset-bottom, 0));
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.shop-webapp-main-wrap[hidden] {
    display: none !important;
}

.shop-webapp-main-wrap.is-visible {
    pointer-events: auto;
}

.shop-webapp-main-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 48px;
    padding: 12px 20px;
    margin: 0;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    background-color: var(--shop-webapp-main-bg, var(--main-color, #3390ec));
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    -webkit-tap-highlight-color: transparent;
}

.shop-webapp-main-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.shop-webapp-main-btn:not(:disabled):active {
    transform: scale(0.99);
}

html.shop-webapp-pad-bottom {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
}

.shop-webapp-back-btn {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top, 0));
    left: 12px;
    z-index: 1035;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: var(--theme-secondary-text-color, #333);
    background: var(--theme-secondary-bg-color, rgba(255, 255, 255, 0.92));
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.shop-webapp-back-btn[hidden] {
    display: none !important;
}

.shop-webapp-back-btn:not([hidden]):active {
    transform: scale(0.96);
}

/* Диалоги showConfirm / showAlert */
.shop-webapp-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
}

.shop-webapp-dialog {
    width: 100%;
    max-width: 340px;
    max-height: min(70vh, 420px);
    overflow: auto;
    padding: 20px 20px 16px;
    border-radius: 14px;
    background: var(--theme-secondary-bg-color, #fff);
    color: var(--theme-secondary-text-color, #1a1a1a);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.shop-webapp-dialog__text {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.shop-webapp-dialog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.shop-webapp-dialog__btn {
    min-width: 88px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.shop-webapp-dialog__btn--secondary {
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
}

.shop-webapp-dialog__btn--primary {
    background-color: var(--shop-webapp-main-bg, var(--main-color, #3390ec));
    color: #fff;
}
