/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #faf7ff 0%, #f0e6ff 25%, #ffe6f2 50%, #fff0f5 75%, #fef7ff 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Header styles */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    color: #8b5cf6;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.home-btn {
    background: white;
    color: #8b5cf6;
    padding: 0.5rem 1.25rem;
    border: 2px solid #8b5cf6;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.home-btn:hover {
    background: #8b5cf6;
    color: white;
}

/* Floating shapes background */
.floating-shapes {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.5;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    background: #ec4899;
    bottom: -50px;
    right: -50px;
    animation-delay: 5s;
}

.shape-3 {
    width: 250px;
    height: 250px;
    background: #6366f1;
    top: 50%;
    left: 50%;
    animation-delay: 10s;
}

/* Auth container */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    padding-top: 5rem;
}

.auth-card {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 450px;
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

/* Tab switcher */
.tab-switcher {
    display: flex;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn.active {
    color: #8b5cf6;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    animation: slideIn 0.3s ease;
}

.tab-btn:hover {
    background: #f3f4f6;
}

/* Auth form */
.auth-form {
    padding: 1.5rem 2rem; /* Изменено для лучшего баланса */
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.auth-form h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 0.75rem; /* Уменьшено для компактности */
}

.subtitle {
    color: #6b7280;
    margin-bottom: 1rem; /* Уменьшено с 1.5rem */
}

/* Form groups */
.form-group {
    margin-bottom: 0.875rem; /* Уменьшено с 1.25rem */
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem; /* Уменьшено с 0.5rem */
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Password input wrapper */
.password-input-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #8b5cf6;
}

/* Password strength indicator */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.strength-fill {
    height: 100%;
    width: 0;
    background: #ef4444;
    transition: all 0.3s ease;
}

.strength-text {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Error messages */
.error-message {
    display: block;
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    min-height: 1rem;
}

/* Form options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
    cursor: pointer;
}

.checkbox-label input {
    margin-right: 0.5rem;
    width: auto;
    cursor: pointer;
}

.checkbox-label a {
    color: #8b5cf6;
    text-decoration: none;
    font-weight: 600;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.forgot-password {
    font-size: 0.875rem;
    color: #8b5cf6;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.forgot-password:hover {
    text-decoration: underline;
}

/* Submit button */
.submit-btn {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(139, 92, 246, 0.3);
}

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

/* Divider */
.divider {
    text-align: center;
    margin: 1rem 0; /* Уменьшено с 1.5rem */
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e5e7eb;
}

.divider span {
    background: white;
    padding: 0 1rem;
    color: #6b7280;
    font-size: 0.875rem;
    position: relative;
}

/* Social login */
.social-login {
    display: flex;
    gap: 1rem;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
}

.social-btn:hover {
    background: #f9fafb;
    border-color: #8b5cf6;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: #f3f4f6;
    color: #374151;
}

.back-to-login {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.back-link {
    color: #8b5cf6;
    text-decoration: none;
    font-weight: 600;
}

.back-link:hover {
    text-decoration: underline;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    max-width: 500px;
    font-weight: 500;
    animation: slideInRight 0.3s ease-out;
}

.notification-info {
    background: #eff6ff;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.notification-success {
    background: #f0fdf4;
    color: #166534;
    border-left: 4px solid #22c55e;
}

.notification-error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.notification-warning {
    background: #fffbeb;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    margin-left: 1rem;
    padding: 0;
    line-height: 1;
}

.notification-close:hover {
    opacity: 1;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading states */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

/* Error states */
.form-group .error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
    min-height: 1.25rem;
}

/* Disabled states */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button:disabled:hover {
    transform: none;
}

/* Animations */
@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }
    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

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

/* Responsive design */
/* Мобильные телефоны */
@media (max-width: 480px) {
    .header {
        padding: 0.75rem 1rem;
    }
    
    .auth-container {
        padding: 0.5rem;
        padding-top: 3.5rem;
    }
    
    .auth-card {
        border-radius: 1rem;
        max-width: 100%;
        margin: 0 0.5rem;
    }
    
    .auth-form {
        padding: 1.25rem;
    }
    
    .auth-form h2 {
        font-size: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .social-login {
        flex-direction: column;
    }
    
    .modal-content {
        padding: 1.25rem;
        width: 95%;
    }
    
    .tab-btn {
        font-size: 0.9rem;
        padding: 0.875rem;
    }
    
    .submit-btn {
        padding: 0.75rem;
        font-size: 0.95rem;
    }
}

/* Планшеты портретная ориентация */
@media (min-width: 481px) and (max-width: 768px) {
    .auth-container {
        padding: 1rem;
        padding-top: 4rem;
    }
    
    .auth-card {
        max-width: 500px;
    }
    
    .auth-form {
        padding: 1.75rem;
    }
    
    .social-login {
        flex-direction: row;
        gap: 0.75rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
}

/* Планшеты ландшафтная ориентация и маленькие ноутбуки */
@media (min-width: 769px) and (max-width: 1024px) {
    .auth-container {
        padding: 2rem;
    }
    
    .auth-card {
        max-width: 480px;
    }
    
    .auth-form {
        padding: 2rem;
    }
    
    .auth-form h2 {
        font-size: 1.875rem;
    }
}

/* Ноутбуки и десктопы */
@media (min-width: 1025px) and (max-width: 1440px) {
    .auth-card {
        max-width: 460px;
    }
    
    .auth-form {
        padding: 2rem 2.5rem;
    }
    
    .auth-form h2 {
        font-size: 2rem;
    }
}

/* Большие экраны */
@media (min-width: 1441px) {
    .auth-card {
        max-width: 500px;
    }
    
    .auth-form {
        padding: 2.5rem 3rem;
    }
    
    .auth-form h2 {
        font-size: 2.25rem;
    }
    
    .form-group input {
        padding: 0.875rem;
        font-size: 1.0625rem;
    }
    
    .submit-btn {
        padding: 1rem;
        font-size: 1.125rem;
    }
}

/* Специальные стили для очень маленьких телефонов */
@media (max-width: 360px) {
    .auth-card {
        border-radius: 0.75rem;
    }
    
    .auth-form {
        padding: 1rem;
    }
    
    .auth-form h2 {
        font-size: 1.25rem;
    }
    
    .social-btn {
        padding: 0.625rem;
        font-size: 0.8rem;
    }
    
    .form-group input {
        padding: 0.625rem;
        font-size: 0.9rem;
    }
}

/* Адаптация для высоты экрана (для ландшафтного режима телефонов) */
@media (max-height: 600px) and (orientation: landscape) {
    .auth-container {
        padding-top: 3rem;
        min-height: auto;
    }
    
    .auth-card {
        margin: 1rem auto;
    }
    
    .auth-form {
        padding: 1rem 1.5rem;
    }
    
    .form-group {
        margin-bottom: 0.625rem;
    }
    
    .auth-form h2 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }
    
    .tab-btn {
        padding: 0.75rem;
    }
}