/* ============================================================
   VacVPN — Telegram Mini App overrides (docs/tma-roadmap.md фаза 2)
   Поверх styles.css: без navbar/footer сайта, нижний таб-бар,
   safe-area отступы под системные жесты Telegram-клиента.
   ============================================================ */

html, body {
    height: 100%;
}

body.tma-body {
    padding-top: env(safe-area-inset-top, 0);
    /* Место под нижний таб-бар + safe-area (домашний индикатор iOS) */
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0));
}

.tma-content {
    max-width: 560px;
    margin: 0 auto;
    padding: 16px 14px 8px;
}

.tma-content .section-card:last-child {
    margin-bottom: 0.5rem;
}

/* ---- Header ---- */
.tma-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.tma-header .avatar-placeholder {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
}
.tma-header h5 { margin: 0; font-weight: 700; }
.tma-header p { margin: 0; }

/* ---- Quick actions ---- */
.tma-quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}
.tma-quick-actions .btn { width: 100%; }
.tma-quick-actions.single {
    grid-template-columns: 1fr;
}

/* ---- Bottom tab bar ---- */
.tma-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    background: rgba(10, 10, 10, 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.tma-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 9px 4px 8px;
    background: none;
    border: none;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.1;
    cursor: pointer;
}
.tma-tab i { font-size: 1.15rem; }
.tma-tab.active { color: var(--primary); }
.tma-tab:hover { color: var(--text-primary); }
.tma-tab.active:hover { color: var(--primary); }

/* ---- "Ещё" bottom sheet ---- */
.tma-sheet-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 60;
}
.tma-sheet-backdrop.open { display: block; }

.tma-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 61;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 10px 10px calc(18px + env(safe-area-inset-bottom, 0));
    transform: translateY(100%);
    transition: transform 0.25s ease;
}
.tma-sheet.open { transform: translateY(0); }
.tma-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-input);
    margin: 4px auto 12px;
}
.tma-sheet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}
.tma-sheet-item i { width: 20px; text-align: center; color: var(--primary); }
.tma-sheet-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-primary); }
.tma-sheet-item.disabled {
    opacity: 0.45;
    pointer-events: none;
}
.tma-sheet-item .tma-soon {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ---- Tariff selection (MainButton flow) ---- */
.tma-tariffs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tma-tariffs .tariff-card {
    cursor: pointer;
    padding: 16px;
}
.tma-tariffs .tariff-card.selected {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    background: var(--bg-card-hover);
}
.tma-tariffs .tariff-card .tariff-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.tma-tariffs .tariff-price {
    font-size: 1.6rem;
}
.tma-tariffs .tariff-radio {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-input);
    flex-shrink: 0;
    position: relative;
}
.tma-tariffs .tariff-card.selected .tariff-radio {
    border-color: var(--primary);
}
.tma-tariffs .tariff-card.selected .tariff-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--primary-gradient);
}

/* Спейсер снизу тарифов, чтобы последняя карточка не пряталась под MainButton'ом Telegram */
.tma-mainbutton-spacer { height: 70px; }

/* ---- Auth splash ---- */
.tma-splash {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}
.tma-splash .spinner {
    width: 32px;
    height: 32px;
    margin: 0 auto 16px;
    border: 3px solid rgba(255, 102, 0, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@media (max-width: 380px) {
    .tma-quick-actions { grid-template-columns: 1fr; }
}
