/* CSS Reset и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS переменные — минимализм, референс */
:root {
    --bg-dark: #0d0d0d;
    --bg-card: #1a1a1c;
    --bg-elevated: #222225;
    --text-primary: #ffffff;
    --text-secondary: #9a9a9e;
    --accent-red: #E53935;
    --accent-gold: #FFC107;
    --radius: 14px;
    --radius-sm: 10px;
    --border-radius: var(--radius);
    --border-radius-small: var(--radius-sm);
}

/* Базовые стили — шрифты Manrope + Unbounded */
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app-container {
    min-height: 100vh;
    background: var(--bg-dark);
}

/* Стили для страниц */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    padding-bottom: 66px;
}
.page:has(.bottom-nav),
.page.has-bottom-nav {
    padding-bottom: 116px; /* 66 + 50: место под меню, сдвинутое на 50px вверх */
}

/* Header — в стиле Check Check */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 14px;
    background: var(--bg-dark);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.time {
    font-size: 16px;
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    color: var(--text-primary);
}

.camera-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: none;
    border-radius: 18px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
}

.header-icon-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

.close-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
    padding: 9px 14px;
    border-radius: 20px;
}

.close-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

.close-icon {
    font-size: 16px;
    opacity: 0.9;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
    padding: 9px 14px;
    border-radius: 20px;
}

.back-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

/* Content — по центру, max-width для планшетов, отступ сверху 50px */
.content {
    flex: 1;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 50px 18px 24px;
}

/* Главная без верхней полосы — отступ сверху 50px (или safe-area на вырезах) */
.page--no-header .content {
    padding-top: max(50px, env(safe-area-inset-top));
}

/* TG WebView: отступ 120px сверху на всех страницах */
.tg-webview .content,
.tg-webview .page--no-header .content,
.tg-webview .agreement-content {
    padding-top: max(100px, env(safe-area-inset-top));
}

/* Bottom Navigation — pill, матовое стекло. translateZ(0) — отдельный слой, меньше моргания при смене контента */
.bottom-nav {
    position: fixed;
    bottom: 50px;
    left: 12px;
    right: 12px;
    background: rgba(34, 34, 37, 0.65);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 6px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    border-radius: 28px;
    z-index: 1000;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

/* Бегущий индикатор — persistent, только transform в transition (width — snap) для плавности на iOS */
.nav-indicator {
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 0;
    width: 80px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.18);
    z-index: 0;
    pointer-events: none;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 10px 18px;
    border-radius: 20px;
    position: relative;
    z-index: 1;
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-item.active .nav-icon {
    color: var(--text-primary);
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
}

/* Аватар пользователя в пункте «Профиль» (подставляется через JS из Telegram) */
.nav-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.nav-label {
    display: none;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Manrope', sans-serif;
    white-space: nowrap;
}

.nav-item.active .nav-label {
    display: inline-block;
}

/* Page Title — Unbounded для заголовков */
.page-title {
    font-size: 22px;
    font-weight: 700;
    font-family: 'Unbounded', sans-serif;
    color: var(--text-primary);
    margin-bottom: 20px;
    letter-spacing: 0.02em;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.text-secondary {
    color: var(--text-secondary);
}

/* Модальное окно приложения */
#app-modal-root {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.app-modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    min-width: 260px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.app-modal__title {
    font-size: 17px;
    font-weight: 700;
    font-family: 'Unbounded', sans-serif;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.app-modal__body {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.app-modal__list {
    margin: -8px 0 16px;
}

.app-modal__list-item {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: var(--text-primary);
    font-size: 15px;
    cursor: pointer;
}

.app-modal__list-item:last-child {
    border-bottom: none;
}

.app-modal__list-item:active {
    opacity: 0.8;
}

.app-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.app-modal__btn {
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Manrope', sans-serif;
}

.app-modal__btn--default {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.app-modal__btn--primary {
    background: var(--accent-red);
    color: #fff;
}
