/* ==================== ОСНОВНЫЕ СТИЛИ ==================== */

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

:root {
    --primary-color: #FF6B6B;
    --primary-dark: #E85555;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --bg-color: #F8F9FA;
    --text-color: #2C3E50;
    --text-light: #7F8C8D;
    --border-color: #E0E0E0;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 15px 40px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

#app {
    width: 100%;
    min-height: 100vh;
    position: relative;
    padding-top: 60px; /* Отступ для элементов управления Telegram */
}

/* ==================== ЭКРАНЫ ==================== */

.screen {
    display: none;
    width: 100%;
    min-height: 100vh;
    padding-bottom: 80px;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ==================== ЭКРАН ЗАГРУЗКИ ==================== */

#loading-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

#loading-screen:not(.active) {
    display: none;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

#loading-screen p {
    margin-top: 20px;
    font-size: 16px;
    font-weight: 500;
}

/* ==================== ЭКРАН ПРИВЕТСТВИЯ ==================== */

#welcome-screen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.welcome-content {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.welcome-logo {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.welcome-content h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.welcome-content > p {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 40px;
}

.welcome-features {
    display: flex;
    justify-content: space-around;
    margin-bottom: 40px;
}

.feature-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.feature-icon {
    font-size: 36px;
}

.feature-text {
    font-size: 14px;
    opacity: 0.9;
}

/* ==================== ЭКРАН СОГЛАШЕНИЯ ==================== */

#agreement-screen {
    padding: 20px;
    background: white;
    overflow-y: auto;
}

.registration-content {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.registration-content h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.agreement-text {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

.agreement-text ol {
    padding-left: 20px;
}

.agreement-text li {
    margin-bottom: 15px;
    line-height: 1.6;
}

/* ==================== ЭКРАН РЕГИСТРАЦИИ ==================== */

#registration-screen {
    padding: 20px;
    background: white;
    overflow-y: auto;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    width: 0%;
    transition: width 0.3s ease;
}

#registration-steps {
    max-width: 600px;
    margin: 0 auto;
}

.reg-step {
    display: none;
}

.reg-step.active {
    display: block;
    animation: slideIn 0.3s ease;
}

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

.reg-step h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.reg-step p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.gender-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gender-btn {
    padding: 18px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gender-btn:hover {
    border-color: var(--primary-color);
    background: rgba(255, 107, 107, 0.05);
}

.gender-btn.selected {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

/* ==================== КНОПКИ ==================== */

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-large {
    padding: 18px 48px;
    font-size: 18px;
}

.btn-group {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.btn:active {
    transform: scale(0.95);
}

/* ==================== ГЛАВНЫЙ ИНТЕРФЕЙС ==================== */

#main-screen {
    background: white;
}

.page {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 100px;
}

.page.active {
    display: flex;
    flex-direction: column;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 700;
}

/* ==================== SWIPE ИНТЕРФЕЙС ==================== */

.swipe-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

#cards-stack {
    position: relative;
    width: 100%;
    height: 70%;
    margin-bottom: 30px;
}

.swipe-card {
    position: absolute;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    cursor: grab;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.swipe-card:active {
    cursor: grabbing;
}

.swipe-card.animating {
    transition: transform 0.6s ease, opacity 0.6s ease;
}

.swipe-card.swipe-right {
    transform: translateX(150%) rotate(20deg);
    opacity: 0;
}

.swipe-card.swipe-left {
    transform: translateX(-150%) rotate(-20deg);
    opacity: 0;
}

.swipe-card-image {
    width: 100%;
    height: 70%;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.swipe-card-info {
    padding: 20px;
    background: white;
}

.swipe-card-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.swipe-card-details {
    color: var(--text-light);
    margin-bottom: 10px;
}

.swipe-card-bio {
    font-size: 14px;
    color: var(--text-color);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.swipe-buttons {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.swipe-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.swipe-btn:hover {
    transform: scale(1.1);
}

.swipe-btn:active {
    transform: scale(0.95);
}

.swipe-btn-pass {
    background: white;
    color: var(--danger-color);
}

.swipe-btn-pass:hover {
    background: var(--danger-color);
    color: white;
}

.swipe-btn-like {
    background: var(--primary-color);
    color: white;
}

.swipe-btn-like:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.swipe-btn-message {
    background: var(--secondary-color);
    color: white;
}

.swipe-btn-message:hover {
    background: #3db3ab;
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

.card-report-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.card-report-btn:hover {
    background: white;
    transform: scale(1.1);
}

.empty-stack {
    text-align: center;
    padding: 40px 20px;
}

.empty-stack svg {
    width: 80px;
    height: 80px;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* ==================== СЕТКА ПРОФИЛЕЙ (Избранное) ==================== */

.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.profile-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
}

.profile-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.profile-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.profile-card-info {
    padding: 12px;
}

.profile-card-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-card-details {
    font-size: 13px;
    color: var(--text-light);
}

.profile-card-badge {
    display: inline-block;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 12px;
    margin-top: 6px;
}

.badge-favorite {
    background: #FFE5E5;
    color: var(--primary-color);
}

/* ==================== ЧАТЫ ==================== */

.chats-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.chat-last-message {
    font-size: 14px;
    color: var(--text-light);
}

/* ==================== ПРОФИЛЬ ПОЛЬЗОВАТЕЛЯ ==================== */

.my-profile {
    max-width: 600px;
    margin: 0 auto;
}

.my-profile-header {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 20px;
    color: white;
    margin-bottom: 20px;
}

.my-profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid white;
    margin-bottom: 15px;
    object-fit: cover;
}

.my-profile-header h2 {
    font-size: 24px;
    font-weight: 700;
}

.profile-field {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: white;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.profile-field-label {
    color: var(--text-light);
    font-weight: 500;
}

.profile-field-value {
    font-weight: 600;
}

/* ==================== НАВИГАЦИЯ ==================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 8px 12px;
    transition: all 0.3s ease;
}

.nav-btn span {
    font-size: 12px;
    font-weight: 500;
}

.nav-btn.active {
    color: var(--primary-color);
}

.nav-btn svg {
    transition: transform 0.3s ease;
}

.nav-btn.active svg {
    transform: scale(1.1);
}

/* ==================== МОДАЛЬНЫЕ ОКНА ==================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

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

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ==================== ЧАТ ==================== */

.chat-modal {
    width: 100%;
    max-width: 600px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
}

.message.sent {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
}

.message.received {
    align-self: flex-start;
    background: #F0F0F0;
    color: var(--text-color);
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.message-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid var(--border-color);
    gap: 10px;
}

.message-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    font-size: 14px;
    outline: none;
}

.message-input input:focus {
    border-color: var(--primary-color);
}

.message-input button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.message-input button:hover {
    background: var(--primary-dark);
}

/* ==================== ФОРМЫ ==================== */

.edit-profile-form {
    padding: 30px;
    max-width: 500px;
    margin: 0 auto;
}

.edit-profile-form h2 {
    margin-bottom: 25px;
    text-align: center;
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
}

/* ==================== ПУСТЫЕ СОСТОЯНИЯ ==================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text-color);
}

.empty-state p {
    font-size: 14px;
}

/* ==================== АДАПТИВНОСТЬ ==================== */

@media (max-width: 768px) {
    .profiles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .welcome-content h1 {
        font-size: 28px;
    }

    .swipe-card-name {
        font-size: 20px;
    }

    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }
}

/* ==================== ВСПОМОГАТЕЛЬНЫЕ КЛАССЫ ==================== */

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ==================== TOAST УВЕДОМЛЕНИЯ ==================== */

.toast-notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #323232;
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10000;
    max-width: 80%;
    text-align: center;
}

.toast-notification.toast-success {
    background: #4CAF50;
}

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

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==================== КНОПКА УДАЛЕНИЯ ИЗ ИЗБРАННОГО ==================== */

.remove-favorite-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: #F44336;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 10;
}

.remove-favorite-btn:hover {
    background: #F44336;
    color: white;
    transform: scale(1.1);
}

.remove-favorite-btn:active {
    transform: scale(0.95);
}

.profile-card {
    position: relative;
}

/* ==================== МОДАЛЬНОЕ ОКНО ПРОФИЛЯ ==================== */

.profile-view-modal {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.profile-view {
    display: flex;
    flex-direction: column;
}

.profile-view-image {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 20px;
}

.profile-view-info h2 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-color);
}

.profile-view-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--text-light);
}

.profile-view-details div {
    font-size: 15px;
}

.profile-view-bio {
    background: var(--bg-color);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.profile-view-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-view-actions .btn {
    width: 100%;
}
