/**
 * TOCHKA Mobile Interface Fixes v5.9
 * Зачистка GP + Cinema Glass + Fixed Tabbar + Push System
 * Путь: assets/css/mobile.css
 * Исправлено: Принудительный Flex для кнопок действий (Fix v5.8)
 */

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --tabbar-height: 68px; /* Синхронизировано с высотой в tabbar.php */
    --oled-black: #000000;
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent-white: #ffffff;
    --status-rejected: #FF3B30;
    --push-bg: rgba(28, 28, 30, 0.85);
}

@media (max-width: 768px) {
    /* 1. Глубокая очистка GeneratePress (согласно ТЗ) */
    #mobile-header, 
    .main-navigation, 
    .mobile-header-navigation, 
    .site-header, 
    .site-footer, 
    #wpadminbar, 
    .entry-header, 
    .site-info { 
        display: none !important;
        visibility: hidden !important;
    }

    /* 2. App-Shell & Scroll Physics */
    html, body {
        overflow-x: hidden;
        height: 100%;
        background-color: var(--oled-black);
        overscroll-behavior-y: none;
    }

    body {
        padding-top: 0 !important;
        /* Резервируем место под фиксированный таббар внизу */
        padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 30px) !important;
        -webkit-font-smoothing: antialiased;
        -webkit-tap-highlight-color: transparent;
    }

    /* 3. ФИКСАЦИЯ ТАББАРА */
    .app-tabbar {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: calc(var(--tabbar-height) + var(--safe-bottom)) !important;
        z-index: 25000 !important; /* Выше контента, но ниже Push-баннеров */
        background: rgba(15, 15, 15, 0.75) !important;
        backdrop-filter: blur(25px) saturate(180%) !important;
        -webkit-backdrop-filter: blur(25px) saturate(180%) !important;
        border-top: 1px solid var(--glass-border) !important;
        padding-bottom: var(--safe-bottom) !important;
        display: flex !important;
        align-items: center;
        justify-content: space-around;
        pointer-events: auto;
    }

    /* 4. Profile Hero & Admin Panel Fixes */
    .profile-hero {
        margin-bottom: 20px !important;
        position: relative;
    }

    .profile-hero img {
        width: 100%;
        max-height: 40vh; /* Ограничение высоты фото */
        object-fit: cover;
        display: block;
    }

    .admin-panel {
        padding: 20px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 18px;
        margin: 0 16px 20px 16px;
        border: 1px solid var(--glass-border);
    }

    /* 5. Система Push-баннеров (iOS / Dynamic Island style) */
    .ios-push-banner {
        position: fixed;
        top: calc(var(--safe-top) + 8px);
        left: 12px;
        right: 12px;
        z-index: 30000;
        background: var(--push-bg);
        backdrop-filter: blur(25px) saturate(180%);
        -webkit-backdrop-filter: blur(25px) saturate(180%);
        border-radius: 26px;
        padding: 14px 18px;
        display: flex;
        align-items: center;
        gap: 14px;
        border: 1px solid var(--glass-border);
        box-shadow: 0 15px 35px rgba(0,0,0,0.4);
        transform: translateY(-150%) scale(0.9);
        opacity: 0;
        transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
        cursor: pointer;
    }

    .ios-push-banner.active {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    .push-icon {
        font-size: 24px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: rgba(255,255,255,0.05);
        border-radius: 12px;
    }

    .push-body {
        flex-grow: 1;
        overflow: hidden;
    }

    .push-title {
        color: var(--accent-white);
        font-weight: 700;
        font-size: 15px;
        margin-bottom: 2px;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
    }

    .push-text {
        color: rgba(255, 255, 255, 0.6);
        font-size: 13px;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .push-handle {
        position: absolute;
        bottom: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: rgba(255,255,255,0.15);
        border-radius: 2px;
    }

    /* 6. Группа кнопок взаимодействия (Fix: Кнопка блокировки в ряд) */
    /* Силовое выравнивание для контейнеров, где могут лежать кнопки */
    .entry-content, .profile-actions-row, .wp-block-buttons {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 12px !important;
        margin: 20px 16px !important;
    }

    .action-btn-main {
        position: relative;
        flex: 1 1 auto !important; /* Растягивается, занимая доступное место */
        width: auto !important;    /* Сброс фиксированной ширины */
        height: 64px !important;
        background: #007AFF !important; /* Насыщенный синий */
        color: #fff !important;
        border: none !important;
        border-radius: 22px !important;
        font-size: 17px !important;
        font-weight: 800 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 10px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
    }

    .action-btn-main:active { 
        transform: scale(0.96); 
        opacity: 0.9; 
    }

    .btn-block-user, .profile-block-btn {
        flex: 0 0 64px !important; /* Строго фиксированный размер */
        width: 64px !important;
        height: 64px !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 22px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border: 1px solid var(--glass-border) !important;
        color: var(--status-rejected) !important;
        margin: 0 !important;
    }

    /* 7. Cinema Glass UI */
    .sheet-footer {
        position: sticky;
        bottom: 0;
        padding: 20px 24px calc(20px + var(--safe-bottom));
        background: rgba(10, 10, 10, 0.7);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--glass-border);
        z-index: 20;
    }

    .glass-morph {
        backdrop-filter: blur(35px) saturate(200%);
        -webkit-backdrop-filter: blur(35px) saturate(200%);
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid var(--glass-border);
    }
}