/* Мобильная оптимизация для Arendatyt */

/* Базовые мобильные стили */
@media (max-width: 768px) {
    /* Общие улучшения */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    input, textarea, select {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
    
    /* Улучшенная прокрутка */
    body {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }
    
    /* Заголовок */
    header {
        padding: 15px 20px;
        position: sticky;
        top: 0;
        z-index: 1000;
        backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.95);
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .logo {
        font-size: 1.5rem;
        text-align: center;
    }
    
    .header-nav {
        width: 100%;
        justify-content: center;
    }
    
    .nav-links {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .nav-link {
        padding: 12px 20px;
        text-align: center;
        border-radius: 8px;
        background: #f8f9fa;
        transition: all 0.3s ease;
    }
    
    .nav-link:hover {
        background: #e9ecef;
        transform: none;
    }
    
    /* Мобильное меню */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #2c3e50;
        cursor: pointer;
        padding: 10px;
    }
    
    .mobile-menu {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        height: 100vh;
        background: white;
        z-index: 1001;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        overflow-y: auto;
    }
    
    .mobile-menu.active {
        left: 0;
    }
    
    .mobile-menu-header {
        padding: 20px;
        border-bottom: 1px solid #e9ecef;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .mobile-menu-close {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #666;
        cursor: pointer;
    }
    
    .mobile-menu-content {
        padding: 20px;
    }
    
    .mobile-menu-links {
        list-style: none;
        padding: 0;
    }
    
    .mobile-menu-links li {
        margin-bottom: 15px;
    }
    
    .mobile-menu-links a {
        display: block;
        padding: 15px 20px;
        color: #2c3e50;
        text-decoration: none;
        border-radius: 8px;
        transition: all 0.3s ease;
        font-weight: 500;
    }
    
    .mobile-menu-links a:hover {
        background: #f8f9fa;
        color: #3498db;
    }
    
    /* Основной контент */
    .hero {
        padding: 40px 20px;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 2rem;
        margin-bottom: 15px;
        line-height: 1.3;
    }
    
    .hero p {
        font-size: 1rem;
        margin-bottom: 30px;
        line-height: 1.5;
    }
    
    /* Фильтры */
    .filters {
        padding: 20px;
        background: white;
        margin: 20px;
        border-radius: 15px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group label {
        font-size: 0.9rem;
        margin-bottom: 8px;
        display: block;
        font-weight: 600;
        color: #2c3e50;
    }
    
    .filter-group input,
    .filter-group select {
        width: 100%;
        padding: 12px 15px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        font-size: 16px;
        background: white;
    }
    
    .filter-group input:focus,
    .filter-group select:focus {
        outline: none;
        border-color: #3498db;
    }
    
    /* Переключатель Квартиры/Отели */
    .listing-type-toggle {
        display: flex;
        background: #f8f9fa;
        border-radius: 12px;
        padding: 4px;
        margin-bottom: 20px;
    }
    
    .listing-type-btn {
        flex: 1;
        padding: 12px 20px;
        border: none;
        background: transparent;
        color: #666;
        font-weight: 600;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 14px;
    }
    
    .listing-type-btn.active {
        background: #3498db;
        color: white;
        box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
    }
    
    /* Карточки объектов */
    .apartments-container {
        padding: 0 20px;
    }
    
    .apartment-card {
        margin-bottom: 20px;
        border-radius: 15px;
        overflow: hidden;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }
    
    .apartment-image {
        height: 200px;
        width: 100%;
        object-fit: cover;
    }
    
    .apartment-content {
        padding: 20px;
    }
    
    .apartment-title {
        font-size: 1.2rem;
        margin-bottom: 10px;
        line-height: 1.3;
    }
    
    .apartment-location {
        font-size: 0.9rem;
        color: #666;
        margin-bottom: 15px;
    }
    
    .apartment-features {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .feature-tag {
        background: #f8f9fa;
        color: #666;
        padding: 4px 8px;
        border-radius: 4px;
        font-size: 0.8rem;
        font-weight: 500;
    }
    
    .apartment-price {
        font-size: 1.5rem;
        font-weight: 700;
        color: #3498db;
        margin-bottom: 15px;
    }
    
    .apartment-actions {
        display: flex;
        gap: 10px;
    }
    
    .btn {
        flex: 1;
        padding: 12px 20px;
        border: none;
        border-radius: 8px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        text-decoration: none;
        text-align: center;
        font-size: 14px;
    }
    
    .btn-primary {
        background: linear-gradient(135deg, #3498db, #2980b9);
        color: white;
    }
    
    .btn-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
    }
    
    .btn-secondary {
        background: #95a5a6;
        color: white;
    }
    
    .btn-secondary:hover {
        background: #7f8c8d;
    }
    
    /* Кнопка "Показать еще" */
    .load-more {
        margin: 30px 20px;
        text-align: center;
    }
    
    .load-more-btn {
        padding: 15px 30px;
        background: linear-gradient(135deg, #3498db, #2980b9);
        color: white;
        border: none;
        border-radius: 25px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        font-size: 16px;
    }
    
    .load-more-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(52, 152, 219, 0.3);
    }
    
    /* Подвал */
    footer {
        padding: 40px 20px;
        text-align: center;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 30px;
    }
    
    .footer-section {
        width: 100%;
    }
    
    .footer-section h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .footer-links {
        list-style: none;
        padding: 0;
    }
    
    .footer-links li {
        margin-bottom: 8px;
    }
    
    .footer-links a {
        color: #666;
        text-decoration: none;
        transition: color 0.3s ease;
    }
    
    .footer-links a:hover {
        color: #3498db;
    }
    
    /* Модальные окна */
    .modal {
        padding: 20px;
    }
    
    .modal-content {
        width: 95%;
        max-width: 500px;
        margin: 20px auto;
        border-radius: 15px;
    }
    
    .modal-header {
        padding: 20px;
        border-bottom: 1px solid #e9ecef;
    }
    
    .modal-title {
        font-size: 1.3rem;
        font-weight: 600;
        color: #2c3e50;
    }
    
    .modal-close {
        position: absolute;
        top: 15px;
        right: 15px;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: #666;
        cursor: pointer;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 20px;
        border-top: 1px solid #e9ecef;
        display: flex;
        gap: 10px;
    }
    
    .modal-footer .btn {
        flex: 1;
    }
    
    /* Формы */
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: 600;
        color: #2c3e50;
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        padding: 12px 15px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        font-size: 16px;
        background: white;
        transition: border-color 0.3s ease;
    }
    
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: #3498db;
    }
    
    .form-group textarea {
        height: 100px;
        resize: vertical;
    }
    
    /* Уведомления */
    .notification {
        position: fixed;
        top: 20px;
        left: 20px;
        right: 20px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 8px 25px rgba(0,0,0,0.15);
        padding: 20px;
        z-index: 1000;
        transform: translateY(-100px);
        transition: transform 0.3s ease;
    }
    
    .notification.show {
        transform: translateY(0);
    }
    
    .notification-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
    }
    
    .notification-title {
        font-weight: 600;
        color: #2c3e50;
        font-size: 1.1rem;
    }
    
    .notification-close {
        background: none;
        border: none;
        font-size: 1.2rem;
        color: #666;
        cursor: pointer;
    }
    
    .notification-content {
        color: #666;
        line-height: 1.5;
    }
    
    /* Загрузка */
    .loading {
        text-align: center;
        padding: 40px 20px;
    }
    
    .loading-spinner {
        display: inline-block;
        width: 40px;
        height: 40px;
        border: 4px solid #f3f3f3;
        border-top: 4px solid #3498db;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    .loading-text {
        margin-top: 15px;
        color: #666;
        font-size: 1rem;
    }
    
    /* Пустое состояние */
    .empty-state {
        text-align: center;
        padding: 60px 20px;
        color: #666;
    }
    
    .empty-icon {
        font-size: 4rem;
        margin-bottom: 20px;
        opacity: 0.5;
    }
    
    .empty-title {
        font-size: 1.3rem;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 10px;
    }
    
    .empty-description {
        font-size: 1rem;
        line-height: 1.5;
    }
    
    /* Улучшения для очень маленьких экранов */
    @media (max-width: 480px) {
        .hero h1 {
            font-size: 1.8rem;
        }
        
        .apartment-card {
            margin: 0 10px 20px 10px;
        }
        
        .filters {
            margin: 20px 10px;
        }
        
        .apartments-container {
            padding: 0 10px;
        }
        
        .btn {
            padding: 10px 15px;
            font-size: 13px;
        }
        
        .apartment-price {
            font-size: 1.3rem;
        }
    }
    
    /* Ландшафтная ориентация */
    @media (max-width: 768px) and (orientation: landscape) {
        .hero {
            padding: 20px;
        }
        
        .hero h1 {
            font-size: 1.5rem;
        }
        
        .filters {
            padding: 15px;
        }
        
        .apartment-card {
            margin-bottom: 15px;
        }
    }
    
    /* Улучшения для iOS */
    @supports (-webkit-touch-callout: none) {
        .apartment-card {
            -webkit-transform: translateZ(0);
            transform: translateZ(0);
        }
        
        .btn {
            -webkit-appearance: none;
            appearance: none;
        }
        
        input, select, textarea {
            -webkit-appearance: none;
            appearance: none;
        }
    }
    
    /* Улучшения для Android */
    @media screen and (-webkit-min-device-pixel-ratio: 0) {
        .apartment-card {
            will-change: transform;
        }
        
        .btn:hover {
            transform: none;
        }
    }
}

/* Дополнительные мобильные улучшения */
@media (max-width: 1024px) {
    .apartments-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
}

/* Оптимизация для планшетов */
@media (min-width: 769px) and (max-width: 1024px) {
    .apartments-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
    
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Улучшения производительности */
.apartment-card {
    contain: layout style paint;
}

.apartment-image {
    will-change: transform;
}

.btn {
    will-change: transform;
}

/* Улучшения доступности */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Темная тема для мобильных */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    body {
        background: #1a1a1a;
        color: #e0e0e0;
    }
    
    .apartment-card {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .filters {
        background: #2d2d2d;
        color: #e0e0e0;
    }
    
    .filter-group input,
    .filter-group select {
        background: #3d3d3d;
        border-color: #4d4d4d;
        color: #e0e0e0;
    }
    
    .btn-primary {
        background: linear-gradient(135deg, #4a9eff, #3d8bff);
    }
}
