/* Auth Modal Styles */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.auth-modal.show {
    display: flex !important;
    opacity: 1;
}

.auth-modal-content {
    background: #1a1a2e;
    border-radius: 20px;
    padding: 30px 20px;
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
    border: 1px solid rgba(0, 255, 140, 0.2);
    position: relative;
    margin: 0;
    transform: translateY(0);
    box-sizing: border-box;
}

.auth-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(0, 255, 140, 0.2);
}

.auth-modal-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #e0e0e0;
    margin: 0;
}

.auth-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.auth-close-btn:hover {
    color: #00FF8C;
    background: rgba(0, 255, 140, 0.1);
}

.auth-form {
    margin-bottom: 20px;
}

.auth-form-group {
    margin-bottom: 25px;
}

.auth-form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 8px;
}

.auth-form-group input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid rgba(0, 255, 140, 0.3);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: rgba(40, 40, 60, 0.8);
    color: #e0e0e0;
    box-sizing: border-box;
}

.auth-form-group input:focus {
    outline: none;
    border-color: #00FF8C;
    box-shadow: 0 0 0 3px rgba(0, 255, 140, 0.1);
    background: rgba(40, 40, 60, 1);
}

.auth-form-group small {
    display: block;
    font-size: 0.8rem;
    color: #999;
    margin-top: 5px;
    line-height: 1.4;
}

.auth-form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.auth-btn {
    flex: 1;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    min-height: 50px;
}

.auth-btn-primary {
    background: linear-gradient(135deg, #00FF8C, #00CC6A);
    color: #1a1a2e;
    box-shadow: 0 5px 15px rgba(0, 255, 140, 0.3);
}

.auth-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 255, 140, 0.4);
}

.auth-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(0, 255, 140, 0.3);
}

.auth-btn-secondary {
    background: rgba(40, 40, 60, 0.8);
    color: #b0b0b0;
    border: 2px solid rgba(0, 255, 140, 0.3);
}

.auth-btn-secondary:hover {
    background: rgba(0, 255, 140, 0.1);
    color: #00FF8C;
    border-color: rgba(0, 255, 140, 0.5);
}

.auth-modal-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 255, 140, 0.2);
}

.auth-modal-footer p {
    color: #b0b0b0;
    margin: 0;
    font-size: 0.9rem;
}

.auth-modal-footer a {
    color: #00FF8C;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-modal-footer a:hover {
    color: #00CC6A;
    text-decoration: underline;
}

/* Notification Styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 12px;
    font-weight: 600;
    z-index: 1001;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.notification.error {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.notification.info {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

.notification.warning {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

/* User Account Styles */
.user-account {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(0, 255, 140, 0.1);
    border: 1px solid rgba(0, 255, 140, 0.3);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-account:hover {
    background: rgba(0, 255, 140, 0.2);
    border-color: rgba(0, 255, 140, 0.5);
}

.user-account .p-button {
    color: #00FF8C;
    font-weight: 600;
    font-size: 0.9rem;
}

.user-account .chevron-md {
    color: #00FF8C;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.user-account:hover .chevron-md {
    transform: rotate(90deg);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .auth-modal {
        padding: 10px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    .auth-modal.show {
        display: flex !important;
        opacity: 1;
    }
    
    .auth-modal-content {
        padding: 20px 15px;
        margin: 0;
        width: calc(100% - 20px);
        max-width: 400px;
        max-height: calc(100vh - 20px);
        transform: translateY(0);
        border-radius: 15px;
    }
    
    .auth-modal-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .auth-modal-header h2 {
        font-size: 20px;
    }
    
    .auth-form-group {
        margin-bottom: 15px;
    }
    
    .auth-form-group input,
    .auth-form-group select,
    .auth-form-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 15px;
    }
    
    .auth-form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .auth-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .auth-close-btn {
        font-size: 24px;
        width: 32px;
        height: 32px;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .auth-modal {
        padding: 5px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
    
    .auth-modal.show {
        display: flex !important;
        opacity: 1;
    }
    
    .auth-modal-content {
        padding: 20px 15px;
        margin: 0;
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 20px);
        transform: translateY(0);
    }
    
    .auth-modal-header h2 {
        font-size: 1.5rem;
    }
    
    .auth-form-group input {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .auth-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
}

/* Loading States */
.auth-btn.loading {
    position: relative;
    color: transparent;
}

.auth-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form Validation Styles */
.auth-form-group input.error {
    border-color: #f44336;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

.auth-form-group input.success {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.auth-form-group .error-message {
    color: #f44336;
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
}

.auth-form-group .success-message {
    color: #4CAF50;
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

/* Enhanced password validation styles */
.auth-form-group input.success {
    border-color: #4CAF50 !important;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1) !important;
    background: rgba(76, 175, 80, 0.05);
}

.auth-form-group input.error {
    border-color: #f44336 !important;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1) !important;
    background: rgba(244, 67, 54, 0.05);
}

/* Password strength indicator */
.password-strength {
    margin-top: 8px;
    font-size: 0.8rem;
}

.password-strength.weak {
    color: #f44336;
}

.password-strength.medium {
    color: #FF9800;
}

.password-strength.strong {
    color: #4CAF50;
}

/* 2FA Form Styles */
.two-fa-form {
    margin-top: 20px;
    padding: 25px;
    background: rgba(0, 255, 140, 0.05);
    border-radius: 15px;
    border: 1px solid rgba(0, 255, 140, 0.2);
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.4s ease-out;
}

.two-fa-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #00FF8C, #00CC6A);
    border-radius: 15px 15px 0 0;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.two-fa-form .form-group {
    margin-bottom: 20px;
}

.two-fa-form label {
    color: #00FF8C;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.two-fa-form input {
    width: 100%;
    padding: 15px 20px;
    background: rgba(40, 40, 60, 0.8);
    border: 2px solid rgba(0, 255, 140, 0.3);
    border-radius: 12px;
    color: #e0e0e0;
    font-size: 20px;
    text-align: center;
    letter-spacing: 3px;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.two-fa-form input:focus {
    border-color: #00FF8C;
    box-shadow: 0 0 0 3px rgba(0, 255, 140, 0.2), 0 4px 12px rgba(0, 255, 140, 0.1);
    outline: none;
    background: rgba(40, 40, 60, 1);
    transform: translateY(-1px);
}

.two-fa-form input::placeholder {
    color: rgba(176, 176, 176, 0.6);
    letter-spacing: 2px;
}

.form-help {
    color: #b0b0b0;
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
}

.two-fa-form .form-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
}

/* 2FA Button Styles */
.two-fa-form .btn {
    flex: 1;
    padding: 15px 25px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    min-height: 50px;
    position: relative;
    overflow: hidden;
}

.two-fa-form .btn-primary {
    background: linear-gradient(135deg, #00FF8C, #00CC6A);
    color: #1a1a2e;
    box-shadow: 0 5px 15px rgba(0, 255, 140, 0.3);
    border: 2px solid transparent;
}

.two-fa-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 255, 140, 0.4);
    background: linear-gradient(135deg, #00CC6A, #00B85A);
}

.two-fa-form .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(0, 255, 140, 0.3);
}

.two-fa-form .btn-secondary {
    background: rgba(40, 40, 60, 0.8);
    color: #b0b0b0;
    border: 2px solid rgba(0, 255, 140, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.two-fa-form .btn-secondary:hover {
    background: rgba(0, 255, 140, 0.1);
    color: #00FF8C;
    border-color: rgba(0, 255, 140, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 140, 0.2);
}

.two-fa-form .btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 255, 140, 0.2);
}

/* Enhanced visual effects for 2FA buttons */
.two-fa-form .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;
}

.two-fa-form .btn:hover::before {
    left: 100%;
}

/* Special styling for the "Войти" button */
.two-fa-form .btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.two-fa-form .btn-primary:active::after {
    width: 100px;
    height: 100px;
}

/* Focus states for accessibility */
.two-fa-form .btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 255, 140, 0.3);
}

.two-fa-form .btn-primary:focus {
    box-shadow: 0 5px 15px rgba(0, 255, 140, 0.3), 0 0 0 3px rgba(0, 255, 140, 0.3);
}

.two-fa-form .btn-secondary:focus {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(0, 255, 140, 0.3);
}

/* Responsive Design for 2FA */
@media (max-width: 768px) {
    .two-fa-form .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .two-fa-form input {
        font-size: 16px;
    }
    
    .two-fa-form .btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.95rem;
    }
    
    /* Change button order on mobile - Submit first, then Cancel */
    .two-fa-form .form-actions .btn-primary {
        order: 1;
    }
    
    .two-fa-form .form-actions .btn-secondary {
        order: 2;
    }
}

@media (max-width: 480px) {
    .two-fa-form .btn {
        padding: 12px 18px;
        font-size: 0.9rem;
        min-height: 48px;
    }
    
    .two-fa-form .btn-primary:hover,
    .two-fa-form .btn-secondary:hover {
        transform: none; /* Disable hover transforms on mobile */
    }
    
    .two-fa-form .btn-primary:active,
    .two-fa-form .btn-secondary:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* Дополнительные исправления для мобильных устройств */
@media (max-width: 899px) {
    /* Исправления для кнопок регистрации и входа */
    .js_signup, .js_login {
        -webkit-tap-highlight-color: rgba(0, 196, 107, 0.3) !important;
        touch-action: manipulation !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 10 !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    /* Исправления для основных кнопок */
    .btn-main {
        -webkit-tap-highlight-color: rgba(0, 196, 107, 0.3) !important;
        touch-action: manipulation !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 10 !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    /* Исправления для кнопок в модальных окнах */
    .auth-btn {
        -webkit-tap-highlight-color: rgba(0, 196, 107, 0.3) !important;
        touch-action: manipulation !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 10 !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    /* Специальные исправления для кнопок submit в формах */
    .auth-btn[type="submit"] {
        -webkit-tap-highlight-color: rgba(0, 196, 107, 0.3) !important;
        touch-action: manipulation !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 10 !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    /* Специальные исправления для кнопок закрытия */
    .auth-close-btn {
        -webkit-tap-highlight-color: rgba(0, 196, 107, 0.3) !important;
        touch-action: manipulation !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        pointer-events: auto !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 10 !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        border: none !important;
        outline: none !important;
        box-shadow: none !important;
    }
    
    /* Исправления для ссылок-кнопок */
    a.btn-main, a.button-main {
        display: inline-flex !important;
        text-decoration: none !important;
        pointer-events: auto !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: rgba(0, 196, 107, 0.3) !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        user-select: none !important;
        cursor: pointer !important;
        position: relative !important;
        z-index: 10 !important;
    }
    
    /* Убираем возможные блокировки от родительских элементов */
    .section-i, .section-text, .buttons {
        pointer-events: auto !important;
    }
    
    /* Специальные исправления для iOS */
    @supports (-webkit-touch-callout: none) {
        .btn-main, .js_login, .js_signup, .auth-btn {
            -webkit-touch-callout: none !important;
            -webkit-user-select: none !important;
            -webkit-tap-highlight-color: rgba(0, 196, 107, 0.3) !important;
            -webkit-appearance: none !important;
            appearance: none !important;
        }
    }
    
    /* Исправления для модальных окон на мобильных - ИСПРАВЛЕНО */
    .auth-modal {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        z-index: 10000 !important;
        background: rgba(0, 0, 0, 0.8) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 20px !important;
        box-sizing: border-box !important;
        opacity: 0 !important;
        transition: opacity 0.3s ease !important;
    }
    
    .auth-modal.show {
        display: flex !important;
        opacity: 1 !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 20px !important;
    }
    
    .auth-modal-content {
        position: relative !important;
        z-index: 10001 !important;
        background: #1a1a2e !important;
        border-radius: 20px !important;
        padding: 30px 20px !important;
        max-width: 90% !important;
        width: 90% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
        border: 1px solid rgba(0, 255, 140, 0.2) !important;
        margin: 0 auto !important;
        animation: slideUp 0.3s ease !important;
    }
}