/* ============================================
   RESPONSIVE MODAL STYLES
   Адаптивные модальные окна для всех экранов
   ============================================ */

/* Базовые стили модалок */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    position: relative;
    background: white;
    margin: 0 auto;
    padding: 0;
    width: 100%;
    max-width: 480px;
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.35);
    animation: modalSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center center;
}

@keyframes modalSlideIn {
    from { 
        opacity: 0; 
        transform: scale(0.9) translateY(-30px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

/* Кнопка закрытия */
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    font-size: 24px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    border: none;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(0,0,0,0.1);
    color: #333;
    transform: rotate(90deg);
}

/* Внутренний контент */
.modal-body {
    padding: 48px 32px 32px;
    text-align: center;
}

.modal-icon {
    font-size: 56px;
    margin-bottom: 20px;
    display: block;
}

.modal-title {
    margin: 0 0 12px;
    color: #1a1a2e;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.3;
}

.modal-subtitle {
    color: #666;
    margin: 0 0 28px;
    line-height: 1.6;
    font-size: 15px;
}

/* Форма */
.modal-form {
    margin-bottom: 24px;
}

.modal-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e8e8e8;
    border-radius: 14px;
    font-size: 16px;
    margin-bottom: 14px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background: #fafafa;
}

.modal-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.modal-input::placeholder {
    color: #999;
}

.modal-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.modal-btn:active {
    transform: translateY(0);
}

.modal-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Секция мессенджеров */
.modal-messengers {
    border-top: 1px solid #eee;
    padding-top: 24px;
    margin-top: 8px;
}

.modal-messengers-title {
    color: #888;
    margin: 0 0 16px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-messengers-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.messenger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 130px;
    justify-content: center;
}

.messenger-btn.whatsapp {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.messenger-btn.telegram {
    background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
}

.messenger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Privacy note */
.modal-privacy {
    color: #aaa;
    font-size: 11px;
    margin-top: 16px;
    line-height: 1.5;
}

.modal-privacy a {
    color: #667eea;
    text-decoration: none;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Планшеты */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 16px;
        align-items: flex-start;
    }
    
    .modal-content {
        max-width: 100%;
        border-radius: 20px;
        margin-top: 10vh;
    }
    
    .modal-body {
        padding: 40px 24px 28px;
    }
    
    .modal-icon {
        font-size: 48px;
        margin-bottom: 16px;
    }
    
    .modal-title {
        font-size: 22px;
    }
    
    .modal-subtitle {
        font-size: 14px;
        margin-bottom: 24px;
    }
    
    .modal-input {
        padding: 14px 16px;
        font-size: 16px; /* Предотвращает зум на iOS */
    }
    
    .modal-btn {
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .messenger-btn {
        flex: 1;
        min-width: 120px;
        padding: 12px 16px;
    }
}

/* Мобильные телефоны */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 0;
    }
    
    .modal-content {
        margin-top: 0;
        min-height: 100vh;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .modal-close {
        top: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
        font-size: 28px;
    }
    
    .modal-body {
        padding: 60px 20px 32px;
    }
    
    .modal-icon {
        font-size: 44px;
    }
    
    .modal-title {
        font-size: 20px;
    }
    
    .modal-subtitle {
        font-size: 14px;
    }
    
    .modal-messengers-btns {
        flex-direction: column;
    }
    
    .messenger-btn {
        width: 100%;
    }
}

/* Маленькие экраны (iPhone SE и подобные) */
@media (max-width: 375px) {
    .modal-body {
        padding: 50px 16px 24px;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-input {
        padding: 12px 14px;
    }
    
    .modal-btn {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* Ландшафтная ориентация на мобильных */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        min-height: auto;
        margin: 20px auto;
        border-radius: 16px;
    }
    
    .modal-body {
        padding: 32px 24px 24px;
    }
    
    .modal-icon {
        font-size: 36px;
        margin-bottom: 12px;
    }
    
    .modal-title {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .modal-subtitle {
        margin-bottom: 16px;
        font-size: 13px;
    }
}

/* ============================================
   UTM BADGE (показывает источник трафика)
   ============================================ */

.utm-badge {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 11px;
    z-index: 9999;
    max-width: 300px;
    backdrop-filter: blur(10px);
}

.utm-badge.visible {
    display: block;
}

/* ============================================
   LOADING STATE
   ============================================ */

.modal-btn.loading {
    pointer-events: none;
}

.modal-btn.loading .btn-text {
    opacity: 0;
}

.modal-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
