/* ==========================================================================
   ROERICH PEAK ARCHITECTURE - CORE CSS
   Version: 2.0.0
   ========================================================================== */

/* --- 1. DESIGN TOKENS & FONTS --- */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 200 800; font-display: swap; src: url('/static/fonts/Manrope-VariableFont_wght.ttf') format('truetype'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 300 700; font-display: swap; src: url('/static/fonts/CormorantGaramond-VariableFont_wght.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/static/fonts/Inter-VariableFont_opsz,wght.ttf') format('truetype'); }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 400 900; font-display: swap; src: url('/static/fonts/PlayfairDisplay-VariableFont_wght.ttf') format('truetype'); }

:root {
  /* Palette */
  --color-roerich-ultramarine: #005088;
  --color-mystic-violet: #BC84EE;
  --color-fiery-orange: #FF823A;
  --color-mountain-paper: #F3F0DF;
  --color-snow-summit: #FFFFFF;
  --color-abyss-ink: #0A1128;
  --color-cinnabar-red: #C83737;

  /* Typography */
  --font-majestic: 'Playfair Display', 'Cormorant Garamond', serif;
  --font-utility: 'Inter', 'Manrope', sans-serif;
  --text-h1-epic: clamp(2rem, 5vw + 1rem, 4.5rem);
  --text-h2-epic: clamp(1.8rem, 3vw + 1rem, 2.5rem);
  --text-p-readable: clamp(0.7rem, 1.5vw + 0.4rem, 1.125rem);

  /* Elevation & Geometry */
  --elevation-layer-1: 0 4px 12px -2px rgba(0, 80, 136, 0.08), 0 2px 4px -2px rgba(0, 80, 136, 0.04);
  --elevation-layer-2: 0 10px 24px -4px rgba(0, 80, 136, 0.12), 0 4px 10px -4px rgba(0, 80, 136, 0.06);
  --elevation-layer-3: 0 20px 40px -8px rgba(0, 80, 136, 0.18), 0 10px 16px -8px rgba(0, 80, 136, 0.08);
  --elevation-layer-4: 0 30px 60px -12px rgba(188, 132, 238, 0.25), 0 0 20px 0 rgba(255, 130, 58, 0.15);
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --touch-target-min: 48px;
}

/* --- 2. BASE RESET & TYPOGRAPHY --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: var(--color-mountain-paper); color: var(--color-abyss-ink); font-family: var(--font-utility); font-size: var(--text-p-readable); font-weight: 500; line-height: 1.6; overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
input, textarea, [contenteditable="true"] { -webkit-user-select: auto; user-select: auto; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-majestic); color: var(--color-roerich-ultramarine); font-weight: 700; margin-bottom: 1rem; }
h1 { font-size: var(--text-h1-epic); }
p { color: var(--color-abyss-ink); }
.svg-icon { width: 1.2em; height: 1.2em; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* --- 3. LAYOUT ARCHITECTURE --- */
.main-wrapper { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 2rem; position: relative; z-index: 10; }
.plane-back { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -10; background-color: var(--color-mountain-paper); }
.plane-middle { position: relative; z-index: 10; padding: 1rem; }
.plane-front { position: relative; z-index: 50; }
.overlapping-block { margin-top: -4rem; position: relative; z-index: 20; }
.asymmetric-tiered { display: grid; grid-template-columns: repeat(12, 1fr); align-items: start; gap: 2rem; }
.asymmetric-tiered > *:nth-child(odd) { grid-column: span 7; }
.asymmetric-tiered > *:nth-child(even) { grid-column: span 5; margin-top: 4rem; }


/* --- 4. GLOBAL COMPONENTS --- */

/* --- Карточки списков (Отряды, Комнаты) --- */
.expedition-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ✅ ОБНОВЛЕННАЯ АДАПТИВНАЯ ВЕРСИЯ */
.expedition-row {
    background: var(--color-snow-summit);
    border-radius: var(--radius-md);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--elevation-layer-1);
    transition: transform 0.2s, box-shadow 0.2s, border-left 0.2s;
    border-left: 4px solid transparent;
    flex-wrap: nowrap;
    min-width: 0; /* 👈 Защита от вылезания контейнера за пределы экрана */
}

/* Название (левый блок) */
.expedition-row > div:first-child {
    flex: 1 1 auto;
    min-width: 0; /* 👈 Позволяет тексту сжиматься внутри flex-контейнера */
    word-break: break-word; /* 👈 Переносит длинные названия на новую строку вместо выталкивания даты */
    overflow-wrap: anywhere;
}

/* Дата / Кнопки (правый блок) */
.expedition-row > div:last-child {
    flex: 0 0 auto;
    flex-shrink: 0; /* 👈 Запрещает сжатие правого блока */
}

@media (hover: hover) {
.expedition-row:hover {
    transform: translateX(8px);
    box-shadow: var(--elevation-layer-2);
    border-left: 4px solid var(--color-fiery-orange);
}
}
/* Защита левой части (названия) от выдавливания правой */
.roerich-pill {
    white-space: nowrap; /* Гарантируем, что текст в плашке не сломается */
}

.camp-card { background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(243, 240, 223, 0.6)); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, 0.8); border-radius: var(--radius-lg); box-shadow: var(--elevation-layer-3); padding: 2rem; transition: transform 0.3s ease, box-shadow 0.3s ease; text-decoration: none;}
@media (hover: hover) {
    .camp-card:hover { box-shadow: var(--elevation-layer-4); transform: translateY(-4px); }
}
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--touch-target-min); padding: 0 2rem; font-family: var(--font-utility); font-weight: 800; border-radius: 50px; border: none; cursor: pointer; transition: all 0.2s ease; text-decoration: none; }
.btn-primary { background-color: var(--color-fiery-orange); color: var(--color-snow-summit); box-shadow: 0 0 15px rgba(255, 130, 58, 0.2); }
.btn-primary:hover { background-color: #E66A20; box-shadow: 0 0 20px rgba(255, 130, 58, 0.4); transform: translateY(-2px); }
.btn-secondary { background-color: var(--color-mystic-violet); color: #1A1A24; }
.btn-secondary:hover { background-color: #A36CD8; box-shadow: var(--elevation-layer-2); }

.input-field { width: 100%; min-height: var(--touch-target-min); background: rgba(0, 80, 136, 0.05); border: none; border-bottom: 2px solid var(--color-roerich-ultramarine); border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 1rem; font-family: var(--font-utility); font-size: 1rem; color: var(--color-abyss-ink); transition: all 0.2s ease; }
.input-field:focus { outline: none; background: var(--color-snow-summit); border-bottom-color: var(--color-fiery-orange); box-shadow: var(--elevation-layer-2); }

.roerich-pill { display: inline-flex; align-items: center; gap: 0.5rem; background: rgba(0, 80, 136, 0.06); color: var(--color-roerich-ultramarine); padding: 0.4rem 1.2rem; border-radius: 50px; font-size: 0.85rem; font-weight: 800; font-family: var(--font-utility); transition: background 0.2s ease; }

/* Tabs */
.roerich-tabs { display: inline-flex; background: rgba(0, 80, 136, 0.05); padding: 0.25rem; border-radius: 50px; gap: 0.25rem; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); }
.roerich-tab { background: transparent; border: none; cursor: pointer; font-size: 1rem; outline: none; -webkit-appearance: none; padding: 0.5rem 1.5rem; border-radius: 50px; font-weight: 800; font-family: var(--font-utility); color: var(--color-abyss-ink); text-decoration: none; transition: all 0.2s ease; opacity: 0.6; }
.roerich-tab:hover { opacity: 1; }
.roerich-tab.active { background: var(--color-snow-summit); color: var(--color-roerich-ultramarine); opacity: 1; box-shadow: var(--elevation-layer-1); }

/* Modals */
.roerich-modal-backdrop { position: fixed; inset: 0; background: rgba(10, 17, 40, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; padding: 1rem; }
.roerich-modal-backdrop.active { opacity: 1; pointer-events: all; }
.roerich-modal-content { width: 100%; max-width: 600px; max-height: 90vh; overflow-y: auto; transform: translateY(20px) scale(0.95); transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1); padding: 2.5rem; background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(243, 240, 223, 0.85)); border: 1px solid rgba(255, 255, 255, 0.8); border-radius: var(--radius-lg); box-shadow: var(--elevation-layer-4); }
.roerich-modal-backdrop.active .roerich-modal-content { transform: translateY(0) scale(1); }


/* Responsive adjustments for core grids */
@media (max-width: 992px) {
    .main-wrapper { padding: 0 1rem; padding-bottom: 6rem; }
    .asymmetric-tiered { display: flex; flex-direction: column; gap: 1.5rem; align-items: stretch; }
    .asymmetric-tiered > *:nth-child(even) { margin-top: 0; }

    .roerich-modal-content { padding: 1.5rem; }
    button, a, .input-field { min-height: var(--touch-target-min); }
    .btn {

        /* Слегка ужимаем внутренние отступы, чтобы кнопка не казалась громоздкой */
        padding: 0.6rem 1rem;

        /* Если текст все-таки переносится, делаем строки более плотными */
        line-height: 1.25 !important;
    }

    /* Точечная магия для длинных кнопок (как "Главная страница экспедиции" в меню) */
    .btn {
        /* Размер шрифта будет плавно меняться в зависимости от ширины экрана */
        font-size: clamp(0.75rem, 3vw, 0.9rem) !important;
    }
}

.form-group {
margin-top: 1rem;
}
textarea.input-field {
    resize: none;
}
/* Корректировка базового инпута под тип file */
.input-field[type="file"] {
    padding: 0.5rem 0.75rem; /* Аккуратный внутренний отступ для рамки */
    display: flex;
    align-items: center;
    line-height: 1.5;
    height: auto;
    cursor: pointer;
}

/* Стилизация кнопки "Выбрать файл" внутри инпута (Современный стандарт) */
.input-field[type="file"]::file-selector-button {
    background: var(--color-roerich-ultramarine);
    color: #ffffff;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 1.5rem; /* Округлые кнопки в стиле фильтров Рериха */
    font-family: var(--font-utility);
    font-size: 0.8125rem;
    font-weight: 600;
    margin-right: 1rem;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
}

/* Поддержка обратной совместимости для старых WebKit-браузеров (Safari/Chrome) */
.input-field[type="file"]::-webkit-file-upload-button {
    background: var(--color-roerich-ultramarine);
    color: #ffffff;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 1.5rem;
    font-family: var(--font-utility);
    font-size: 0.8125rem;
    font-weight: 600;
    margin-right: 1rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

/* Ховер-эффекты для кнопки загрузки */
.input-field[type="file"]:hover::file-selector-button {
    opacity: 0.9;
}
.input-field[type="file"]:hover::-webkit-file-upload-button {
    opacity: 0.9;
}

/* Стилизация текста "Файл не выбран" */
.input-field[type="file"] {
    color: rgba(0, 0, 0, 0.6); /* Приглушенный цвет для дефолтного текста */
    font-size: 0.875rem;
}

/* --- 5. GLOBAL ANIMATIONS (Alpine Ascent) --- */
@keyframes alpineAscent {
    from { opacity: 0; transform: translateY(20px); filter: blur(4px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

.stagger-in {
    animation: alpineAscent 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    opacity: 0;
    will-change: transform, opacity, filter;
}

/* Каскадное появление соседних элементов */
.stagger-in:nth-child(1) { animation-delay: 0.05s; }
.stagger-in:nth-child(2) { animation-delay: 0.15s; }
.stagger-in:nth-child(3) { animation-delay: 0.25s; }
.stagger-in:nth-child(4) { animation-delay: 0.35s; }
.stagger-in:nth-child(5) { animation-delay: 0.45s; }

/* 3. СТИЛИ КАСТОМНОГО ИНПУТА ДАТЫ */
.date-picker-wrapper { position: relative; display: flex; align-items: center; transition: transform 0.2s ease; width: 100%; }
.date-picker-wrapper:hover { transform: translateY(-1px); }
.date-picker-icon { position: absolute; left: 1rem; color: var(--color-roerich-ultramarine); pointer-events: none; display: flex; align-items: center; z-index: 2; }



/* --- Стилизация формы --- */
.roerich-squad-form {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    /* Разделитель только за счет пространства, никаких жестких border-top */
}

.roerich-utility-label {
    display: block;
    font-family: var(--font-utility);
    font-weight: 800;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--color-roerich-ultramarine);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.roerich-input-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

/* Трансформация поля по правилам forms_for_utility */
.roerich-utility-select {
    flex-grow: 1;
    font-family: var(--font-utility);
    font-size: 1rem;
    color: var(--color-abyss-ink);

    /* Базовое состояние */
    background: rgba(0, 80, 136, 0.05);
    border: none;
    border-bottom: 2px solid var(--color-roerich-ultramarine);
    border-radius: 0.5rem 0.5rem 0 0;

    /* Touch Target (увеличен до 48px) */
    min-height: 48px;
    padding: 0 1rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

/* Состояние фокуса: имитация подъема на слой Slopes */
.roerich-utility-select:focus {
    background: var(--color-snow-summit);
    border-bottom-color: var(--color-fiery-orange);
    box-shadow: var(--elevation-layer-2);
}

/* Кнопка добавления */
.roerich-btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    min-width: 48px;
    background-color: var(--color-roerich-ultramarine);
    color: var(--color-snow-summit);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s;
}

.roerich-btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 80, 136, 0.2);
}
/* --- Кастомный Селект: Логика --- */
.roerich-custom-select {
    position: relative;
    flex-grow: 1;
    z-index: 10; /* Задаем базовый слой, чтобы он был выше обычного текста */
}

/* Модификация триггера, чтобы текст и шеврон были по краям */
.roerich-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.roerich-chevron {
    color: var(--color-roerich-ultramarine);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.roerich-custom-select.is-open .roerich-chevron {
    transform: rotate(180deg);
}

.roerich-custom-select.is-open .roerich-select-trigger {
    background: var(--color-snow-summit);
    border-bottom-color: var(--color-fiery-orange);
    box-shadow: var(--elevation-layer-2);
}


/* Стилизация вылетающей кнопки-вопросика в стиле Рериха */
.roerich-help-trigger {
    position: absolute;
    top: -0.75rem;
    right: -0.75rem;
    width: 36px;
    height: 36px;
    /* --- ДОБАВЬ ЭТИ ТРИ СТРОЧКИ --- */
    min-width: 36px;
    min-height: 36px;
    flex-shrink: 0;
    background: var(--color-snow-summit);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    color: var(--color-mystic-violet);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--elevation-layer-2);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 5;
}
.roerich-help-trigger:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: var(--elevation-layer-3);
    color: var(--color-fiery-orange);
}

  /* Эпический градиент и силуэт гор на заднем плане */
  .plane-back {
    position: fixed;
    inset: 0;
    z-index: -10;
    background: radial-gradient(circle at 50% 20%, #FDFBF3 0%, var(--color-mountain-paper) 100%);
  }
  .plane-back::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30vh;
    background: linear-gradient(180deg, rgba(0, 80, 136, 0.02) 0%, rgba(0, 80, 136, 0.08) 100%);
    clip-path: polygon(0% 100%, 0% 65%, 12% 50%, 25% 70%, 40% 40%, 55% 75%, 70% 55%, 85% 72%, 100% 45%, 100% 100%);
    opacity: 0.7;
    pointer-events: none;
  }