/* --- ЛОКАЛЬНЫЙ СБРОС СТИЛЕЙ (CSS RESET) --- */
.blm-widget-root,
.blm-widget-root *,
.blm-widget-root *::before,
.blm-widget-root *::after {
    /* 1. Сброс Box Model */
    box-sizing: border-box;

    /* 2. Сброс шрифтов и текста */
    font-size: 16px;
    font-weight: normal;
    line-height: 1.2;
    text-align: left;
    color: inherit; /* Используем цвет, определенный в самой модалке/кнопке */

    /* 3. Сброс отступов */
    margin: 0;
    padding: 0;
    border: 0;

    /* 4. Сброс наследуемых стилей списков и прочего */
    list-style: none;
    text-decoration: none;

    /* 5. Сброс наследуемых стилей кнопок */
    /* -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none; */
    border-radius: 0;
}

/* Элементы, которые могут иметь специфические стили */
.blm-widget-root button,
.blm-widget-root input {
    font-family: inherit !important;
}

/* Сброс модалки до дефолтного вида */
.blm-widget-root dialog {
    padding: 0;
    margin: auto;
}

/* NEW STYLES */

:root {
    --blm-primary: #3b82f6;
    --blm-primary-dark: #2563eb;
    --blm-text-main: #111827;
    --blm-text-muted: #4b5563;
    --blm-bg-card: #ffffff;
}

.blm-modal {
    border: none;
    padding: 0;
    max-width: 100vw;
    max-height: 100vh;
    background: transparent;
    overflow: visible;
    width: 100%;
}

@media (min-width: 1024px) {
    .blm-modal {
        width: auto;
    }
}

.blm-modal::backdrop {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.blm-modal[open] {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Панель модалки */
.blm-modal__panel {
    background: var(--blm-bg-card);
    width: 100%;
    height: 100dvh; /* На мобилках во весь экран */
    max-width: 1152px;
    padding: 2rem 1.25rem;
    position: relative;
    box-sizing: border-box;
    overflow-y: auto;
}

@media (min-width: 1024px) {
    .blm-modal__panel {
        height: auto;
        min-height: auto;
        width: 100dvw;
        border-radius: 1.5rem;
        padding: 3.5rem;
    }
}

/* Кнопка закрытия */
.blm-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: rgba(59, 130, 246, 0.1);
    color: var(--blm-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s ease;
}

.blm-modal__close:hover {
    background: var(--blm-primary);
    color: white;
}

/* Типографика */
.blm-modal__title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--blm-text-main);
    width: fit-content;
}

.blm-modal__description {
    font-size: 0.875rem;
    color: var(--blm-text-muted);
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .blm-modal__title {
        font-size: 2.25rem;
    }
}

/* Сетка и инпуты */
.blm-modal__grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 1024px) {
    .blm-modal__grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
    .blm-modal__field--full {
        grid-column: span 3;
    }
}

.blm-modal__field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.blm-modal__label {
    font-size: 0.875rem;
    font-weight: 500;
}

.blm-modal__input,
.blm-modal__textarea {
    font-family: inherit !important;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem !important;
    font-size: 1rem;
    width: 100%;
}

.blm-modal__textarea {
    min-height: 120px;
}

/* Футер */
.blm-modal__footer {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.blm-modal__consent {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .blm-modal__footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.blm-modal__checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.blm-modal__checkbox {
    margin-right: 0 !important;
}

.blm-modal__checkbox-text a {
    color: var(--blm-primary);
    text-decoration: underline;
    transition: color 0.2s ease-in-out;
}


.blm-modal__checkbox-text a:hover {
    color: var(--blm-primary-dark);
}


.blm-modal__submit {
    background: var(--blm-primary);
    color: white;
    text-align: center;
    border: none;
    padding: 1rem 3rem;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    text-transform: unset !important;
}

.blm-modal__submit:disabled {
    opacity: 0.5;
}

/* Успех */
.blm-modal__success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3rem 0;
}

.blm-modal__description--success {
    margin-bottom: 0px;
}

[hidden] {
    display: none !important;
}
