/* Модальное окно */
.cpg-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: cpg-modal-fade-in 0.3s ease-out;
}

@keyframes cpg-modal-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.cpg-modal-content {
    background-color: #fff;
    margin: 2% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: cpg-modal-slide-in 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes cpg-modal-slide-in {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cpg-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cpg-modal-header h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
}

.cpg-modal-close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
    padding: 5px;
    border-radius: 4px;
    user-select: none;
}

.cpg-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.cpg-modal-close:active {
    transform: scale(0.95);
}

/* Подсказка для закрытия */
.cpg-modal-close::after {
    content: '';
    position: absolute;
    top: -10px;
    right: -10px;
    left: -10px;
    bottom: -10px;
    border-radius: 8px;
    pointer-events: none;
}

.cpg-modal-close {
    position: relative;
}

.cpg-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Информация о товаре */
.cpg-product-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.cpg-product-info h4 {
    margin: 0;
    color: #333;
    font-size: 1.1em;
}

/* Форма */
.cpg-form-group {
    margin-bottom: 20px;
}

.cpg-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.cpg-form-group input[type="number"],
.cpg-form-group input[type="email"],
.cpg-form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.cpg-form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cpg-help-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Методы оплаты */
.cpg-payment-methods {
    display: flex;
    gap: 15px;
    flex-direction: column;
}

.cpg-payment-method {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    transition: all 0.3s;
    background: white;
}

.cpg-payment-method:hover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

.cpg-payment-method input[type="radio"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.cpg-payment-method input[type="radio"]:checked {
    accent-color: #667eea;
}

.cpg-payment-method:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background-color: #f0f2ff;
}

.cpg-payment-method span {
    font-weight: 500;
    color: #333;
}

/* Чекбокс согласия с правилами */
.cpg-checkbox-label {
    display: flex !important;
    align-items: flex-start;
    cursor: pointer;
    font-weight: 500 !important;
    color: #333 !important;
    margin-bottom: 0 !important;
    line-height: 1.4;
}

.cpg-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
    transform: scale(1.2);
    accent-color: #667eea;
    flex-shrink: 0;
}

.cpg-checkbox-label span {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.cpg-checkbox-label a {
    color: #007cba;
    text-decoration: underline;
    transition: color 0.3s;
}

.cpg-checkbox-label a:hover {
    color: #0056b3;
    text-decoration: none;
}

/* Кнопки */
.cpg-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.cpg-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 100%;
}

.cpg-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.cpg-btn-primary:disabled,
.cpg-btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: #6c757d !important;
}

.cpg-copy-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    margin-left: 10px;
}

.cpg-copy-btn:hover {
    background: #218838;
    transform: translateY(-1px); 
}

.cpg-copy-btn.cpg-copied {
    background: #6c757d;
}

/* Информация о платеже */
.cpg-payment-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.cpg-payment-info > div {
    margin-bottom: 15px;
}

.cpg-payment-info > div:last-child {
    margin-bottom: 0;
}

.cpg-wallet-address {
    margin-top: 20px;
}

.cpg-wallet-address input[type="text"] {
    width: calc(100% - 135px);
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: #f8f9fa;
    display: inline-block;
}

.cpg-btn-copy {
    background: #28a745;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    margin-left: 10px;
    display: inline-block;
    width: 120px;
}

.cpg-btn-copy:hover {
    background: #218838;
    transform: translateY(-1px);
}

.cpg-address-box {
    display: flex;
    align-items: center;
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    margin-top: 8px;
    word-break: break-all;
}

.cpg-address-box span {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #495057;
}

/* Таймер */
.cpg-timer-section {
    text-align: center;
    margin: 25px 0;
    padding: 20px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    border-radius: 10px;
    color: white;
}

.cpg-timer-label {
    font-size: 14px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.cpg-timer {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    border: 1px solid #dee2e6;
}

#cpg-countdown {
    font-size: 1.8em;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    color: #dc3545;
    display: inline-block;
    margin-left: 10px;
}

.cpg-timer.cpg-expired {
    color: #ff6b6b;
    animation: cpg-pulse 1s infinite;
}

@keyframes cpg-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Статус */
.cpg-status-section {
    text-align: center;
    margin: 20px 0;
}

.cpg-status {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
}

#cpg-payment-status {
    font-weight: 500;
    margin-bottom: 10px;
}

.cpg-loading {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: cpg-spin 1s linear infinite;
    margin: 10px auto;
}

.cpg-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.cpg-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cpg-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.cpg-check-icon {
    font-size: 1.2em;
    font-weight: bold;
}

/* Спиннер */
.cpg-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: cpg-spin 1s linear infinite;
}

@keyframes cpg-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Инструкции */
.cpg-instructions {
    background: #e3f2fd;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #2196f3;
    margin-top: 20px;
}

.cpg-instructions h4 {
    margin: 0 0 15px 0;
    color: #1976d2;
    font-size: 1.1em;
}

.cpg-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.cpg-instructions li {
    margin-bottom: 8px;
    color: #424242;
    line-height: 1.5;
}

/* Адаптивность */
@media (max-width: 768px) {
    .cpg-modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 95vh;
    }
    
    .cpg-modal-header {
        padding: 15px 20px;
    }
    
    .cpg-modal-body {
        padding: 20px;
    }
    
    .cpg-payment-methods {
        flex-direction: column;
    }
    
    .cpg-radio {
        min-width: auto;
    }
    
    .cpg-timer {
        font-size: 2em;
    }
    
    .cpg-address-box {
        flex-direction: column;
        gap: 10px;
    }
    
    .cpg-copy-btn {
        margin-left: 0;
        width: 100%;
    }
    
    .cpg-success-icon,
    .cpg-expired-icon {
        font-size: 3em;
    }
}

/* Адаптивность для маленьких экранов по высоте */
@media (max-height: 700px) {
    .cpg-modal-content {
        margin: 1% auto;
        max-height: 98vh;
    }
    
    .cpg-checkout-content {
        max-height: 98vh;
    }
    
    .cpg-checkout-content .cpg-modal-body {
        max-height: calc(98vh - 70px);
    }
    
    .cpg-modal-header {
        padding: 12px 20px;
    }
    
    .cpg-modal-header h3 {
        font-size: 1.2em;
    }
    
    .cpg-modal-body {
        padding: 15px;
    }
    
    .cpg-product-info {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .cpg-form-group {
        margin-bottom: 15px;
    }
    
    .cpg-form-group input[type="number"],
    .cpg-form-group input[type="email"],
    .cpg-form-group input[type="text"] {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    .cpg-payment-method {
        padding: 10px 12px;
    }
    
    .cpg-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .cpg-payment-info {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .cpg-timer-section {
        margin: 15px 0;
        padding: 15px;
    }
    
    .cpg-timer {
        padding: 12px;
        margin: 12px 0;
    }
    
    #cpg-countdown {
        font-size: 1.5em;
    }
    
    .cpg-instructions {
        padding: 15px;
        margin-top: 15px;
    }
    
    .cpg-instructions h4 {
        font-size: 1em;
        margin-bottom: 10px;
    }
    
    .cpg-instructions li {
        margin-bottom: 6px;
        font-size: 14px;
    }
}

/* Адаптивность для очень маленьких экранов */
@media (max-height: 600px) {
    .cpg-modal-content {
        margin: 0.5% auto;
        max-height: 99vh;
    }
    
    .cpg-checkout-content {
        max-height: 99vh;
    }
    
    .cpg-checkout-content .cpg-modal-body {
        max-height: calc(99vh - 60px);
    }
    
    .cpg-modal-header {
        padding: 10px 15px;
    }
    
    .cpg-modal-header h3 {
        font-size: 1.1em;
    }
    
    .cpg-modal-body {
        padding: 12px;
    }
    
    .cpg-product-info {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .cpg-form-group {
        margin-bottom: 12px;
    }
    
    .cpg-form-group input[type="number"],
    .cpg-form-group input[type="email"],
    .cpg-form-group input[type="text"] {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .cpg-payment-method {
        padding: 8px 10px;
    }
    
    .cpg-btn {
        padding: 8px 15px;
        font-size: 13px;
    }
    
    .cpg-payment-info {
        padding: 12px;
        margin-bottom: 12px;
    }
    
    .cpg-timer-section {
        margin: 12px 0;
        padding: 12px;
    }
    
    .cpg-timer {
        padding: 10px;
        margin: 10px 0;
    }
    
    #cpg-countdown {
        font-size: 1.3em;
    }
    
    .cpg-instructions {
        padding: 12px;
        margin-top: 12px;
    }
    
    .cpg-instructions h4 {
        font-size: 0.95em;
        margin-bottom: 8px;
    }
    
    .cpg-instructions li {
        margin-bottom: 4px;
        font-size: 13px;
    }
}

/* Сообщения об успехе и ошибках */
.cpg-success-message,
.cpg-expired-message {
    text-align: center;
    padding: 30px 20px;
}

.cpg-success-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.cpg-expired-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.cpg-success-message h3 {
    color: #28a745;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.cpg-expired-message h3 {
    color: #dc3545;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.cpg-order-details {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #28a745;
}

.cpg-order-details p {
    margin: 5px 0;
}

/* Кнопки в попапе успешной оплаты */
.cpg-success-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.cpg-btn-download {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    width: 100%;
    order: 1;
}

.cpg-btn-download:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
}

.cpg-btn-download:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.cpg-success-buttons .cpg-btn-primary {
    width: 100%;
    order: 2;
}

/* Индикатор тестового режима */
.cpg-test-mode-notice {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 15px 0;
    text-align: center;
    font-size: 14px;
    border-left: 4px solid #e65100;
    animation: cpg-test-mode-pulse 2s infinite;
}

@keyframes cpg-test-mode-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4);
    }
    50% { 
        box-shadow: 0 0 0 10px rgba(255, 152, 0, 0);
    }
}

/* Дополнительные стили для кнопки "Купить" */
.buy {
    transition: all 0.3s ease;
}

.buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Анимации для модального окна */
.cpg-modal.fade-in {
    animation: cpg-fade-in 0.3s ease-out;
}

@keyframes cpg-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Специальные стили для модального окна оплаты */
.cpg-checkout-content {
    max-height: 90vh;
}

.cpg-checkout-content .cpg-modal-body {
    overflow-y: auto;
    max-height: calc(90vh - 80px); /* Вычитаем высоту заголовка */
}

/* Стили для уведомлений */
.cpg-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    animation: cpg-slide-in 0.3s ease-out;
}

.cpg-notification.success {
    background: #28a745;
}

.cpg-notification.error {
    background: #dc3545;
}

@keyframes cpg-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

