.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 8, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    background: #F4F8F5;
    color: #182B20;
    max-width: 420px;
    width: 100%;
    border-radius: 14px;
    padding: 20px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #243E2F;
    color: #EDF5F0;
    border: 0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: #355844;
}

.modal-img {
    width: 100%;
    height: 480px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 14px;
}

.modal-title {
    margin-bottom: 8px;
    font-size: 18px;
}

.modal-text {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 16px;
    color: #243E2F;
}

.modal-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-link {
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    transition: opacity 0.2s;
}

.modal-link:hover {
    opacity: 0.9;
}


.modal-link-vk {
    background: #243E2F;
    color: #EDF5F0;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

















.modal-subtitle {
    font-size: 13px;
    color: #355844;
    margin-bottom: 14px;
    line-height: 1.4;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.modal-label {
    font-size: 12px;
    font-weight: 700;
    color: #243E2F;
}

.modal-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.modal-cat-btn {
    background-color: #E3EDE7;
    color: #182B20;
    border: 1px solid #C8D6CE;
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.modal-cat-btn:hover {
    background-color: #D2E2D8;
    border-color: #A8C0B2;
}

.modal-cat-btn.active {
    background-color: #B9D3C4;
    border-color: #52B788;
    box-shadow: inset 0 2px 4px rgba(24, 43, 32, 0.15);
}

.modal-input,
.modal-textarea {
    width: 100%;
    background-color: #FFFFFF;
    color: #182B20;
    border: 1px solid #C8D6CE;
    border-radius: 10px;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-input:hover,
.modal-textarea:hover {
    border-color: #9BB5A6;
}

.modal-input:focus,
.modal-textarea:focus {
    border-color: #52B788;
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.22);
}

.modal-textarea {
    resize: vertical;
    min-height: 110px;
}

.modal-error {
    color: #B91C1C;
    font-size: 12px;
    font-weight: 600;
    min-height: 16px;
}

.modal-hp {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

.modal-submit {
    margin-top: 2px;
    background-color: #52B788;
    color: #102017;
    border: 0;
    height: 42px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.modal-submit:hover {
    background-color: #40916C;
}

.modal-submit:active {
    transform: translateY(1px);
}

.modal-success {
    text-align: center;
    padding: 16px 0 8px;
}

.modal-success-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #182B20;
}

.modal-success-text {
    font-size: 14px;
    color: #243E2F;
    margin-bottom: 18px;
    line-height: 1.5;
}

.modal-submit:disabled {
    background-color: #9BB5A6;
    cursor: not-allowed;
    transform: none;
}



@media (prefers-color-scheme: dark) {
    .modal-card {
        background-color: var(--bg-surface);
        border-color: var(--border-color);
        color: var(--text-main);
    }

    .modal-title,
    .modal-label,
    .modal-success-title {
        color: var(--text-main);
    }

    .modal-subtitle,
    .modal-text,
    .modal-success-text {
        color: var(--text-muted);
    }

    .modal-input,
    .modal-textarea,
    .modal-cat-btn,
    .modal-social-link {
        background-color: var(--bg-subtle);
        border-color: var(--border-color);
        color: var(--text-main);
    }

    .modal-cat-btn.active {
        background-color: var(--bg-subtle-active);
        border-color: var(--accent);
    }

    .modal-close {
        background-color: var(--bg-subtle);
        color: var(--text-main);
    }
}
