/**
 * Mobile Optimization for Hotel Website
 * Улучшенная адаптация для мобильных устройств
 */

/* ============================================
   GENERAL MOBILE OPTIMIZATIONS
   ============================================ */

/* Улучшение тач-скроллинга */
* {
    -webkit-tap-highlight-color: rgba(212, 175, 55, 0.2);
    -webkit-touch-callout: none;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Оптимизация изображений */
img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   IMPROVED MOBILE NAVIGATION
   ============================================ */

/* Hamburger Menu - Modern Design */
.hamburger {
    display: none; /* Hidden by default on desktop */
    position: relative;
    width: 30px;
    height: 24px;
    cursor: pointer;
    z-index: 1001;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-direction: column;
    justify-content: space-between;
}

.hamburger:hover {
    transform: scale(1.1);
}

.hamburger span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--text-dark);
    border-radius: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger span:nth-child(1) {
    top: 0;
}

.hamburger span:nth-child(2) {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger span:nth-child(3) {
    bottom: 0;
}

/* Hamburger Active State - Smooth X Animation */
.hamburger.active span:nth-child(1) {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.hamburger.active span:nth-child(3) {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* Mobile Menu Overlay - Enhanced */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    opacity: 0;
    visibility: hidden;
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-overlay.active {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when menu is open */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Mobile Navigation Menu - Improved */
@media (max-width: 768px) {
    /* Show hamburger menu on mobile */
    .hamburger {
        display: flex !important;
    }
    
    .nav-menu {
        position: fixed !important;
        top: var(--navbar-height, 70px) !important;
        right: -100% !important;
        left: auto !important;
        width: 85% !important;
        max-width: 360px !important;
        height: calc(100vh - var(--navbar-height, 70px)) !important;
        background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%) !important;
        box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15) !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        padding: 30px 0 !important;
        gap: 0 !important;
        overflow-y: auto !important;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 1000 !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-menu.active {
        right: 0 !important;
        left: auto !important;
    }
    
    /* Navigation Items - Enhanced */
    .nav-item {
        width: 100%;
        opacity: 0;
        transform: translateX(50px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .nav-menu.active .nav-item {
        opacity: 1;
        transform: translateX(0);
    }
    
    /* Staggered animation for menu items */
    .nav-menu.active .nav-item:nth-child(1) { transition-delay: 0.05s; }
    .nav-menu.active .nav-item:nth-child(2) { transition-delay: 0.10s; }
    .nav-menu.active .nav-item:nth-child(3) { transition-delay: 0.15s; }
    .nav-menu.active .nav-item:nth-child(4) { transition-delay: 0.20s; }
    .nav-menu.active .nav-item:nth-child(5) { transition-delay: 0.25s; }
    .nav-menu.active .nav-item:nth-child(6) { transition-delay: 0.30s; }
    .nav-menu.active .nav-item:nth-child(7) { transition-delay: 0.35s; }
    .nav-menu.active .nav-item:nth-child(8) { transition-delay: 0.40s; }
    
    /* Navigation Links - Modern Design */
    .nav-link {
        position: relative;
        display: flex !important;
        align-items: center !important;
        gap: 15px;
        padding: 18px 30px !important;
        font-size: 1.1rem !important;
        font-weight: 500;
        color: var(--text-dark) !important;
        text-decoration: none !important;
        transition: all 0.3s ease;
        border-left: 4px solid transparent;
    }
    
    .nav-link::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 0;
        height: 100%;
        background: linear-gradient(90deg, rgba(212, 175, 55, 0.1) 0%, transparent 100%);
        transition: width 0.3s ease;
        z-index: -1;
    }
    
    .nav-link:hover::before,
    .nav-link.active::before {
        width: 100%;
    }
    
    .nav-link:hover {
        color: var(--accent-gold);
        padding-left: 35px;
    }
    
    .nav-link.active {
        color: var(--accent-gold);
        border-left-color: var(--accent-gold);
        background: rgba(212, 175, 55, 0.08);
    }
    
    /* Add icons to menu items */
    .nav-link::after {
        content: attr(data-icon);
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        margin-left: auto;
        font-size: 1rem;
        opacity: 0.5;
        transition: all 0.3s ease;
    }
    
    .nav-link:hover::after {
        opacity: 1;
        transform: translateX(5px);
    }
    
    /* Language Selector in Mobile Menu */
    .language-selector-mobile {
        padding: 20px 30px;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        margin-top: auto;
    }
    
    .language-selector-mobile .language-title {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text-light);
        text-transform: uppercase;
        letter-spacing: 1px;
        margin-bottom: 12px;
    }
    
    .language-options {
        display: flex;
        gap: 10px;
    }
    
    .language-option {
        flex: 1;
        padding: 10px;
        text-align: center;
        border: 2px solid rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.3s ease;
        font-weight: 500;
        background: white;
    }
    
    .language-option:hover {
        border-color: var(--accent-gold);
        background: rgba(212, 175, 55, 0.05);
    }
    
    .language-option.active {
        border-color: var(--accent-gold);
        background: var(--accent-gold);
        color: white;
    }
    
    /* Booking CTA in Mobile Menu */
    .mobile-menu-cta {
        padding: 20px 30px;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .mobile-book-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 16px;
        background: linear-gradient(135deg, var(--accent-gold) 0%, #c9a84a 100%);
        color: white;
        border: none;
        border-radius: 12px;
        font-size: 1.1rem;
        font-weight: 600;
        text-decoration: none;
        box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
        transition: all 0.3s ease;
    }
    
    .mobile-book-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
    }
    
    .mobile-book-btn i {
        font-size: 1.2rem;
    }
    
    /* Show mobile icons only on mobile */
    .mobile-icon {
        display: inline-block;
        font-size: 1.2rem;
        margin-right: 12px;
        color: var(--accent-gold);
        opacity: 0.8;
        transition: opacity 0.3s ease;
    }
    
    .nav-link:hover .mobile-icon {
        opacity: 1;
    }
    
    /* Update nav-link structure for mobile */
    .nav-link span {
        flex: 1;
    }
}

/* Hide mobile-only elements on desktop */
@media (min-width: 769px) {
    .mobile-menu-cta,
    .language-selector-mobile {
        display: none !important;
    }
    
    .mobile-icon {
        display: none;
    }
    
    /* Reset nav-link for desktop */
    .nav-link {
        display: inline-block;
    }
}

/* ============================================
   TABLETS (max-width: 1024px)
   ============================================ */

@media (max-width: 1024px) {
    /* Container */
    .container {
        padding: 0 30px;
    }
    
    /* Hero секция */
    .hero {
        height: 60vh;
        min-height: 500px;
    }
    
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    /* Booking форма */
    .booking-bar {
        flex-direction: column;
        gap: 15px;
        padding: 30px;
    }
    
    .booking-input {
        width: 100%;
    }
    
    /* Grid layouts */
    .features-grid,
    .services-grid,
    .rooms-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* ============================================
   MOBILE LANDSCAPE (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    /* Typography */
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.25rem;
    }
    
    /* Container */
    .container {
        padding: 0 20px;
    }
    
    /* Header/Navigation */
    .header {
        padding: 15px 0;
    }
    
    .logo-main {
        font-size: 1.25rem;
    }
    
    .logo-sub {
        font-size: 0.7rem;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: white;
        flex-direction: column;
        padding: 80px 30px 30px;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-menu li {
        margin: 0 0 20px 0;
        width: 100%;
    }
    
    .nav-menu a {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    
    /* Mobile menu toggle */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--text-dark);
        cursor: pointer;
        padding: 10px;
        z-index: 1001;
    }
    
    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .mobile-menu-overlay.active {
        display: block;
    }
    
    /* Hero */
    .hero {
        height: 50vh;
        min-height: 400px;
    }
    
    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    /* Booking bar */
    .booking-bar {
        padding: 20px;
        gap: 12px;
    }
    
    /* Stats */
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    /* Rooms */
    .rooms-grid {
        grid-template-columns: 1fr;
    }
    
    .room-card {
        margin-bottom: 20px;
    }
    
    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }
    
    .footer {
        padding: 50px 0 0;
    }
    
    /* Buttons */
    .btn,
    .cta-button {
        width: 100%;
        text-align: center;
        padding: 14px 20px;
    }
    
    /* Section spacing */
    .section {
        padding: 50px 0;
    }
}

/* ============================================
   MOBILE PORTRAIT (max-width: 480px)
   ============================================ */

@media (max-width: 480px) {
    /* Typography */
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    h3 {
        font-size: 1.125rem;
    }
    
    p {
        font-size: 0.95rem;
    }
    
    /* Container */
    .container {
        padding: 0 15px;
    }
    
    /* Hero */
    .hero {
        height: 70vh;
        min-height: 450px;
    }
    
    .hero-content {
        padding: 20px;
    }
    
    .hero-content h1 {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 0.95rem;
    }
    
    /* Booking bar */
    .booking-bar {
        padding: 15px;
    }
    
    .booking-input label {
        font-size: 0.85rem;
    }
    
    .booking-input input,
    .booking-input select {
        font-size: 0.95rem;
        padding: 10px;
    }
    
    /* Stats */
    .stats-container {
        grid-template-columns: 1fr;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    /* Cards */
    .feature-card,
    .service-card,
    .room-card {
        padding: 20px;
    }
    
    /* Images */
    .room-image,
    .service-image {
        height: 200px;
    }
    
    /* Language switcher */
    .language-switcher {
        position: relative;
    }
    
    /* Section headers */
    .section-header {
        padding: 0 15px;
        margin-bottom: 30px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 0.95rem;
    }
    
    /* Amenities */
    .amenity-tag {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    /* Price */
    .price {
        font-size: 1.5rem;
    }
    
    /* Footer */
    .footer-section h4 {
        font-size: 1.125rem;
        margin-bottom: 15px;
    }
    
    .contact-item {
        font-size: 0.9rem;
    }
    
    /* Modal на мобильном */
    .modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 20px;
    }
}

/* ============================================
   EXTRA SMALL MOBILE (max-width: 360px)
   ============================================ */

@media (max-width: 360px) {
    /* Typography */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.35rem;
    }
    
    /* Hero */
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    /* Buttons */
    .btn {
        font-size: 0.9rem;
        padding: 12px 18px;
    }
    
    /* Stats */
    .stat-number {
        font-size: 1.75rem;
    }
    
    .stat-label {
        font-size: 0.85rem;
    }
}

/* ============================================
   TOUCH OPTIMIZATIONS
   ============================================ */

/* Увеличенные тач-таргеты */
@media (hover: none) and (pointer: coarse) {
    a, button, input[type="submit"], .clickable {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-menu a {
        padding: 15px 0;
    }
    
    /* Убираем hover эффекты на touch устройствах */
    .feature-card:hover,
    .service-card:hover,
    .room-card:hover {
        transform: none;
    }
}

/* ============================================
   LANDSCAPE ORIENTATION
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        height: 100vh;
    }
    
    .hero-content {
        padding: 20px;
    }
    
    .booking-bar {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .booking-input {
        flex: 1;
        min-width: 150px;
    }
}

/* ============================================
   iOS SPECIFIC FIXES
   ============================================ */

/* Фикс для Safari на iOS */
@supports (-webkit-touch-callout: none) {
    .hero {
        min-height: -webkit-fill-available;
    }
    
    input, select, textarea {
        font-size: 16px !important; /* Предотвращает zoom при фокусе */
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    /* Отключаем сложные анимации на мобильных */
    .animate-on-scroll {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    
    /* Упрощаем тени */
    .card, .room-card, .service-card {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* Убираем backdrop-filter на мобильных (производительность) */
    .booking-bar {
        backdrop-filter: none;
        background: rgba(255, 255, 255, 0.98);
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   BOOKING PAGES MOBILE OPTIMIZATION
   ============================================ */

/* Booking Form Page */
@media (max-width: 768px) {
    .booking-form-wrapper {
        padding: 30px 20px;
        margin: 0 15px;
    }
    
    .booking-form-header h2 {
        font-size: 1.75rem;
    }
    
    .booking-form-header p {
        font-size: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-group input,
    .form-group select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Special Offers Grid */
    .offers-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .offer-card {
        padding: 25px 20px;
    }
    
    /* Contact Grid */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .contact-item {
        padding: 25px;
    }
}

/* Booking Confirmation Page */
@media (max-width: 1024px) {
    .booking-wrapper {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .booking-form {
        position: static;
    }
}

@media (max-width: 768px) {
    .booking-details,
    .booking-form {
        padding: 25px 20px;
    }
    
    .booking-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .booking-header h2 {
        font-size: 1.5rem;
    }
    
    .special-offer-badge {
        font-size: 0.85rem;
        padding: 6px 14px;
    }
    
    .detail-section h3 {
        font-size: 1.15rem;
    }
    
    /* Room Card */
    .room-card {
        flex-direction: column;
    }
    
    .room-image {
        width: 100%;
        height: 200px;
    }
    
    .room-info h4 {
        font-size: 1.1rem;
    }
    
    .room-info p {
        font-size: 0.85rem;
    }
    
    /* Stay Grid */
    .stay-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stay-item {
        padding: 15px;
    }
    
    .stay-item i {
        font-size: 1rem;
    }
    
    .stay-item label {
        font-size: 0.75rem;
    }
    
    .stay-item span {
        font-size: 0.95rem;
    }
    
    /* Contact Form */
    .contact-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .form-group.full-width {
        grid-column: span 1;
    }
    
    .form-group label {
        font-size: 0.85rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    .form-actions {
        grid-column: span 1;
        flex-direction: column;
        gap: 12px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    /* Price Breakdown */
    .price-breakdown {
        padding: 20px;
    }
    
    .price-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        font-size: 0.9rem;
    }
    
    .price-item.total {
        font-size: 1rem;
    }
    
    .total-price {
        font-size: 1.3rem;
    }
    
    /* Policies Grid */
    .policies-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }
    
    .policy-item {
        padding: 25px 20px;
    }
    
    .policy-icon {
        width: 50px;
        height: 50px;
    }
    
    .policy-icon i {
        font-size: 1.1rem;
    }
    
    .policy-item h4 {
        font-size: 1.1rem;
    }
    
    .policy-item p {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .booking-hero {
        padding: 100px 0 60px;
    }
    
    .booking-confirm-hero {
        padding: 100px 0 60px;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .page-subtitle {
        font-size: 0.9rem;
    }
    
    .booking-form-wrapper {
        padding: 20px 15px;
        margin: 0 10px;
    }
    
    .booking-form-header h2 {
        font-size: 1.5rem;
    }
    
    .booking-details,
    .booking-form {
        padding: 20px 15px;
    }
    
    .detail-section {
        margin-bottom: 30px;
    }
    
    .amenity-tag {
        font-size: 0.7rem;
        padding: 3px 7px;
    }
    
    .room-amenities {
        gap: 4px;
    }
    
    .checkbox-label {
        font-size: 0.85rem;
    }
    
    .checkmark {
        width: 16px;
        height: 16px;
    }
}

