/* ============================================================
   Buy Service modal - standalone overlay (not Tipsters.Modal).
   Mirrors Telegram pairing modal aesthetic: same overlay backdrop, same border
   radius / shadow, same flex column layout (sticky header + scrollable body).
   Sections inside body: subscription summary, country/phone, payment methods,
   total, confirms, CTA.
   ============================================================ */

/* ---- Overlay ---- */
.buy-service-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 22, 41, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999990;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 50px 16px;
    opacity: 0;
    transition: opacity 200ms ease;
}

/* Swal musí být nad buy modalem (jeho overlay je 999999990, default Swal z-indexy
   v default.tpl/head.tpl jsou jen 99999999 = o jednu devítku míň, takže by Swal byl
   schovaný za naším overlayem). */
.swal2-container {
    z-index: 999999999 !important;
}

.buy-service-overlay.is-visible {
    opacity: 1;
}

/* ---- Modal box ---- */
.buy-service-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 540px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
    transform: translateY(-12px);
    transition: transform 250ms cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 100px);
    font-family: Montserrat, sans-serif;
    color: #2b3343;
}

.buy-service-overlay.is-visible .buy-service-modal {
    transform: translateY(0);
}

/* ---- Initial loader (před fetchnutím contentu) ---- */
.buy-service-modal-loader {
    padding: 80px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Close button (X) ---- */
.buy-service-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
    transition: background 150ms, color 150ms;
    z-index: 10;
}

.buy-service-modal-close:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.buy-service-modal-close svg {
    width: 18px !important;
    height: 18px !important;
}

/* ---- Header - barevný gradient, čistá hero zone ---- */
.buy-service-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 60px 22px 22px;
    background: linear-gradient(135deg, #2aabee 0%, #229ed9 100%);
    color: #fff;
}

.buy-service-header-avatar {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    flex-shrink: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.buy-service-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.buy-service-header-text {
    flex: 1;
    min-width: 0;
}

.buy-service-title {
    font-size: 19px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 3px 0;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.buy-service-subtitle {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 400;
}

.buy-service-header-price {
    flex-shrink: 0;
    text-align: right;
    margin-left: 8px;
}

.buy-service-header-price-amount {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}

.buy-service-header-price-period {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 3px;
    font-weight: 400;
}

/* ---- Body - scrollable inside modal ---- */
.buy-service-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    padding: 18px 22px 22px;
}

/* ---- Section ---- */
.buy-service-section {
    margin-top: 18px;
}

.buy-service-section:first-child {
    margin-top: 4px;
}

.buy-service-section-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #6c7390;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.buy-service-section-title svg,
.buy-service-section-title i[data-icon] svg {
    width: 13px !important;
    height: 13px !important;
}

/* ---- Country default display (one-line summary) ---- */
.buy-service-country-default {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fc;
    border: 1px solid #e3e7f0;
    border-radius: 10px;
    padding: 12px 14px;
    gap: 12px;
}

.buy-service-country-default-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.buy-service-country-flag {
    width: 22px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.buy-service-country-name {
    font-size: 13px;
    font-weight: 600;
    color: #2b3343;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.buy-service-country-change {
    font-size: 12px;
    color: #229ed9;
    cursor: pointer;
    font-weight: 600;
    flex-shrink: 0;
    transition: color 150ms;
}

.buy-service-country-change:hover {
    color: #1c8bbe;
    text-decoration: underline;
}

/* ---- Country custom (select + phone) ---- */
.buy-service-country-custom {
    background: #f8f9fc;
    border: 1px solid #e3e7f0;
    border-radius: 10px;
    padding: 14px;
}

.buy-service-form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.buy-service-form-row + .buy-service-form-row {
    margin-top: 12px;
}

.buy-service-form-label {
    font-size: 11px;
    font-weight: 600;
    color: #6c7390;
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.buy-service-form-label svg {
    width: 12px !important;
    height: 12px !important;
}

.buy-service-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e3e7f0;
    border-radius: 8px;
    background: #fff;
    font-family: Montserrat, sans-serif;
    font-size: 13px;
    color: #2b3343;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c7390' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
    transition: border-color 150ms, box-shadow 150ms;
}

.buy-service-select:focus {
    outline: none;
    border-color: #229ed9;
    box-shadow: 0 0 0 3px rgba(34, 158, 217, 0.12);
}

.buy-service-phone-row {
    display: flex;
    gap: 8px;
}

.buy-service-phone-dial {
    width: 100px;
    flex-shrink: 0;
}

.buy-service-phone-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #e3e7f0;
    border-radius: 8px;
    background: #fff;
    font-family: Montserrat, sans-serif;
    font-size: 13px;
    color: #2b3343;
    transition: border-color 150ms, box-shadow 150ms;
}

.buy-service-phone-input:focus {
    outline: none;
    border-color: #229ed9;
    box-shadow: 0 0 0 3px rgba(34, 158, 217, 0.12);
}

.buy-service-phone-error {
    color: rgb(220, 80, 80);
    font-size: 12px;
    margin-top: 4px;
}

/* ---- Payment method cards ---- */
.buy-service-payment-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.buy-service-payment-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1.5px solid #e3e7f0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 150ms, box-shadow 150ms, background 150ms;
    position: relative;
}

.buy-service-payment-option:hover {
    border-color: #c5cbd9;
    background: #fbfcfe;
}

.buy-service-payment-option.is-selected {
    border-color: #229ed9;
    background: rgba(34, 158, 217, 0.06);
    box-shadow: 0 0 0 3px rgba(34, 158, 217, 0.10);
}

.buy-service-payment-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.buy-service-payment-radio {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #c5cbd9;
    flex-shrink: 0;
    position: relative;
    transition: border-color 150ms;
}

.buy-service-payment-option.is-selected .buy-service-payment-radio {
    border-color: #229ed9;
}

.buy-service-payment-option.is-selected .buy-service-payment-radio::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #229ed9;
}

.buy-service-payment-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    background: #f1f3f8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2b3343;
}

.buy-service-payment-icon svg {
    width: 18px !important;
    height: 18px !important;
}

.buy-service-payment-info {
    flex: 1;
    min-width: 0;
}

.buy-service-payment-name {
    font-size: 14px;
    font-weight: 600;
    color: #2b3343;
    display: flex;
    align-items: center;
    gap: 6px;
}

.buy-service-payment-meta {
    font-size: 11.5px;
    color: #6c7390;
    margin-top: 2px;
    font-weight: 400;
}

/* ---- Total row ---- */
.buy-service-total {
    margin-top: 22px;
    padding: 16px 18px;
    background: linear-gradient(135deg, rgba(34, 158, 217, 0.05) 0%, rgba(34, 158, 217, 0.02) 100%);
    border: 1px solid rgba(34, 158, 217, 0.18);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.buy-service-total-label {
    font-size: 14px;
    font-weight: 600;
    color: #2b3343;
}

.buy-service-total-meta {
    font-size: 11px;
    color: #6c7390;
    font-style: italic;
    margin-top: 2px;
}

.buy-service-total-amount {
    font-size: 26px;
    font-weight: 700;
    color: #229ed9;
}

.buy-service-total-amount-currency {
    font-size: 18px;
    font-weight: 400;
    margin-left: 2px;
}

/* ---- Confirms (checkboxes) ---- */
.buy-service-confirms {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.buy-service-confirm {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px 0;
}

/* iOS-style toggle - track + knob; checkbox je hidden a flipuje state přes :checked.
   !important defensivně proti případným base `.checkbox` rules z _forms-checkboxes.scss.
   Knob pozicujeme přes left místo transform (base má transform !important na input:checked). */
.buy-service-confirm-checkbox {
    width: 38px !important;
    height: 22px !important;
    border-radius: 22px !important;
    background: #c5cbd9 !important;
    border: none !important;
    flex-shrink: 0;
    position: relative;
    transition: background 200ms ease !important;
    transform: none !important;
    margin: 0 !important;
    display: inline-block;
}

.buy-service-confirm-checkbox::after {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    background: #fff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    transition: left 200ms cubic-bezier(0.4, 0.0, 0.2, 1), background 200ms ease !important;
    transform: none !important;
}

.buy-service-confirm input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.buy-service-confirm input[type="checkbox"]:checked + .buy-service-confirm-checkbox {
    background: #3dac78 !important;
}

.buy-service-confirm input[type="checkbox"]:checked + .buy-service-confirm-checkbox::after {
    left: 18px !important;
    transform: none !important;
}

.buy-service-confirm-text {
    flex: 1;
    font-size: 13px;
    color: #2b3343;
    line-height: 1.45;
}

/* ---- CTA button ---- */
.buy-service-cta {
    margin-top: 18px;
    width: 100%;
    padding: 14px 18px;
    background: linear-gradient(135deg, #3dac78 0%, #2d9166 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: Montserrat, sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: transform 150ms, box-shadow 150ms;
    box-shadow: 0 6px 18px rgba(61, 172, 120, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.buy-service-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(61, 172, 120, 0.40);
}

.buy-service-cta:active {
    transform: translateY(0);
}

.buy-service-cta svg {
    width: 16px !important;
    height: 16px !important;
}

/* ---- Inline alerts (not logged, sub limit, no country) ---- */
.buy-service-alert {
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    margin-top: 14px;
}

.buy-service-alert-danger {
    background: rgba(220, 80, 80, 0.08);
    border: 1px solid rgba(220, 80, 80, 0.25);
    color: #ad3a3a;
}

.buy-service-alert-danger a {
    color: #ad3a3a;
    text-decoration: underline;
    font-weight: 600;
}

/* ---- Dark mode ---- */
html.is-dark .buy-service-modal,
body.is-dark .buy-service-modal {
    background: #1b2030;
    color: #e7eaf3;
}

html.is-dark .buy-service-country-default,
body.is-dark .buy-service-country-default,
html.is-dark .buy-service-country-custom,
body.is-dark .buy-service-country-custom {
    background: #232a3e;
    border-color: #2a3148;
}

html.is-dark .buy-service-country-name,
body.is-dark .buy-service-country-name {
    color: #e7eaf3;
}

html.is-dark .buy-service-country-change,
body.is-dark .buy-service-country-change {
    color: #6abdee;
}

html.is-dark .buy-service-form-label,
body.is-dark .buy-service-form-label,
html.is-dark .buy-service-section-title,
body.is-dark .buy-service-section-title {
    color: #9aa0b7;
}

html.is-dark .buy-service-select,
body.is-dark .buy-service-select,
html.is-dark .buy-service-phone-input,
body.is-dark .buy-service-phone-input {
    background-color: #1b2030;
    border-color: #2a3148;
    color: #e7eaf3;
}

html.is-dark .buy-service-payment-option,
body.is-dark .buy-service-payment-option {
    background: #232a3e;
    border-color: #2a3148;
}

html.is-dark .buy-service-payment-option:hover,
body.is-dark .buy-service-payment-option:hover {
    background: #28304a;
    border-color: #3a4365;
}

html.is-dark .buy-service-payment-option.is-selected,
body.is-dark .buy-service-payment-option.is-selected {
    background: rgba(106, 189, 238, 0.10);
    border-color: #6abdee;
    box-shadow: 0 0 0 3px rgba(106, 189, 238, 0.16);
}

html.is-dark .buy-service-payment-icon,
body.is-dark .buy-service-payment-icon {
    background: #2a3148;
    color: #e7eaf3;
}

html.is-dark .buy-service-payment-name,
body.is-dark .buy-service-payment-name {
    color: #e7eaf3;
}

html.is-dark .buy-service-payment-meta,
body.is-dark .buy-service-payment-meta {
    color: #9aa0b7;
}

html.is-dark .buy-service-total,
body.is-dark .buy-service-total {
    background: rgba(106, 189, 238, 0.08);
    border-color: rgba(106, 189, 238, 0.22);
}

html.is-dark .buy-service-total-label,
body.is-dark .buy-service-total-label {
    color: #e7eaf3;
}

html.is-dark .buy-service-total-meta,
body.is-dark .buy-service-total-meta {
    color: #9aa0b7;
}

html.is-dark .buy-service-total-amount,
body.is-dark .buy-service-total-amount {
    color: #6abdee;
}

html.is-dark .buy-service-confirm-text,
body.is-dark .buy-service-confirm-text {
    color: #e7eaf3;
}

/* Dark mode toggle - sjednoceno s buy modal paletou: deep navy bg #1b2030,
   sekce #232a3e s border #2a3148, CTA green gradient #3dac78 -> #2d9166.
   Off track = section border tone, ON track = CTA gradient darker end (méně
   zářivá zelená než light mode), knob = light mode text color #e7eaf3. */
html.is-dark .buy-service-confirm-checkbox,
body.is-dark .buy-service-confirm-checkbox {
    background: #2a3148 !important;
}

html.is-dark .buy-service-confirm-checkbox::after,
body.is-dark .buy-service-confirm-checkbox::after {
    background: #e7eaf3 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4) !important;
}

html.is-dark .buy-service-confirm input[type="checkbox"]:checked + .buy-service-confirm-checkbox,
body.is-dark .buy-service-confirm input[type="checkbox"]:checked + .buy-service-confirm-checkbox {
    background: #2d9166 !important;
}

html.is-dark .buy-service-alert-danger,
body.is-dark .buy-service-alert-danger {
    background: rgba(220, 80, 80, 0.12);
    border-color: rgba(220, 80, 80, 0.30);
    color: #e88a8a;
}

html.is-dark .buy-service-alert-danger a,
body.is-dark .buy-service-alert-danger a {
    color: #e88a8a;
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
    .buy-service-overlay {
        padding: 16px 8px;
        align-items: stretch;
    }

    .buy-service-modal {
        max-width: 100%;
        max-height: calc(100vh - 32px);
        border-radius: 12px;
    }

    .buy-service-header {
        padding: 18px 52px 18px 18px;
        gap: 12px;
    }

    .buy-service-header-avatar {
        width: 46px;
        height: 46px;
        border-radius: 12px;
    }

    .buy-service-title {
        font-size: 17px;
    }

    .buy-service-header-price-amount {
        font-size: 19px;
    }

    .buy-service-body {
        padding: 16px 18px 20px;
    }

    .buy-service-total-amount {
        font-size: 22px;
    }
}
