/* ===== CUSTOM POPUPS MANAGER - FRONTEND STYLES ===== */

/* Кнопки попапов */
.cpm-popup-trigger {
    background: #203c62;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    outline: none !important; /* Убираем черную обводку */
    box-shadow: none !important; /* Убираем тень */
}

.cpm-popup-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.cpm-popup-trigger:focus {
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(32, 60, 98, 0.2) !important;
}

.cpm-popup-trigger:active {
    transform: translateY(0);
    outline: none !important;
}

/* Цвета кнопок - кастомные цвета */
.cpm-popup-trigger.button-primary {
    background: #203c62;
}

.cpm-popup-trigger.button-primary:hover {
    background: #1a3252;
}

.cpm-popup-trigger.button-success {
    background: #28a745 !important;
}

.cpm-popup-trigger.button-success:hover {
    background: #218838 !important;
}

.cpm-popup-trigger.button-danger {
    background: #EA2F33;
}

.cpm-popup-trigger.button-danger:hover {
    background: #d21e23;
}

.cpm-popup-trigger.button-warning {
    background: #ffc107;
    color: #212529;
}

.cpm-popup-trigger.button-warning:hover {
    background: #e0a800;
}

.cpm-popup-trigger.button-info {
    background: #17a2b8;
}

.cpm-popup-trigger.button-info:hover {
    background: #138496;
}

.cpm-popup-trigger.button-secondary {
    background: #6c757d;
}

.cpm-popup-trigger.button-secondary:hover {
    background: #545b62;
}

.cpm-popup-trigger.button-dark {
    background: #343a40;
}

.cpm-popup-trigger.button-dark:hover {
    background: #23272b;
}

.cpm-popup-trigger.button-light {
    background: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
}

.cpm-popup-trigger.button-light:hover {
    background: #e2e6ea;
}

/* Кнопка "Заказать звонок" в верхней полосе */
.callback-button {
    color: #fff !important;
    background: transparent !important;
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    outline: none !important;
}

.callback-button:hover,
.callback-button:focus {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
    text-decoration: none;
    outline: none !important;
}

.callback-button i {
    margin-right: 5px;
    font-size: 12px;
    color: #4CAF50; /* Зеленый цвет для иконки телефона */
}

/* Попапы */
.cpm-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}

.cpm-popup.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpm-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.cpm-popup-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

/* Размеры попапов */
.cpm-popup-small .cpm-popup-content {
    width: 90%;
    max-width: 400px;
}

.cpm-popup-medium .cpm-popup-content {
    width: 90%;
    max-width: 600px;
}

.cpm-popup-large .cpm-popup-content {
    width: 90%;
    max-width: 800px;
}

.cpm-popup-full .cpm-popup-content {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
}

/* Заголовок попапа */
.cpm-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px 15px;
    border-bottom: 1px solid #eee;
}

.cpm-popup-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.cpm-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    outline: none;
}

.cpm-popup-close:hover {
    background: #f5f5f5;
    color: #333;
}

.cpm-popup-close:focus {
    outline: none;
    background: #e9ecef;
}

/* Содержимое попапа */
.cpm-popup-body {
    padding: 0 20px;
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Стили для форм внутри попапов */
.cpm-popup-body .wpcf7-form {
    margin: 0;
}

.cpm-popup-body .wpcf7-form p {
    margin-bottom: 15px;
}

.cpm-popup-body input[type="text"],
.cpm-popup-body input[type="email"],
.cpm-popup-body input[type="tel"],
.cpm-popup-body textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.cpm-popup-body input[type="submit"] {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
    outline: none;
}

.cpm-popup-body input[type="submit"]:hover {
    background: #218838;
}

.cpm-popup-body input[type="submit"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

/* Стили для формы обратного звонка */
.callback-form-container {
    max-width: 400px;
}

.callback-form-container .form-description {
    background: #e8f4f8;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #2c5aa0;
    text-align: center;
}

.callback-form-container label {
    display: block;
    margin-bottom: 15px;
    font-weight: 500;
    color: #333;
}

.callback-form-container input[type="text"],
.callback-form-container input[type="tel"],
.callback-form-container select,
.callback-form-container textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    margin-top: 5px;
    box-sizing: border-box;
    outline: none;
}

.callback-form-container input[type="text"]:focus,
.callback-form-container input[type="tel"]:focus,
.callback-form-container select:focus,
.callback-form-container textarea:focus {
    border-color: #007cba;
    outline: none;
    box-shadow: 0 0 5px rgba(0, 124, 186, 0.3);
}

.callback-form-container .form-agreement {
    margin: 20px 0;
    font-size: .8em;
}

.callback-form-container .form-agreement input[type="checkbox"] {
    margin-right: 4px;
    vertical-align: middle;
}

.callback-form-container input[type="submit"] {
    background: #28a745;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s ease;
    outline: none;
}

.callback-form-container input[type="submit"]:hover {
    background: #218838;
}

.callback-form-container input[type="submit"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

/* Улучшенные сообщения об успехе/ошибке */
.wpcf7-response-output {
    padding: 15px !important;
    border-radius: 8px !important;
    margin: 0 !important;
    font-size: 1.1em !important;
    text-align: center !important;
    animation: slideInFromTop 0.4s ease !important;
    color: #28a745;
    border: 2px solid #28a745 !important;
    font-weight: 400 !important;
}

.wpcf7-mail-sent-ok {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%) !important;
    color: #155724 !important;
    border: 2px solid #28a745 !important;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2) !important;
}

.wpcf7-mail-sent-ok:before {
    content: "✓ ";
    font-size: 18px;
    margin-right: 8px;
}

.wpcf7-validation-errors {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%) !important;
    color: #721c24 !important;
    border: 2px solid #EA2F33 !important;
    box-shadow: 0 4px 15px rgba(234, 47, 51, 0.2) !important;
}

.wpcf7-validation-errors:before {
    content: "⚠ ";
    font-size: 18px;
    margin-right: 8px;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .cpm-popup-content {
        width: 95% !important;
        max-width: none !important;
        margin: 10px;
    }
    
    .cpm-popup-header {
        padding: 15px 20px 10px;
    }
    
    .cpm-popup-title {
        font-size: 18px;
    }
    
    .cpm-popup-body {
        padding: 20px;
    }
    
    .cpm-popup-trigger {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .callback-button {
        font-size: 12px;
        padding: 4px 8px;
    }
}

/* Дополнительная мобильная оптимизация */
@media (max-width: 480px) {
    .cpm-popup-content {
        width: 96% !important;
        margin: 5px !important;
        border-radius: 8px !important;
    }
    
    .cpm-popup-header {
        padding: 12px 15px 8px !important;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }
    
    .cpm-popup-title {
        font-size: 1.3em !important;
    }
    
    .cpm-popup-body {
        padding: 15px !important;
    }
    
    /* Формы на мобильных */
    .cpm-popup-body input,
    .cpm-popup-body textarea {
        font-size: 16px !important; /* Предотвращает зум на iOS */
        padding: 12px !important;
    }
    
    .cpm-popup-body input[type="submit"] {
        width: 100% !important;
        padding: 15px !important;
        font-size: 16px !important;
    }
}

/* CSS для блокировки прокрутки при открытом попапе */
body.cpm-popup-open {
    overflow: hidden;
    padding-right: 17px;
}
