/* ===== ХЕДЕР (ОСНОВНОЙ) ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    padding-top: var(--safe-area-top);
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    z-index: 100;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--neon-purple), #ec4899);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 13px;
    color: #fff;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.header-user {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.search-toggle-header {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: none;
}
.search-toggle-header .material-icons {
    font-size: 24px;
}

/* ===== ХЕДЕР ЧАТА ===== */
.chat-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    padding-top: var(--safe-area-top);
    background: rgba(10, 14, 23, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: none; /* по умолчанию скрыт, показывается через JS */
    align-items: center;
    justify-content: space-between;
    padding-left: 8px;
    padding-right: 16px;
    z-index: 200;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.chat-back-btn {
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 24px;
}
.chat-back-btn:active {
    opacity: 0.6;
}

.chat-header-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}

/* ===== НИЖНЯЯ НАВИГАЦИЯ ===== */
.app-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-bar-height);
    padding-bottom: var(--safe-area-bottom);
    background: rgba(19, 27, 46, 0.9);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
}

.nav-btn {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    position: relative;
    transition: color 0.15s ease, transform 0.1s ease;
}
.nav-btn:active {
    transform: scale(0.92);
}
.nav-btn.active {
    color: var(--neon-purple);
}
.nav-btn .nav-icon {
    font-size: 24px !important;
}
.nav-btn .nav-text {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.badge-count {
    position: absolute;
    top: 8px;
    right: 50%;
    transform: translateX(12px);
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    border: 2px solid var(--bg-card);
}
.badge-count.hidden {
    display: none;
}

/* ===== СКРЫТИЕ ЭЛЕМЕНТОВ ПРИ ОТКРЫТОМ ЧАТЕ ===== */
.app-header.hidden,
.app-navigation.hidden {
    display: none !important;
}

/* ===== ОСНОВНОЙ КОНТЕНТ ===== */
.main-content {
    position: absolute;
    top: var(--header-height);
    bottom: var(--bottom-bar-height);
    left: 0;
    right: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0;
}

/* Режим чата: контент занимает всю высоту без учёта нижней навигации */
.main-content.chat-mode {
    top: var(--header-height);
    bottom: 0;
}

.tab-content {
    display: none;
    animation: appTabSwitch 0.2s cubic-bezier(0, 0, 0.2, 1);
}
.tab-content.active {
    display: block;
}
@keyframes appTabSwitch {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* ===== ЗАГОЛОВКИ СТРАНИЦ ===== */
.page-header {
    padding: 16px 20px 12px;
    margin-bottom: 4px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.06), rgba(236, 72, 153, 0.04));
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-title {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--neon-purple), #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.page-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 28px;
    background: var(--neon-purple);
    border-radius: 3px;
    flex-shrink: 0;
}

.page-subtitle {
    font-size: 14px;
    color: #8899b0;
    font-weight: 400;
    margin-top: 2px;
    padding-left: 14px;
    letter-spacing: 0.2px;
}