* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.profile-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

header h1 {
    color: white;
    font-size: 1.5rem;
    margin: 0;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

.back-link {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.profile-main {
    background: white;
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.2);
}

.profile-card {
    max-width: 500px;
    margin: 0 auto;
}

.profile-avatar {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-avatar img {
    border-radius: 50%;
    border: 4px solid #6366f1;
    background: #f1f5f9;
}

.profile-form {
    margin-bottom: 1.5rem;
}

.profile-form h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #1e293b;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.form-group input:disabled {
    background: #f1f5f9;
    color: #64748b;
}

.form-group small {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.25rem;
    display: block;
}

.divider {
    height: 1px;
    background: #e2e8f0;
    margin: 1.5rem 0;
}

.button-std {
    width: 100%;
    padding: 0.75rem;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.button-std:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

.button-std:active {
    transform: translateY(0);
}

.error-message {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.success-message {
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Уведомления */
.notification-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e293b;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 0.875rem;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification-toast.success {
    background: #10b981;
}

.notification-toast.error {
    background: #ef4444;
}

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

@media (max-width: 640px) {
    .profile-container {
        padding: 1rem;
    }
    
    header {
        flex-direction: column;
    }
}

/* аватар */
.avatar-controls {
    margin-top: 0.5rem;
    text-align: center;
}

.avatar-modal {
    max-width: 500px;
}

.current-avatar-section {
    text-align: center;
    margin-bottom: 1rem;
}

.current-avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    margin-top: 0.5rem;
}

.avatar-upload-section {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.preset-avatars-section {
    margin-top: 1rem;
}

.preset-avatars-section label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.preset-avatars-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.preset-avatar-item {
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    border-radius: 50%;
    padding: 0.25rem;
}

.preset-avatar-item img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.preset-avatar-item.selected img {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}

.preset-avatar-item:hover img {
    transform: scale(1.05);
}

.delete-btn {
    background: #dc2626;
}

.delete-btn:hover {
    background: #b91c1c;
}

@media (max-width: 480px) {
    .preset-avatars-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .preset-avatar-item img {
        width: 60px;
        height: 60px;
    }
}

/* ========== МОДАЛЬНОЕ ОКНО ВЫБОРА АВАТАРА ========== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 1.5rem;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.2);
    position: relative;
}

.avatar-modal {
    max-width: 500px;
}

.close-avatar {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #64748b;
    transition: color 0.2s;
}

.close-avatar:hover {
    color: #1e293b;
}

.current-avatar-section {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.current-avatar-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #1e293b;
}

.current-avatar-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #6366f1;
    margin-top: 0.5rem;
}

.avatar-upload-section {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.avatar-upload-section .button-std {
    flex: 1;
}

.preset-avatars-section {
    margin-top: 1rem;
}

.preset-avatars-section label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: #1e293b;
}

.preset-avatars-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.preset-avatar-item {
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    border-radius: 50%;
    padding: 0.25rem;
}

.preset-avatar-item img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.preset-avatar-item.selected img {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}

.preset-avatar-item:hover img {
    transform: scale(1.05);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.avatar-controls {
    margin-top: 0.75rem;
    text-align: center;
}

#changeAvatarBtn {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

#changeAvatarBtn:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .preset-avatars-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .preset-avatar-item img {
        width: 60px;
        height: 60px;
    }
    .avatar-upload-section {
        flex-direction: column;
    }
}