/**
 * PUR Unified Modal System Styles
 * Стили для единой модальной системы Pro User Version
 * 
 * @version 4.0.0
 * @since 2025-06-18
 */

/* ========================================
   БАЗОВЫЕ СТИЛИ МОДАЛЬНОГО ОКНА
   ======================================== */

.pur-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.pur-modal-overlay.pur-modal-active {
    opacity: 1;
    visibility: visible;
}

.pur-modal-content {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 900px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pur-modal-active .pur-modal-content {
    transform: scale(1) translateY(0);
}

/* ========================================
   ЗАГОЛОВОК МОДАЛЬНОГО ОКНА
   ======================================== */

.pur-modal-header {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px 16px 0 0;
}

.pur-modal-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
    background: linear-gradient(135deg, #1f2937 0%, #4b5563 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pur-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.pur-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
    transform: scale(1.1);
}

/* ========================================
   КОНТЕНТ МОДАЛЬНОГО ОКНА
   ======================================== */

.pur-modal-body {
    padding: 32px;
}

.pur-modal-open {
    overflow: hidden;
}

/* ========================================
   ПЛАНЫ ПОДПИСОК
   ======================================== */

.pur-plans-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.pur-periods-selector {
    text-align: center;
}

.pur-periods-selector h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #374151;
}

.pur-periods-list {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.pur-period-item {
    background: #f8fafc;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    position: relative;
}

.pur-period-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: translateY(-2px);
}

.pur-period-item.selected {
    border-color: #3b82f6;
    background: #dbeafe;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.pur-period-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
}

.pur-period-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 16px;
}

.pur-period-duration {
    font-size: 14px;
    color: #6b7280;
}

.pur-period-discount {
    background: #10b981;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    position: absolute;
    top: -8px;
    right: -8px;
}

/* ========================================
   КАРТОЧКИ ПЛАНОВ
   ======================================== */

.pur-plans-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.pur-plan-item {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.pur-plan-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.pur-plan-item:hover::before,
.pur-plan-item.selected::before {
    transform: scaleX(1);
}

.pur-plan-item:hover {
    border-color: #3b82f6;
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.pur-plan-item.selected {
    border-color: #3b82f6;
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.1), 0 10px 10px -5px rgba(59, 130, 246, 0.04);
}

.pur-plan-header {
    margin-bottom: 24px;
    text-align: center;
}

.pur-plan-name {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.pur-plan-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

.pur-price-amount {
    font-size: 32px;
    font-weight: 800;
    color: #059669;
    transition: all 0.3s ease;
}

.pur-price-amount.discounted {
    color: #dc2626;
}

.pur-price-period {
    font-size: 16px;
    color: #6b7280;
    font-weight: 500;
}

.pur-plan-features {
    margin-bottom: 24px;
}

.pur-feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.pur-feature-item:last-child {
    border-bottom: none;
}

.pur-feature-icon {
    width: 20px;
    height: 20px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.pur-feature-text {
    color: #374151;
    font-size: 14px;
    line-height: 1.4;
}

.pur-plan-select-btn {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.pur-plan-select-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.pur-plan-select-btn:hover::before {
    left: 100%;
}

.pur-plan-select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
}

.pur-plan-select-btn:active {
    transform: translateY(0);
}

/* ========================================
   СЕКЦИЯ ПОКУПКИ
   ======================================== */

.pur-purchase-section {
    background: #f8fafc;
    border-radius: 16px;
    padding: 24px;
    margin-top: 24px;
}

.pur-purchase-summary {
    margin-bottom: 24px;
}

.pur-purchase-summary h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.pur-summary-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.pur-summary-plan,
.pur-summary-period,
.pur-summary-total {
    font-size: 14px;
    color: #374151;
}

.pur-summary-total {
    font-weight: 600;
    font-size: 16px;
    color: #059669;
    padding-top: 8px;
    border-top: 1px solid #e5e7eb;
}

.pur-payment-methods {
    margin-bottom: 24px;
}

.pur-payment-methods h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

.pur-payment-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pur-payment-method {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pur-payment-method:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.pur-payment-method input[type="radio"] {
    display: none;
}

.pur-payment-method input[type="radio"]:checked + label {
    color: #3b82f6;
}

.pur-payment-method input[type="radio"]:checked ~ .pur-payment-method {
    border-color: #3b82f6;
    background: #eff6ff;
}

.pur-payment-method label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 500;
    color: #374151;
}

.pur-payment-icon {
    font-size: 20px;
}

.pur-purchase-btn {
    width: 100%;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 18px 24px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pur-purchase-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(5, 150, 105, 0.3);
}

/* ========================================
   АВТОРИЗАЦИЯ
   ======================================== */

.pur-auth-container {
    max-width: 400px;
    margin: 0 auto;
}

.pur-auth-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 24px;
}

.pur-auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.pur-auth-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.pur-auth-tab:hover {
    color: #3b82f6;
    background: #f8fafc;
}

.pur-auth-content {
    position: relative;
}

.pur-auth-panel {
    display: none;
}

.pur-auth-panel.active {
    display: block;
}

.pur-form-group {
    margin-bottom: 20px;
}

.pur-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.pur-form-group input[type="email"],
.pur-form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.pur-form-group input[type="email"]:focus,
.pur-form-group input[type="password"]:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.pur-form-group input[type="checkbox"] {
    margin-right: 8px;
}

.pur-auth-btn {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pur-auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.pur-auth-links {
    text-align: center;
    margin-top: 16px;
}

.pur-auth-links a {
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
}

.pur-auth-links a:hover {
    text-decoration: underline;
}

/* ========================================
   ИНДИКАТОРЫ ЗАГРУЗКИ
   ======================================== */

.pur-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 16px;
}

.pur-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: pur-spin 1s linear infinite;
}

@keyframes pur-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   УВЕДОМЛЕНИЯ
   ======================================== */

.pur-notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 24px;
    border-radius: 12px;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1000000;
    max-width: 400px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: pur-slide-in 0.3s ease;
}

@keyframes pur-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.pur-notification-success {
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
}

.pur-notification-error {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}

.pur-notification-info {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}

.pur-notification-message {
    flex: 1;
    font-weight: 500;
    line-height: 1.4;
}

.pur-notification-close {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.pur-notification-close:hover {
    opacity: 1;
}

/* ========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ======================================== */

@media (max-width: 768px) {
    .pur-modal-content {
        width: 95%;
        margin: 10px;
        border-radius: 12px;
        max-height: 95vh;
    }
    
    .pur-modal-mobile {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .pur-modal-header {
        padding: 20px 24px;
    }
    
    .pur-modal-title {
        font-size: 22px;
    }
    
    .pur-modal-body {
        padding: 24px 20px;
    }
    
    .pur-plans-container {
        gap: 24px;
    }
    
    .pur-plans-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .pur-periods-list {
        flex-direction: column;
        gap: 8px;
    }
    
    .pur-period-item {
        flex-direction: row;
        justify-content: space-between;
        min-width: auto;
    }
    
    .pur-plan-item {
        padding: 20px;
    }
    
    .pur-plan-name {
        font-size: 20px;
    }
    
    .pur-price-amount {
        font-size: 28px;
    }
    
    .pur-notification {
        right: 16px;
        top: 16px;
        left: 16px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .pur-modal-header {
        padding: 16px 20px;
    }
    
    .pur-modal-title {
        font-size: 20px;
    }
    
    .pur-modal-body {
        padding: 20px 16px;
    }
    
    .pur-plans-container {
        gap: 20px;
    }
    
    .pur-plan-item {
        padding: 16px;
    }
    
    .pur-purchase-section {
        padding: 20px;
    }
    
    .pur-auth-container {
        max-width: none;
    }
}

/* ========================================
   ДОПОЛНИТЕЛЬНЫЕ ЭЛЕМЕНТЫ
   ======================================== */

.pur-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pur-popular-badge {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

/* ========================================
   АНИМАЦИИ И ЭФФЕКТЫ
   ======================================== */

.pur-fade-in {
    animation: pur-fade-in 0.3s ease;
}

@keyframes pur-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pur-pulse {
    animation: pur-pulse 2s infinite;
}

@keyframes pur-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ========================================
   ТЕМНАЯ ТЕМА (ОПЦИОНАЛЬНО)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .pur-modal-content {
        background: #1f2937;
        color: #f9fafb;
        border-color: #374151;
    }
    
    .pur-modal-header {
        background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
        border-color: #374151;
    }
    
    .pur-modal-title {
        color: #f9fafb;
        background: linear-gradient(135deg, #f9fafb 0%, #d1d5db 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    
    .pur-plan-item {
        background: #374151;
        border-color: #4b5563;
    }
    
    .pur-plan-item:hover {
        border-color: #60a5fa;
    }
    
    .pur-period-item {
        background: #374151;
        border-color: #4b5563;
    }
    
    .pur-period-item:hover {
        border-color: #60a5fa;
        background: #1e3a8a;
    }
}
