/* ==========================================================================
   ISRP Popup Styles
   ========================================================================== */

/* 1. Backdrop Overlay with Darkening and Optimized Blur */
.isrp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    width: 100vw;
    height: 100%;
    height: 100vh;
    height: 100dvh;
    background-color: rgba(10, 18, 36, 0.65);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    visibility: hidden;
    will-change: opacity, visibility;
    transform: translateZ(0);
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
}

.isrp-popup-overlay.isrp-is-active {
    opacity: 1;
    visibility: visible;
}

/* 2. Main Modal Card Container */
.isrp-popup-container {
    position: relative;
    width: 100%;
    max-width: 1080px;
    max-height: calc(100dvh - 32px);
    max-height: calc(100vh - 32px);
    background: #ffffff;
    border: 2px solid #2563eb;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(37, 99, 235, 0.1);
    box-sizing: border-box;
    will-change: transform;
    transform: translateZ(0) scale(0.95) translateY(8px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: auto;
}

.isrp-popup-overlay.isrp-is-active .isrp-popup-container {
    transform: translateZ(0) scale(1) translateY(0);
}

.isrp-popup-inner {
    padding: 36px 44px 38px 44px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 3. Close Button */
.isrp-popup-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.2s ease;
    z-index: 20;
    padding: 0;
}

.isrp-popup-close:hover {
    background: #e2e8f0;
    color: #0f172a;
    transform: rotate(90deg);
}

.isrp-popup-close svg {
    width: 18px;
    height: 18px;
    display: block;
}

/* 4. Top Header Badges */
.isrp-header-badges {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 22px;
    padding-right: 48px; /* Prevents badge from colliding with close button */
    box-sizing: border-box;
}

.isrp-badge-shield {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f4f8ff;
    border: 1px solid #cce0ff;
    color: #1251ba;
    padding: 8px 18px;
    border-radius: 12px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1;
}

.isrp-shield-icon {
    width: 17px;
    height: 17px;
    color: #1251ba;
    flex-shrink: 0;
    display: block;
}

/* 5. Typography */
.isrp-content-block {
    margin-bottom: 26px;
}

.isrp-main-title {
    margin: 0 0 12px 0;
    color: #0b132b;
    font-size: 36px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.isrp-main-subtitle {
    margin: 0;
    color: #475569;
    font-size: 16px;
    line-height: 1.55;
    max-width: 820px;
}

/* 6. Form Row & Inputs */
.isrp-form {
    margin-top: 24px;
}

.isrp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 16px;
    align-items: stretch;
}

.isrp-input-group {
    position: relative;
    width: 100%;
}

.isrp-input {
    width: 100%;
    height: 54px;
    padding: 0 20px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 15px;
    color: #1e293b;
    box-sizing: border-box;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.isrp-input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.isrp-input:hover {
    border-color: #94a3b8;
}

.isrp-input:focus,
.isrp-input:focus-visible {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22) !important;
    background-color: #ffffff;
}

.isrp-input.isrp-error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

/* 7. Submit Button */
.isrp-btn-group {
    display: flex;
}

.isrp-btn-submit {
    height: 54px;
    padding: 0 28px;
    background-color: #1251ba;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(18, 81, 186, 0.25);
    font-family: inherit;
    box-sizing: border-box;
    margin: 0;
}

.isrp-btn-submit:hover {
    background-color: #0e4299;
    box-shadow: 0 6px 16px rgba(18, 81, 186, 0.35);
    transform: translateY(-1px);
}

.isrp-btn-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(18, 81, 186, 0.25);
}

.isrp-btn-submit:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.isrp-phone-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    display: block;
    vertical-align: middle;
}

.isrp-btn-text {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    vertical-align: middle;
}

/* 8. Consent & Links - Fully Isolated from WordPress Theme Styles */
.isrp-consent-block {
    margin-top: 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* Сброс любых конфликтующих псевдоэлементов от тем WordPress */
.isrp-checkbox-wrapper::before,
.isrp-checkbox-wrapper::after,
.isrp-checkbox-custom::before,
.isrp-checkbox-custom::after,
.isrp-checkbox::before,
.isrp-checkbox::after {
    content: none !important;
    display: none !important;
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.isrp-checkbox-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    margin-top: 2px;
    padding: 0;
    border: none;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}

/* Нативный инпут полностью убирается из визуального отображения,
   чтобы ни одна тема и браузер не могли нарисовать нативный квадрат или вторую галочку */
.isrp-popup-container input[type="checkbox"].isrp-checkbox,
#isrp-input-consent.isrp-checkbox,
.isrp-checkbox {
    position: absolute !important;
    opacity: 0 !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: none !important;
    overflow: hidden !important;
    pointer-events: none !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    box-shadow: none !important;
    background: transparent !important;
    z-index: -1 !important;
}

/* Стилизованный кастомный чекбокс */
.isrp-checkbox-custom {
    all: unset !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    border: 2px solid #94a3b8 !important;
    border-radius: 6px !important;
    background-color: #ffffff !important;
    background-image: none !important;
    flex-shrink: 0 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
    cursor: pointer !important;
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    user-select: none !important;
    overflow: hidden !important;
}

.isrp-checkbox-wrapper:hover .isrp-checkbox-custom {
    border-color: #2563eb !important;
    background-color: #f8fafc !important;
}

.isrp-checkbox:checked + .isrp-checkbox-custom,
.isrp-checkbox-custom.is-checked {
    background-color: #1251ba !important;
    border-color: #1251ba !important;
}

.isrp-checkbox:focus-visible + .isrp-checkbox-custom {
    box-shadow: 0 0 0 3px rgba(18, 81, 186, 0.25) !important;
}

/* Единственная иконка галочки строго по центру */
.isrp-checkbox-icon {
    display: block !important;
    stroke: #ffffff !important;
    fill: none !important;
    stroke-width: 3.2 !important;
    width: 14px !important;
    height: 14px !important;
    min-width: 14px !important;
    min-height: 14px !important;
    max-width: 14px !important;
    max-height: 14px !important;
    opacity: 0 !important;
    transform: scale(0.6) !important;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1) !important;
    pointer-events: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.isrp-checkbox:checked + .isrp-checkbox-custom .isrp-checkbox-icon,
.isrp-checkbox-custom.is-checked .isrp-checkbox-icon {
    opacity: 1 !important;
    transform: scale(1) !important;
}

.isrp-consent-text {
    font-size: 13.5px;
    color: #475569;
    line-height: 1.5;
    cursor: default;
    user-select: text;
}

.isrp-consent-text a {
    color: #1251ba;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.15s ease;
    cursor: pointer;
}

.isrp-consent-text a:hover {
    color: #093782;
}

/* 9. Form Status Notifications */
.isrp-form-status {
    margin-top: 16px;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}

.isrp-form-status.isrp-success {
    background-color: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.isrp-form-status.isrp-error-msg {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* 10. Responsive Mobile Adaptations */
@media (max-width: 960px) {
    .isrp-popup-inner {
        padding: 28px 24px;
    }

    .isrp-main-title {
        font-size: 28px;
    }

    .isrp-form-row {
        grid-template-columns: 1fr 1fr;
    }

    .isrp-btn-group {
        grid-column: span 2;
    }

    .isrp-btn-submit {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .isrp-popup-overlay {
        padding: 10px;
        align-items: center;
        justify-content: center;
    }

    .isrp-popup-container {
        border-radius: 18px;
        max-height: calc(100dvh - 20px);
        max-height: calc(100vh - 20px);
        margin: auto;
    }

    .isrp-popup-inner {
        padding: 18px 16px 16px 16px;
    }

    .isrp-popup-close {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
    }

    .isrp-popup-close svg {
        width: 16px;
        height: 16px;
    }

    .isrp-header-badges {
        margin-bottom: 10px;
        padding-right: 36px;
    }

    .isrp-badge-shield {
        font-size: 11.5px;
        padding: 5px 12px;
        border-radius: 8px;
        gap: 6px;
    }

    .isrp-shield-icon {
        width: 14px;
        height: 14px;
    }

    .isrp-content-block {
        margin-bottom: 12px;
    }

    .isrp-main-title {
        font-size: 20px;
        line-height: 1.2;
        margin-bottom: 6px;
    }

    .isrp-main-subtitle {
        font-size: 12.5px;
        line-height: 1.4;
    }

    .isrp-form {
        margin-top: 12px;
    }

    .isrp-form-row {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 10px;
    }

    .isrp-btn-group {
        grid-column: span 1;
    }

    .isrp-input,
    .isrp-btn-submit {
        height: 44px;
        font-size: 14px;
    }

    .isrp-input {
        padding: 0 14px;
    }

    .isrp-btn-submit {
        padding: 0 18px;
    }

    .isrp-consent-block {
        margin-top: 8px;
        gap: 10px;
        align-items: flex-start;
    }

    .isrp-checkbox-wrapper {
        padding: 0;
        margin-top: 0px;
    }

    .isrp-checkbox-custom {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px !important;
        min-height: 20px !important;
        max-width: 20px !important;
        max-height: 20px !important;
        border-radius: 5px !important;
    }

    .isrp-checkbox-icon {
        width: 13px !important;
        height: 13px !important;
        min-width: 13px !important;
        min-height: 13px !important;
        max-width: 13px !important;
        max-height: 13px !important;
    }

    .isrp-consent-text {
        font-size: 11px;
        line-height: 1.35;
    }
}

/* Extra small height screens / landscape orientation */
@media (max-height: 640px) {
    .isrp-popup-overlay {
        padding: 8px;
        align-items: center;
    }

    .isrp-popup-container {
        border-radius: 16px;
        max-height: calc(100dvh - 16px);
        max-height: calc(100vh - 16px);
    }

    .isrp-popup-inner {
        padding: 14px 14px 12px 14px;
    }

    .isrp-header-badges {
        margin-bottom: 6px;
    }

    .isrp-content-block {
        margin-bottom: 8px;
    }

    .isrp-main-title {
        font-size: 18px;
        margin-bottom: 4px;
    }

    .isrp-main-subtitle {
        font-size: 11.5px;
        line-height: 1.3;
    }

    .isrp-form {
        margin-top: 8px;
    }

    .isrp-form-row {
        gap: 6px;
        margin-bottom: 8px;
    }

    .isrp-input,
    .isrp-btn-submit {
        height: 40px;
        font-size: 13.5px;
    }

    .isrp-consent-block {
        margin-top: 6px;
        gap: 8px;
    }

    .isrp-checkbox-custom {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        min-height: 18px !important;
        max-width: 18px !important;
        max-height: 18px !important;
        border-radius: 4px !important;
    }

    .isrp-checkbox-icon {
        width: 11px !important;
        height: 11px !important;
        min-width: 11px !important;
        min-height: 11px !important;
        max-width: 11px !important;
        max-height: 11px !important;
    }

    .isrp-consent-text {
        font-size: 10.5px;
        line-height: 1.25;
    }
}
