/* -----------------------
   Переменные и базовые стили
------------------------ */
:root {
    --primary-orange: #FF9800;
    --primary-orange-hover: #ffa733;
    --text-white: #ffffff;
    --text-dark: #333333;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-light: rgba(255, 255, 255, 0.3);
    --shadow-dark: rgba(0, 0, 0, 0.2);
    
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --border-radius: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* -----------------------
   Основные стили
------------------------ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    font-family: var(--font-family);
    overflow-x: hidden;
    background-color: #000000; /* Set background for the whole page */
}

body {
    color: var(--text-white);
    position: relative;
    font-family: var(--font-family);
    overflow-x: hidden;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    padding-bottom: env(safe-area-inset-bottom); /* Only add padding to the bottom */
    
    /* Apply background to body and make it fixed */
    background: #000000 url('../back.png') center/cover no-repeat fixed;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

body::after {
    content: none;
}
  
/* -----------------------
   Контейнер и макет
------------------------ */
.container {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    padding-top: env(safe-area-inset-top); /* Keep top padding for container */
    max-width: 100%;
}

/* -----------------------
   Главная страница - Index
------------------------ */
.main-header {
    text-align: center;
    margin-bottom: 40px;
    margin-top: 60px;
}

.main-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    margin-bottom: 20px;
}

.instruction-text {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 40px;
    opacity: 0.9;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    line-height: 1.5;
}

/* -----------------------
   Кнопки комнат - Liquid Glass
------------------------ */
.room-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    margin: 0 auto 30px auto;
}

.room-button {
    width: 280px;
    padding: 20px 40px;
    font-size: 1.6rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-white);
    text-align: center;
    border-radius: var(--border-radius);
    
    /* Liquid Glass эффект */
    background: linear-gradient(145deg, 
        rgba(255, 152, 0, 0.3),
        rgba(255, 152, 0, 0.1));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 152, 0, 0.3);
    box-shadow: 
        0 4px 32px rgba(255, 152, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.room-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.2), 
        transparent);
    transition: left 0.5s;
}

.room-button:hover::before {
    left: 100%;
}

.room-button:hover {
    transform: translateY(-2px);
    background: linear-gradient(145deg, 
        rgba(255, 152, 0, 0.4),
        rgba(255, 152, 0, 0.2));
    box-shadow: 
        0 8px 40px rgba(255, 152, 0, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.5),
        inset 0 -2px 0 rgba(0, 0, 0, 0.2);
}

.room-button:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 20px rgba(255, 152, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
}

/* -----------------------
   Футер главной страницы
------------------------ */
.main-footer {
    margin-top: 30px;
    width: 100%;
    max-width: 500px;
    text-align: center;
}

/* PWA секция */
.pwa-section {
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.pwa-instruction {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.pwa-icons-row {
    display: flex;
    gap: 30px;
    align-items: center;
}

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

.step-number {
    width: 24px;
    height: 24px;
    background: var(--primary-orange);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.pwa-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.pwa-text {
    font-size: 0.9rem;
    opacity: 0.9;
    text-align: center;
    line-height: 1.4;
}

/* Install Button */
.install-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(145deg, var(--primary-orange), var(--primary-orange-hover));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 10px;
}

.install-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255, 152, 0, 0.4);
}

.install-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
}

/* Telegram секция */
.telegram-section {
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.telegram-icon {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.telegram-text {
    font-size: 0.9rem;
    opacity: 0.9;
    text-align: center;
    line-height: 1.4;
}

.telegram-button {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(145deg, #0088cc, #006aa3);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.telegram-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(0, 136, 204, 0.4);
    background: linear-gradient(145deg, #0099dd, #0077bb);
}

/* Copyright */
.copyright {
    opacity: 0.7;
    font-size: 0.8rem;
    text-align: center;
}

/* -----------------------
   Страницы комнат - Room Pages
------------------------ */
.room-page {
    padding: 0;
    overflow: hidden;
    height: 100vh; /* Фиксируем высоту для предсказуемого поведения */
}

/* Кнопка "Назад" */
.home-button {
    position: fixed;
    top: 15px; /* Скорректировал позицию, чтобы не было наложений */
    left: 15px;
    width: 44px;
    height: 44px;
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.15),
        rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(25px); /* Синхронизировал блюр с хедером */
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 1002;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.home-button::before {
    content: ''; /* Убрали текстовый символ */
    display: block;
    width: 22px; /* Размер иконки */
    height: 22px;
    /* Встроили SVG-иконку для кросс-платформенной консистентности */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H5M12 19l-7-7 7-7'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.home-button:hover {
    transform: scale(1.05);
}

/* Заголовок комнаты */
.room-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(145deg, 
        rgba(30, 30, 30, 0.2),
        rgba(30, 30, 30, 0.1));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
    z-index: 1001;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.room-header .header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.room-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    text-align: center;
}

/* Переключатель режимов */
.mode-switcher {
    display: flex;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    width: 100%;
    max-width: 350px;
}

.mode-btn {
    flex: 1;
    padding: 12px 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.mode-btn.active {
    background: linear-gradient(145deg, var(--primary-orange), var(--primary-orange-hover));
    color: var(--text-white);
    box-shadow: 0 2px 10px rgba(255, 152, 0, 0.3);
}

.mode-btn:not(.active):hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.1);
}

/* Контент комнаты */
.room-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.content-section {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 150px 15px 100px 15px; /* Отступы для хедера и футера */
}

.content-section.active {
    opacity: 1;
    visibility: visible;
}

/* Инструкции для бронирования */
.booking-instruction {
    background: linear-gradient(145deg, 
        rgba(255, 152, 0, 0.2),
        rgba(255, 152, 0, 0.1));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    flex-shrink: 0; /* Предотвращаем сжатие */
}

.booking-instruction p {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.4;
    margin: 0;
}

/* Скроллбары */
.content-section::-webkit-scrollbar {
    width: 6px;
}

.content-section::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.content-section::-webkit-scrollbar-thumb {
    background: rgba(255, 152, 0, 0.6);
    border-radius: 3px;
}

/* Iframe Wrapper & Iframe */
.iframe-wrapper {
    flex: 1 1 auto; /* Позволяем расти и сжиматься */
    min-height: 500px; /* Минимальная высота для формы */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.content-section iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex-grow: 1;
}

/* Специально для Яндекс Формы - авто-высота */
.content-section#booking-section .iframe-wrapper {
    /* Высота будет управляться скриптом embed.js. */
    /* Убираем фиксированную высоту, позволяем контейнеру расти. */
    height: auto;
    min-height: unset;
    flex-shrink: 0; /* Не сжиматься */
}

.content-section#booking-section iframe.yandex-form-iframe {
    /* Скрипт embed.js установит высоту. */
    /* Убираем height: 100% чтобы не ограничивать его. */
    height: auto; 
    min-height: 800px; /* Начальная высота, пока скрипт не отработал. */
    overflow: hidden !important;
}

/* Календарь Google */
.content-section#calendar-section .iframe-wrapper {
    height: 100%;
    min-height: 900px; /* Увеличил высоту в 1.5 раза */
}

/* Дополнительная информация */
.info-text {
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-top: 0; /* Убрали лишний отступ */
    flex-shrink: 0;
}

.info-text p {
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.9;
}

.info-text p:last-child {
    margin-bottom: 0;
}

.info-text a {
    color: var(--primary-orange);
    text-decoration: none;
    font-weight: 600;
}

.info-text a:hover {
    text-decoration: underline;
}

/* Стили для ссылки на инструкцию в блоке copy-link-section */
.copy-link-section a {
    color: var(--primary-orange);
    text-decoration: none;
    font-weight: 600;
}

.copy-link-section a:hover {
    text-decoration: underline;
}

/* Секция копирования ссылки */
.copy-link-section {
    background: linear-gradient(145deg, 
        rgba(255, 255, 255, 0.1),
        rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    flex-shrink: 0;
}

.copy-link-section p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.9;
}

.calendar-link {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    word-break: break-all;
    margin: 15px 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.copy-button {
    background: linear-gradient(135deg, var(--primary-orange), var(--primary-orange-hover));
    color: var(--text-white);
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.copy-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(255, 152, 0, 0.4);
}

/* Нижний тулбар */
.bottom-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(145deg, 
        rgba(30, 30, 30, 0.2),
        rgba(30, 30, 30, 0.1));
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    z-index: 1001;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.toolbar-content {
    display: flex;
    justify-content: center;
    gap: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.toolbar-room-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.7);
    transition: var(--transition);
    padding: 8px 12px;
    border-radius: 12px;
    min-width: 60px;
    -webkit-tap-highlight-color: transparent;
}

.toolbar-room-btn.active {
    color: var(--primary-orange);
    background: rgba(255, 152, 0, 0.1);
}

.toolbar-room-btn:hover:not(.active) {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.1);
}

.toolbar-room-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(145deg, 
        rgba(255, 152, 0, 0.3),
        rgba(255, 152, 0, 0.1));
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 4px;
    transition: var(--transition);
}

.toolbar-room-btn.active .toolbar-room-icon {
    background: linear-gradient(145deg, var(--primary-orange), var(--primary-orange-hover));
    color: white;
    box-shadow: 0 2px 10px rgba(255, 152, 0, 0.3);
}

.toolbar-room-label {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.9;
}

/* Анимация сворачивания при скролле */
body.scrolling-down .room-header {
    transform: translateY(-100%);
}

body.scrolling-down .bottom-toolbar {
    transform: translateY(100%);
}

body.scrolling-down .home-button {
    transform: translateX(-120%);
    opacity: 0;
}

/* -----------------------
   Адаптивные стили
------------------------ */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .main-header {
        margin-top: 40px;
        margin-bottom: 30px;
    }
    
    .main-header h1 {
        font-size: 1.8rem;
    }
    
    .room-button {
        width: 100%;
        max-width: 300px;
        font-size: 1.4rem;
        padding: 18px 28px;
    }
    
    .room-header h1 {
        font-size: 1.6rem;
    }
    
    .content-section {
        padding: 140px 10px 90px 10px;
    }

    .mode-btn {
        font-size: 0.9rem;
        padding: 10px 5px;
    }

    .toolbar-room-btn {
        padding: 8px;
        min-width: 50px;
    }

    .toolbar-room-icon {
        width: 30px;
        height: 30px;
    }

    .toolbar-room-label {
        font-size: 0.65rem;
    }
}

@media (max-width: 360px) {
    .main-header h1 {
        font-size: 1.6rem;
    }

    .room-header h1 {
        font-size: 1.4rem;
    }
    
    .mode-switcher {
        max-width: 100%;
    }
    
    .mode-btn {
        font-size: 0.8rem;
        padding: 10px 5px;
    }
}

/* -----------------------
   Общие мобильные оптимизации
------------------------ */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain; /* Предотвращает скролл "за пределы" body на мобильных */
}

/* Отключение подсветки при касании */
button, a, div {
    -webkit-tap-highlight-color: transparent;
}

