/* Общие стили для кастомных форм */
.csp-custom-form {
    max-width: 600px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.csp-custom-form-header {
    margin-bottom: 30px;
}

.csp-custom-form-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.csp-custom-form-description {
    color: #6b7280;
    font-size: 16px;
    margin: 0;
    line-height: 1.5;
}

/* Поля формы */
.csp-custom-field-group {
    margin-bottom: 20px;
}

.csp-custom-field-group label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    font-size: 14px;
}

.csp-custom-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
    color: #1f2937;
    box-sizing: border-box;
    font-family: inherit;
}

.csp-custom-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.csp-custom-input.error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.csp-custom-textarea {
    resize: vertical;
    min-height: 100px;
}

.csp-custom-field-description {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Кнопка отправки */
.csp-custom-submit-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-family: inherit;
}

.csp-custom-submit-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

.csp-custom-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Сообщение об успехе */
.csp-custom-success-message {
    text-align: center;
    padding: 30px 20px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    margin-top: 20px;
}

.csp-custom-success-icon {
    width: 50px;
    height: 50px;
    background: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 20px;
    color: white;
    font-weight: bold;
}

.csp-custom-success-message h3,
.csp-custom-success-message h4 {
    color: #065f46;
    margin: 0 0 10px 0;
    font-size: 18px;
}

.csp-custom-success-message p {
    color: #047857;
    margin: 0;
    line-height: 1.5;
}

/* Модальное окно */
.csp-custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: cspCustomFadeIn 0.3s ease;
}

.csp-custom-modal-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s ease;
}

.csp-custom-modal.active .csp-custom-modal-content {
    transform: scale(1);
    opacity: 1;
}

.csp-custom-close-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.csp-custom-close-btn:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
}

/* Inline форма */
.csp-custom-inline-form {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 30px;
    margin: 20px 0;
}

.csp-custom-inline-form .csp-custom-form-title {
    font-size: 20px;
}

/* Кнопка-триггер */
.csp-custom-trigger-btn {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-size: 14px;
    font-family: inherit;
}

.csp-custom-trigger-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
    color: white;
    text-decoration: none;
}

/* Анимации */
@keyframes cspCustomFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Адаптивность */
@media (max-width: 768px) {
    .csp-custom-modal-content {
        padding: 20px;
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .csp-custom-form-title {
        font-size: 20px;
    }
    
    .csp-custom-input {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .csp-custom-submit-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .csp-custom-inline-form {
        padding: 20px;
        margin: 15px 0;
    }
}

@media (max-width: 480px) {
    .csp-custom-modal-content {
        padding: 15px;
        margin: 10px;
        width: calc(100% - 20px);
    }
    
    .csp-custom-form-title {
        font-size: 18px;
    }
    
    .csp-custom-inline-form {
        padding: 15px;
    }
}

/* Состояния полей */
.csp-custom-field-group.loading .csp-custom-input {
    background-color: #f3f4f6;
    cursor: not-allowed;
}

.csp-custom-field-group.success .csp-custom-input {
    border-color: #10b981;
    background-color: #f0fdf4;
}

/* Дополнительные утилиты */
.csp-custom-hidden {
    display: none !important;
}

.csp-custom-loading {
    opacity: 0.6;
    pointer-events: none;
}

.csp-custom-error-message {
    color: #dc2626;
    font-size: 13px;
    margin-top: 4px;
    margin-bottom: 0;
}

/* Специальные стили для select */
.csp-custom-input[type="select"],
select.csp-custom-input {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    appearance: none;
}

/* Блокировка скролла при открытом модальном окне */
body.csp-custom-modal-open {
    overflow: hidden;
}

/* Интеграция с темами WordPress */
.wp-block-group .csp-custom-inline-form,
.entry-content .csp-custom-inline-form {
    margin: 30px 0;
}

/* Стили для ошибок валидации */
.csp-custom-validation-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.csp-custom-validation-error ul {
    margin: 0;
    padding-left: 20px;
}

.csp-custom-validation-error li {
    margin-bottom: 4px;
}

/* Прелоадер */
.csp-custom-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff40;
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: cspCustomSpin 1s linear infinite;
    margin-right: 8px;
}

@keyframes cspCustomSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}