/* ===== Modal Overlay ===== */
.hd-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.hd-modal-overlay.active {
    display: flex;
}

/* ===== Modal Container ===== */
.hd-modal {
    background: #fdffff;
    border-radius: 30px;
    position: relative;
    width: 100%;
    max-width: 315px;
    box-sizing: border-box;
    animation: hd-modal-fadein 0.25s ease;
}

@keyframes hd-modal-fadein {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Close Button ===== */
.hd-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    line-height: 0;
}

.hd-modal__close img {
    width: 100%;
    height: 100%;
}

/* --- Shared typography --- */
.hd-modal * {
    font-family: "Montserrat", sans-serif;
    box-sizing: border-box;
}

.hd-modal__title {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.4;
    color: #28314d;
    text-transform: uppercase;
    margin: 0;
}

/* =============================================
   Modal 1 — Confirm recording (SMS code)
   ============================================= */
.hd-modal--confirm {
    padding: 50px 25px 30px;
}

.hd-modal--confirm .hd-modal__title {
    text-align: center;
}

.hd-modal--confirm .hd-modal__body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hd-modal--confirm__info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-weight: 500;
    font-size: 12px;
    line-height: 1.4;
    color: #28314d;
}

.hd-modal--confirm__info p {
    margin: 0;
}

/* Code inputs */
.hd-modal--confirm__code {
    display: flex;
    gap: 10px;
}

.hd-modal--confirm__code input {
    width: 58px;
    height: 40px;
    border: 1px solid #979ca9;
    border-radius: 10px;
    background: #fdffff;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    font-family: "Montserrat", sans-serif;
    outline: none;
    color: #28314d;
}

.hd-modal--confirm__code input:focus {
    border-color: #28314d;
}

/* Resend */
.hd-modal--confirm__resend {
    font-size: 12px;
    line-height: 1.4;
    color: #28314d;
}

.hd-modal--confirm__resend p {
    margin: 0;
    font-weight: 500;
}

.hd-modal--confirm__resend-row {
    display: flex;
    gap: 3px;
    align-items: center;
}

.hd-modal--confirm__resend-row strong {
    font-weight: 700;
}

.hd-modal--confirm__resend-row span {
    font-weight: 500;
}

/* =============================================
   Modal 2 — SBP QR Payment
   ============================================= */
.hd-modal--sbp {
    padding: 50px 25px 30px;
}

.hd-modal--sbp .hd-modal__body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hd-modal--sbp__header {
    display: flex;
    flex-direction: column;
    gap: 11px; /* цена под заголовком — 11px */
    text-align: center;
    width: 100%;
    margin-bottom: 29px; /* header → лого СБП */
}

.hd-modal--sbp__price {
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
    color: #28314d;
    text-transform: uppercase;
    margin: 0;
}

.hd-modal--sbp__logo {
    width: 54px;
    height: 30px;
    object-fit: contain;
    margin-bottom: 30px; /* лого → QR */
}

.hd-modal--sbp__qr {
    width: 160px;
    height: 160px;
    margin-bottom: 36px; /* QR → текст подсказки */
}

.hd-modal--sbp__qr img {
    width: 100%;
    height: 100%;
}

.hd-modal--sbp__hint {
    font-weight: 500;
    font-size: 12px;
    line-height: 1.4;
    color: #28314d;
    text-align: center;
    margin: 0 0 20px; /* подсказка → оферта */
}

.hd-modal--sbp__terms {
    font-weight: 500;
    font-size: 12px;
    line-height: 1.4;
    color: #28314d;
    text-align: center;
    margin: 0;
}

/* =============================================
   Modal 3 — Card Payment
   ============================================= */
.hd-modal--card {
    padding: 50px 25px 30px;
    max-width: 410px;
}

.hd-modal--card .hd-modal__body {
    display: flex;
    flex-direction: column;
    gap: 31px;
}

.hd-modal--card__form {
    background: #ebf5ff;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hd-modal--card__input {
    background: #fdffff;
    border-radius: 10px;
    border: none;
    height: 40px;
    padding: 11px 12px;
    font-family: "Montserrat", sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.3;
    color: #28314d;
    width: 100%;
    outline: none;
}

.hd-modal--card__input::placeholder {
    color: #979ca9;
}

.hd-modal--card__row {
    display: flex;
    gap: 10px;
}

.hd-modal--card__row .hd-modal--card__input {
    width: 50%;
}

.hd-modal--card__submit {
    width: 100%;
    height: 40px;
    background: #28314d;
    border: none;
    border-radius: 50px;
    font-family: "Montserrat", sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.5;
    color: #fdffff;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.2s;
}

.hd-modal--card__submit:hover {
    opacity: 0.85;
}

/* ===== Demo page ===== */
.modal-demo {
    max-width: 600px;
    margin: 80px auto;
    padding: 40px;
    text-align: center;
}

.modal-demo h1 {
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    font-size: 24px;
    color: #28314d;
    margin-bottom: 30px;
}

.modal-demo__buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.modal-demo__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 360px;
    height: 50px;
    background: #28314d;
    border: none;
    border-radius: 50px;
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: #fdffff;
    cursor: pointer;
    transition: opacity 0.2s;
}

.modal-demo__btn:hover {
    opacity: 0.85;
}

.modal-demo__btn--outline {
    background: transparent;
    border: 2px solid #28314d;
    color: #28314d;
}

.modal-demo__btn--outline:hover {
    background: #28314d;
    color: #fdffff;
}

/* =============================================
   Modal 4 — Success / Install App
   ============================================= */
.hd-modal--success {
    max-width: 950px;
    padding: 45px 0 40px 40px;
    overflow: hidden;
}

.hd-modal--success .hd-modal__close {
    right: 20px;
    top: 20px;
}

.hd-modal--success .hd-modal__body {
    display: flex;
    flex-direction: column;
    gap: 50px;
}

/* --- Top block: title + benefits --- */
.hd-modal--success__top {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.hd-modal--success__heading {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.hd-modal--success__heading h2 {
    font-weight: 700;
    font-size: 22px;
    line-height: 1.2;
    color: #3b3c41;
    text-transform: uppercase;
    margin: 0;
}

.hd-modal--success__app-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.hd-modal--success__app-row h2 {
    white-space: nowrap;
}

.hd-modal--success__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    height: 50px;
    border-radius: 175px;
    background: linear-gradient(90deg, #dc4b8f 0%, #4b59d5 100%);
    font-weight: 700;
    font-size: 22px;
    line-height: 1.2;
    color: #fdffff;
    text-transform: uppercase;
    white-space: nowrap;
}

.hd-modal--success__benefits {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hd-modal--success__benefits-title {
    font-weight: 400;
    font-size: 20px;
    line-height: 1.4;
    color: #3b3c41;
    margin: 0;
}

.hd-modal--success__benefits-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.hd-modal--success__benefits-list li {
    display: flex;
    gap: 14px;
    align-items: center;
    font-weight: 400;
    font-size: 20px;
    line-height: 1.4;
    color: #3b3c41;
}

.hd-modal--success__benefits-list li::before {
    content: "";
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b3c41;
}

/* --- Bottom block: QR + stores + bonuses --- */
.hd-modal--success__bottom {
    display: flex;
    gap: 95px;
    align-items: flex-end;
}

/* QR + Stores column */
.hd-modal--success__install {
    display: flex;
    gap: 0;
    align-items: flex-end;
}

.hd-modal--success__qr-col {
    display: flex;
    flex-direction: column;
    gap: 13px;
    width: 188px;
}

.hd-modal--success__qr-label {
    font-weight: 400;
    font-size: 12px;
    line-height: 1.2;
    color: #3b3c41;
    margin: 0;
}

.hd-modal--success__qr-img {
    width: 165px;
    height: 165px;
}

.hd-modal--success__qr-img img {
    width: 100%;
    height: 100%;
}

.hd-modal--success__stores-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hd-modal--success__stores-label {
    font-weight: 400;
    font-size: 10px;
    line-height: 1.5;
    color: #3b3c41;
    margin: 0;
}

.hd-modal--success__stores-label-mobile {
    display: none;
}

.hd-modal--success__stores-grid {
    display: grid;
    grid-template-columns: auto auto;
    gap: 4px 5px;
}

.hd-modal--success__stores-grid img {
    height: 28px;
    width: auto;
}

/* Bonuses card */
.hd-modal--success__bonuses {
    background: #e2f0ff;
    border-radius: 25px 0 0 25px;
    padding: 30px 27px 26px;
    display: flex;
    align-items: center;
    position: relative;
    min-height: 189px;
    flex: 1;
}

.hd-modal--success__bonuses-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 197px;
    position: relative;
    z-index: 1;
}

.hd-modal--success__bonuses-title {
    font-weight: 400;
    font-size: 12px;
    line-height: 1.4;
    color: #3b3c41;
    margin: 0;
}

.hd-modal--success__bonuses-amount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    height: 41px;
    width: 132px;
    border-radius: 175px;
    background: linear-gradient(90deg, #dc4b8f 0%, #4b59d5 100%);
    font-weight: 600;
    font-size: 23px;
    line-height: 1.2;
    color: #fdffff;
    text-transform: uppercase;
}

.hd-modal--success__bonuses-desc {
    font-weight: 400;
    font-size: 12px;
    line-height: 1.4;
    color: #3b3c41;
    margin: 0;
}

.hd-modal--success__phone-img {
    position: absolute;
    right: -180px;
    top: -219px;
    height: 444px;
    width: auto;
    z-index: 0;
    pointer-events: none;
}

/* --- Mobile adaptivity --- */
@media (max-width: 767px) {
    #modal-success.hd-modal-overlay {
        align-items: stretch;
        justify-content: stretch;
    }

    #modal-success .hd-modal--success {
        width: 100vw;
        max-width: none;
        min-height: 100dvh;
        height: 100dvh;
        max-height: none;
        padding: 50px 0 0;
        border-radius: 0;
    }

    #modal-success .hd-modal__close {
        display: none;
    }

    .hd-modal--success {
        width: min(375px, 100vw);
        max-width: 375px;
        padding: 50px 0 0;
        border-radius: 25px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .hd-modal--success .hd-modal__body {
        display: grid;
        gap: 27px;
        padding-bottom: 30px;
    }

    .hd-modal--success__top,
    .hd-modal--success__bottom {
        display: contents;
    }

    .hd-modal--success__heading {
        order: 1;
        gap: 9px;
        width: min(335px, calc(100% - 40px));
        margin-left: 20px;
    }

    .hd-modal--success__heading h2 {
        font-size: 20px;
        line-height: 1.2;
    }

    .hd-modal--success__app-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 9px;
    }

    .hd-modal--success__app-row h2 {
        line-height: 1.4;
        white-space: normal;
    }

    .hd-modal--success__badge {
        font-size: 16px;
        line-height: 1.2;
        padding: 12px 20px;
        min-height: 42px;
        width: min(335px, 100%);
        text-align: center;
    }

    .hd-modal--success__install {
        order: 2;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: min(236px, calc(100% - 40px));
        margin-left: 20px;
    }

    .hd-modal--success__qr-col {
        display: none;
    }

    .hd-modal--success__stores-col {
        gap: 10px;
        width: 100%;
    }

    .hd-modal--success__stores-label {
        width: 170px;
        font-size: 12px;
        line-height: 1.4;
        font-weight: 500;
    }

    .hd-modal--success__stores-label-desktop {
        display: none;
    }

    .hd-modal--success__stores-label-mobile {
        display: inline;
    }

    .hd-modal--success__stores-grid {
        gap: 8px 9px;
        grid-template-columns: repeat(2, max-content);
    }

    .hd-modal--success__stores-grid img {
        height: 33px;
    }

    .hd-modal--success__benefits {
        order: 3;
        gap: 10px;
        width: min(335px, calc(100% - 40px));
        margin-left: 20px;
    }

    .hd-modal--success__benefits-title {
        font-size: 14px;
        line-height: 1.5;
        font-weight: 500;
    }

    .hd-modal--success__benefits-list {
        gap: 5px;
    }

    .hd-modal--success__benefits-list li {
        align-items: flex-start;
        gap: 14px;
        font-size: 14px;
        line-height: 1.35;
        font-weight: 500;
    }

    .hd-modal--success__benefits-list li::before {
        margin-top: 5px;
    }

    .hd-modal--success__bonuses {
        order: 4;
        border-radius: 25px 0 0 25px;
        min-height: 205px;
        padding: 18px 0 22px 20px;
        width: 100%;
        max-width: 100%;
    }

    .hd-modal--success__bonuses-content {
        gap: 10px;
        width: min(197px, calc(100% - 120px));
    }

    .hd-modal--success__bonuses-title {
        font-size: 14px;
        font-weight: 500;
    }

    .hd-modal--success__bonuses-amount {
        font-size: 16px;
        height: 35px;
        width: 84px;
        text-wrap: nowrap;
    }

    .hd-modal--success__bonuses-desc {
        font-size: 14px;
        font-weight: 500;
        max-width: 197px;
    }

    .hd-modal--success__phone-img {
        top: -52px;
        right: -98px;
        height: clamp(240px, 78vw, 291px);
    }
}
