/* 
 * YORDAMCHI MOBILE OPTIMIZATION CSS
 * Полная мобильная оптимизация для всех устройств
 * Версия: 3.0
 * Дата: 2026-01-02
 */

/* ==================== КРИТИЧЕСКИЕ ИСПРАВЛЕНИЯ ==================== */

/* Принудительный overflow-x: hidden на всех уровнях */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

/* Сброс и базовые стили для мобильных */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box !important;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
}

/* Предотвращение выхода элементов за экран - УСИЛЕННОЕ */
img, video, iframe, embed, object, table, pre, code {
    max-width: 100% !important;
    height: auto;
    word-break: break-word;
}

/* Все контейнеры не могут выходить за экран */
div, section, article, aside, main, header, footer, nav {
    max-width: 100%;
}

/* Текст не выходит за рамки */
p, h1, h2, h3, h4, h5, h6, span, a, li, td, th, label {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}


/* Улучшение производительности скролла */
.container, .page, .section-card {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

@media (max-width: 768px) {
    /* Хедер фиксированный сверху */
    .header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 1000 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow: hidden !important;
    }
    
    /* На странице мессенджера хедер виден */
    .messenger-page {
        padding-top: 56px !important;
    }
    
    /* Отступ для контента под фиксированный хедер */
    body:not(.messenger-page) {
        padding-top: 60px;
    }
    
    .header-inner {
        padding: 10px 12px;
        justify-content: space-between;
        min-height: 56px;
        overflow: hidden;
        max-width: 100vw;
    }
    
    .logo {
        font-size: 16px;
        font-weight: 700;
        flex-shrink: 0;
        min-width: fit-content;
    }
    
    .logo svg {
        width: 28px;
        height: 28px;
    }
    
    .nav {
        display: none;
    }
    
        
    .header-icon-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .header-username {
        display: none;
    }
    
    .header-user-btn {
        padding: 4px;
    }
    
    /* Скрываем кнопку выхода на мобильных — она есть в настройках */
    .header-actions > a[href="/logout"] {
        display: none !important;
    }
    
    .header-avatar, .header-avatar-img {
        width: 32px !important;
        height: 32px !important;
    }
    
    /* Показываем языковой переключатель на мобильных */
    .lang-switcher {
        display: flex !important;
        position: relative;
    }
    
    /* Мобильное меню языков */
    .lang-dropdown {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 4px;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        z-index: 1001;
        min-width: 140px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all 0.2s ease;
    }
    
    .lang-dropdown.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .lang-dropdown a {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        text-decoration: none;
        transition: background 0.2s;
    }
    
    .lang-dropdown a:hover {
        background: #f3f4f6;
    }
    
    .lang-dropdown a.active {
        background: #eff6ff;
    }
    
    .lang-dropdown .lang-flag {
        font-size: 24px;
        line-height: 1;
    }
    
    .lang-dropdown span:not(.lang-flag) {
        display: none; /* Скрываем текст на мобильных */
    }
    
    .lang-dropdown .lang-check {
        display: none; /* Скрываем галочку на мобильных */
    }
    
    /* Показываем текст и стрелку в основной кнопке языка на мобильных */
    .lang-toggle .lang-text {
        display: inline;
        font-size: 12px;
        font-weight: 600;
    }
    
    .lang-toggle .lang-arrow {
        display: inline;
        margin-left: 4px;
    }
    
    .lang-toggle {
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 6px !important;
        background: var(--gray-100) !important;
        border: none !important;
        border-radius: 8px !important;
        cursor: pointer !important;
    }
    
        
    /* Устанавливаем порядок для мобильных - выход последним справа */
    .header-actions {
        display: flex;
        gap: 4px;
    }
    
    /* Кнопка сообщений видна на всех экранах */
    .header-actions #messagesIconBtn {
        display: flex !important;
    }
    
    /* Правильный порядок для мобильных */
    .header-actions {
        display: flex;
        gap: 2px;
        flex-wrap: nowrap;
        overflow: hidden;
        flex-shrink: 1;
        min-width: 0;
    }
    
    /* � Кнопка Войти - первый (для неавторизованных) */
    .header-actions .btn-ghost {
        order: 1;
    }
    
    /* � Кнопка Зарегистрироваться - второй (для неавторизованных) */
    .header-actions .btn-primary {
        order: 2;
    }
    
    /* 🇷🇺/🇺🇿 Язык - третий */
    .header-actions .lang-switcher {
        order: 3;
    }
    
    /* � Уведомления - первые (для авторизованных) */
    .header-actions #notificationsIconBtn {
        order: 1;
    }
    
    /* 👤 Профиль - второй (для авторизованных) */
    .header-actions .header-user-btn {
        order: 2;
    }
    
    /* 🚪 Выход - последний (для авторизованных) */
    .header-actions > a[href="/logout.php"] {
        order: 4;
    }
    
    /* 🔒 Защита кнопок входа/регистрации от сжатия */
    .header-actions .btn {
        flex-shrink: 0;
        min-width: fit-content;
        white-space: nowrap;
    }
    
    /* 📱 Гарантируем отображение обеих кнопок на мобильных */
    .header-actions .btn-ghost,
    .header-actions .btn-primary {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        padding: 8px 16px !important;
        font-size: 14px !important;
        width: auto !important;
        min-width: fit-content !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }
    
    .header-actions .btn-primary {
        margin-left: 8px;
    }
    
    /* ==================== ОСНОВНЫЕ ЭЛЕМЕНТЫ ==================== */
    .container {
        padding: 0 16px;
    }
    
    .page {
        padding: 20px 0;
    }
    
    .page-title {
        font-size: 24px;
        margin-bottom: 20px;
        text-align: center;
    }
    
    /* ==================== КНОПКИ ==================== */
    .btn {
        padding: 14px 20px;
        font-size: 16px;
        min-height: 48px;
        border-radius: 8px;
        width: auto;
        justify-content: center;
        display: flex;
        align-items: center;
        gap: 8px;
        font-weight: 600;
        transition: all 0.2s;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .btn-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn-group .btn {
        width: 100%;
    }
    
    /* ==================== ФОРМЫ ==================== */
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 8px;
        display: block;
        color: #374151;
    }
    
    .form-input, 
    .form-textarea, 
    .form-select {
        width: 100%;
        padding: 14px 16px;
        font-size: 16px; /* Предотвращает зум на iOS */
        min-height: 48px;
        border: 2px solid #e5e7eb;
        border-radius: 8px;
        background: white;
        transition: border-color 0.2s;
        -webkit-appearance: none;
        appearance: none;
        box-sizing: border-box;
    }
    
    .form-input:focus,
    .form-textarea:focus,
    .form-select:focus {
        outline: none;
        border-color: #1a73e8;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }
    
    .form-textarea {
        min-height: 120px;
        resize: vertical;
        font-family: inherit;
    }
    
    .form-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* ==================== КАРТОЧКИ ==================== */
    .card {
        padding: 20px;
        margin-bottom: 16px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        background: white;
    }
    
    .section-card {
        padding: 20px;
        margin-bottom: 16px;
        border-radius: 12px;
        overflow: hidden;
        min-width: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* ==================== СЕТКИ ==================== */
    .grid-2, 
    .grid-3, 
    .grid-4 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* ==================== КАРТОЧКИ ЗАКАЗОВ ==================== */
    .order-card,
    .my-order-card {
        padding: 20px;
        margin-bottom: 16px;
        border-radius: 12px;
    }
    
    .order-card h3,
    .my-order-title {
        font-size: 16px;
        line-height: 1.3;
        margin-bottom: 12px;
    }
    
    .order-card p,
    .my-order-description {
        font-size: 14px;
        line-height: 1.4;
        margin-bottom: 12px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .order-meta {
        flex-direction: column;
        gap: 8px;
        font-size: 12px;
    }
    
    .order-price {
        font-size: 18px;
        font-weight: 700;
        color: #059669;
    }
    
    /* ==================== ТАБЫ ==================== */
    .profile-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
        margin-bottom: 16px;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .profile-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .profile-tab {
        white-space: nowrap;
        flex: none;
        min-width: 120px;
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 8px;
        font-weight: 600;
    }
    
    /* ==================== МОДАЛЬНЫЕ ОКНА ==================== */
    .modal-content {
        width: 95%;
        max-width: 500px;
        margin: 20px auto;
        padding: 24px;
        border-radius: 16px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        padding-bottom: 16px;
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 20px;
    }
    
    .modal-title {
        font-size: 18px;
        font-weight: 700;
    }
    
    /* ==================== УВЕДОМЛЕНИЯ ==================== */
    .notification-item {
        padding: 16px;
        border-radius: 12px;
        margin-bottom: 12px;
    }
    
    .notification-title {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 4px;
    }
    
    .notification-text {
        font-size: 13px;
        line-height: 1.4;
        color: #6b7280;
    }
    
    /* ==================== СООБЩЕНИЯ ==================== */
    .messages-layout {
        height: 100vh;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .messages-sidebar {
        display: none;
    }
    
    .messages-main {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
    
    .messages-header {
        padding: 16px;
        border-bottom: 1px solid #e5e7eb;
        background: white;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .messages-list {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
        -webkit-overflow-scrolling: touch;
    }
    
    .message-item {
        margin-bottom: 16px;
        max-width: 85%;
    }
    
    .message-item.sent {
        margin-left: auto;
    }
    
    .message-bubble {
        padding: 12px 16px;
        border-radius: 18px;
        font-size: 15px;
        line-height: 1.4;
        word-wrap: break-word;
    }
    
    .message-input-area {
        padding: 16px;
        border-top: 1px solid #e5e7eb;
        background: white;
    }
    
    .message-input {
        width: 100%;
        padding: 12px 16px;
        border: 2px solid #e5e7eb;
        border-radius: 24px;
        font-size: 16px;
        resize: none;
        max-height: 120px;
    }
    
    /* ==================== ПРОФИЛИ ==================== */
    .customer-page-layout,
    .performer-page-layout {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }
    
    .customer-sidebar,
    .performer-sidebar {
        position: static;
        order: -1;
    }
    
    .customer-card,
    .performer-card {
        padding: 20px;
        text-align: center;
        border-radius: 16px;
    }
    
    .customer-avatar,
    .performer-avatar {
        width: 80px;
        height: 80px;
        margin: 0 auto 16px;
    }
    
    .customer-name,
    .performer-name {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .customer-role,
    .performer-specialty {
        font-size: 14px;
        color: #6b7280;
    }
    
    /* Новые профили (performer.php, customer.php) */
    .performer-profile,
    .customer-profile {
        padding: 12px;
        max-width: 100%;
    }
    
    .profile-card {
        border-radius: 12px;
    }
    
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 16px;
        gap: 12px;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
    
    .profile-info {
        width: 100%;
    }
    
    .profile-name {
        font-size: 20px;
    }
    
    .profile-meta {
        justify-content: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .meta-item {
        font-size: 13px;
    }
    
    .profile-actions {
        width: 100%;
        justify-content: center;
    }
    
    .btn-contact {
        width: 100%;
        justify-content: center;
    }
    
    .profile-tabs {
        padding: 0 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .profile-tab {
        padding: 12px 14px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    .content-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .card-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .portfolio-grid.full {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .reviews-list {
        gap: 12px;
    }
    
    .review-item {
        padding: 14px;
    }
    
    .review-top {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .reviewer-avatar {
        width: 36px;
        height: 36px;
    }
    
    /* ==================== СТАТИСТИКА ==================== */
    .stat-item {
        text-align: center;
        padding: 16px;
        background: #f8fafc;
        border-radius: 12px;
        min-width: 0;
        overflow: hidden;
    }
    
    .stat-number {
        display: block;
        font-size: 24px;
        font-weight: 800;
        color: #1e293b;
        line-height: 1;
        margin-bottom: 6px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .stat-label {
        font-size: 12px;
        color: #64748b;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* ==================== КАТЕГОРИИ ==================== */
    .category-card {
        padding: 16px 12px;
        text-align: center;
        border-radius: 12px;
        background: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        transition: transform 0.2s;
    }
    
    .category-card:active {
        transform: scale(0.98);
    }
    
    .category-icon {
        width: 48px;
        height: 48px;
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .category-name {
        font-size: 13px;
        font-weight: 600;
        line-height: 1.2;
    }
    
    /* ==================== HERO СЕКЦИЯ ==================== */
    .hero {
        padding: 40px 20px;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 28px;
        line-height: 1.2;
        margin-bottom: 16px;
    }
    
    .hero p {
        font-size: 16px;
        margin-bottom: 24px;
        color: rgba(255,255,255,0.9);
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 12px;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
    
    /* ==================== FOOTER ==================== */
    .footer {
        padding: 40px 0 20px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        text-align: center;
    }
    
    .footer-section h4 {
        font-size: 16px;
        margin-bottom: 12px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 8px;
    }
    
    /* ==================== УТИЛИТЫ ==================== */
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .text-center-mobile {
        text-align: center;
    }
    
    .full-width-mobile {
        width: 100% !important;
    }
    
    .hide-mobile {
        display: none !important;
    }
    
    .hero h1 {
        font-size: 24px;
        margin-bottom: 12px;
    }
    
    .hero p {
        margin-bottom: 16px;
    }
    
    .messages-layout {
        height: 100vh;
    }
    
    .modal-content {
        max-height: 95vh;
        margin: 5px auto;
    }
} /* закрытие @media (max-width: 768px) */

/* ==================== ВЫСОКАЯ ПЛОТНОСТЬ ПИКСЕЛЕЙ ==================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .category-icon,
    .btn svg,
    .header svg {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Увеличенные цели для касания */
@media (pointer: coarse) {
    .btn,
    .profile-tab,
    .category-card,
    .order-card {
        min-height: 44px;
    }
    
    .form-input,
    .form-textarea,
    .form-select {
        min-height: 48px;
    }
}

/* ==================== МОБИЛЬНАЯ ВЕРСИЯ ==================== */
@media (max-width: 768px) {
    .mo-card-price {
        font-size: 18px !important;
        font-weight: 700 !important;
        color: #059669 !important;
    }
    .mo-card { padding: 16px !important; }
    .mo-card-title { font-size: 16px !important; }
    .mo-card-meta { flex-wrap: wrap !important; gap: 8px !important; font-size: 12px !important; }
    
    /* Создание заказа */
    .create-order-page { padding: 20px 16px !important; }
    .create-order-card { padding: 20px !important; }
    .create-order-title { font-size: 24px !important; }
    .co-form-row { grid-template-columns: 1fr !important; }
    .co-form-input, .co-form-select, .co-form-textarea { font-size: 16px !important; }
    
    /* Уведомления */
    .notif-page { padding: 16px 0 !important; }
    .notif-card { padding: 16px !important; }
    
    /* Избранное */
    .fav-page { padding: 16px 0 !important; }
    .fav-grid { grid-template-columns: 1fr !important; }
    .fav-card { padding: 16px !important; }
    
    /* Исполнители */
    .perf-page { padding: 20px 0 !important; }
    .perf-grid { grid-template-columns: 1fr !important; }
    .perf-filters form { flex-direction: column !important; }
    
    /* Профиль */
    .profile-page-layout { grid-template-columns: 1fr !important; }
    .profile-sidebar { position: static !important; }
    
    /* Кнопка выхода в разделе Безопасность (только на мобильных) */
    .mobile-only {
        display: block !important;
    }
    
    .btn-logout-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 14px 20px;
        background: #BA1A1A;
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        text-decoration: none;
        cursor: pointer;
        transition: all 0.2s;
    }
    
    .btn-logout-mobile:hover {
        background: #b91c1c;
    }
    
    .btn-logout-mobile:active {
        transform: scale(0.98);
    }
    
    .btn-logout-mobile svg {
        flex-shrink: 0;
    }
    
    /* Авторизация */
    .auth-page { padding: 20px 16px !important; }
    .auth-card { padding: 24px 20px !important; max-width: 100% !important; }
    
    /* Отклики */
    .my-response-card { margin-bottom: 12px !important; }
    .my-response-order { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
    .my-response-footer { flex-direction: column !important; gap: 12px !important; }
    
    /* Кнопки на мобильных */
    .btn-group { flex-direction: column !important; }
    .btn-group .btn { width: 100% !important; }
    
    /* Flex-элементы не выходят за экран */
    .flex, [style*="display: flex"], [style*="display:flex"] {
        flex-wrap: wrap !important;
    }
    
    /* Грид-лейауты на 1 колонку */
    [style*="grid-template-columns: 1fr 340px"],
    [style*="grid-template-columns: 1fr 320px"],
    [style*="grid-template-columns: 1fr 300px"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Кнопка чата видна на мобильных */
    .header .header-actions #messagesIconBtn {
        display: flex !important;
    }
    
    /* Отступ снизу для контента (под таббар) */
    body {
        padding-bottom: 70px !important;
    }
    
    /* Мессенджер: таббар виден */
    body.messenger-page {
        padding-bottom: 70px !important;
    }
}

/* Стили таббара */
.mobile-tabbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e5e7eb;
    z-index: 999;
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
}

@media (max-width: 768px) {
    .mobile-tabbar {
        display: flex !important;
        justify-content: space-around;
        align-items: center;
    }
}

.mobile-tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #8e8e93;
    font-size: 10px;
    padding: 4px 0;
    position: relative;
    flex: 1;
    -webkit-tap-highlight-color: transparent;
}

.mobile-tabbar-item svg {
    width: 26px;
    height: 26px;
    stroke-width: 1.8;
    transition: all 0.15s ease;
}

.mobile-tabbar-item.active {
    color: #007aff;
}

.mobile-tabbar-item.active svg {
    stroke-width: 2.2;
    transform: scale(1.05);
}

.mobile-tabbar-item:active {
    opacity: 0.6;
    transform: scale(0.95);
}

.mobile-tabbar-badge {
    position: absolute;
    top: 2px;
    right: 50%;
    transform: translateX(14px);
    background: #ff3b30;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #fff;
}

.mobile-tabbar-label {
    font-size: 10px;
    line-height: 1.2;
    font-weight: 500;
}

/* Скрываем элементы только для мобильных на десктопе */
.mobile-only {
    display: none;
}

/* Скрываем таббар на десктопе */
@media (min-width: 769px) {
    .mobile-tabbar {
        display: none !important;
    }
}

/* ══════════════════════════════════════════════════════════
   МОБИЛЬНЫЙ БУРГЕР + SIDEBAR MENU
   ══════════════════════════════════════════════════════════ */

/* Бургер-кнопка — скрыта на десктопе */
.mobile-burger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 10px;
    color: #374151;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}
.mobile-burger-btn:active { background: #f3f4f6; }

/* Overlay */
.msb-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.msb-overlay.show { display: block; }

/* Sidebar panel */
.msb {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10001;
    bottom: 0;
    width: min(320px, 88vw);
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    overscroll-behavior: contain;
    box-shadow: 4px 0 32px rgba(0,0,0,0.18);
}
.msb.open { transform: translateX(0); }

/* Sidebar header */
.msb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 14px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}
.msb-logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: #191C1E;
    text-decoration: none;
}
.msb-logo-text { font-weight: 700; letter-spacing: -0.3px; }
.msb-logo-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.msb-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #374151;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}
.msb-close-btn:active { background: #e5e7eb; }

/* Profile block */
.msb-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin: 12px 12px 4px;
    background: #f8faff;
    border: 1px solid #e8eef8;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    flex-shrink: 0;
}
.msb-profile:active { background: #eef2fc; }

.msb-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #1c75e5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.msb-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.msb-avatar-letter {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}
.msb-profile-info { flex: 1; min-width: 0; }
.msb-profile-name {
    font-size: 15px;
    font-weight: 600;
    color: #191C1E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msb-profile-role {
    font-size: 13px;
    color: #6b7280;
    margin-top: 1px;
}
.msb-chevron { color: #9ca3af; flex-shrink: 0; }

/* Nav sections */
.msb-nav {
    padding: 8px 8px 4px;
    flex-shrink: 0;
}
.msb-nav-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 12px;
    border-radius: 12px;
    color: #374151;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.15s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.msb-nav-item:active,
.msb-nav-item:hover { background: #f3f4f6; }
.msb-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #6b7280;
}
.msb-nav-item span { flex: 1; }

/* Badge на пункте меню */
.msb-badge {
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: #1c75e5;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    flex-shrink: 0;
}

/* Logout */
.msb-nav-logout { color: #BA1A1A; }
.msb-nav-logout .msb-icon { color: #BA1A1A; }
.msb-nav-logout:active,
.msb-nav-logout:hover { background: #fff5f5; }

/* Divider */
.msb-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 4px 16px;
    flex-shrink: 0;
}

/* Language switcher at bottom */
.msb-lang {
    margin: auto 12px 16px;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.msb-lang-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    border-radius: 10px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
}
.msb-lang-btn.active {
    background: #eff6ff;
    border-color: #1c75e5;
    color: #1c75e5;
    font-weight: 600;
}
.msb-lang-btn:active { opacity: 0.75; }

/* ── Mobile header overrides (≤768px) ─────────────────────── */
@media (max-width: 768px) {
    /* Показываем бургер */
    .mobile-burger-btn { display: flex !important; }

    /* Порядок иконок: чат → уведомления → бургер */
    .header-actions #messagesIconBtn    { display: flex !important; order: 1; }
    .header-actions #notificationsIconBtn { order: 2 !important; }
    .mobile-burger-btn                  { order: 3 !important; }

    /* Скрываем на мобильных: профиль-кнопку, язык, выход */
    .header-actions .header-user-btn   { display: none !important; }
    .header-actions .lang-switcher     { display: none !important; }
    .header-actions > a[href="/logout"]{ display: none !important; }

    /* sidebar уже display:flex глобально; overlay управляется классом .show */
}

/* На десктопе прячем overlay и sidebar полностью */
@media (min-width: 769px) {
    .mobile-burger-btn { display: none !important; }
    .msb-overlay       { display: none !important; }
    .msb               { display: none !important; }
}

/* ══════════════════════════════════════════════════════════
   МОБИЛЬНЫЕ FULL-SCREEN СТРАНИЦЫ (.mmp)
   ══════════════════════════════════════════════════════════ */
.mmp {
    display: none;
    position: fixed;
    inset: 0;
    background: #f8fafc;
    z-index: 500;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
@media (min-width: 769px) { .mmp { display: none !important; } }

.mmp-header {
    position: sticky; top: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    z-index: 10; flex-shrink: 0;
}
.mmp-back {
    width: 38px; height: 38px; border-radius: 50%;
    background: #f3f4f6; display: flex; align-items: center; justify-content: center;
    color: #374151; text-decoration: none; flex-shrink: 0;
}
.mmp-back:active { background: #e5e7eb; }
.mmp-title { font-size: 17px; font-weight: 700; color: #191C1E; display: flex; align-items: center; gap: 8px; margin: 0; }
.mmp-badge { background: #1c75e5; color: #fff; font-size: 12px; font-weight: 700; border-radius: 10px; padding: 1px 8px; }
.mmp-body { padding: 16px; flex: 1; }

/* Profile banner (stats page) */
.mmp-profile-banner {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border-radius: 16px; padding: 16px; margin-bottom: 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.mmp-profile-ava {
    width: 52px; height: 52px; border-radius: 50%;
    background: #1c75e5; color: #fff; font-size: 22px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.mmp-profile-ava img { width:100%; height:100%; object-fit:cover; }
.mmp-profile-name { font-size: 16px; font-weight: 700; color: #191C1E; }
.mmp-profile-role { font-size: 13px; color: #6b7280; margin-top: 2px; }

/* Stats grid */
.mmp-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.mmp-stat-card {
    background: #fff; border-radius: 14px; padding: 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.05);
    display: flex; flex-direction: column; gap: 8px;
}
.mmp-stat-icon { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.mmp-stat-val { font-size: 26px; font-weight: 800; color: #191C1E; line-height: 1; }
.mmp-stat-lbl { font-size: 12px; color: #6b7280; }
.mmp-info-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #9ca3af; padding: 0 4px; }

/* Rating summary (reviews page) */
.mmp-rating-summary {
    background: #fff; border-radius: 16px; padding: 20px;
    display: flex; align-items: center; gap: 16px; margin-bottom: 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.mmp-big-rating { font-size: 48px; font-weight: 800; color: #191C1E; line-height: 1; }
.mmp-stars-row { display: flex; gap: 3px; margin-bottom: 4px; }
.mmp-star { font-size: 18px; color: #d1d5db; }
.mmp-star.on { color: #f59e0b; }
.mmp-review-count { font-size: 13px; color: #6b7280; }

/* Review cards */
.mmp-review-card {
    background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 10px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}
.mmp-review-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.mmp-reviewer-ava {
    width: 40px; height: 40px; border-radius: 50%;
    background: #1c75e5; color: #fff; font-size: 16px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0;
}
.mmp-reviewer-ava img { width:100%; height:100%; object-fit:cover; }
.mmp-reviewer-info { flex: 1; min-width: 0; }
.mmp-reviewer-name { font-size: 14px; font-weight: 600; color: #191C1E; }
.mmp-review-stars { display: flex; gap: 2px; margin-top: 2px; }
.mmp-review-stars .mmp-star { font-size: 14px; }
.mmp-review-date { font-size: 12px; color: #9ca3af; white-space: nowrap; flex-shrink: 0; }
.mmp-review-text { font-size: 14px; color: #374151; line-height: 1.55; margin: 0; }
.mmp-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 60px 0; color: #9ca3af; font-size: 15px; }

/* Security section */
.mmp-section-card {
    background: #fff; border-radius: 14px; padding: 16px;
    display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}
.mmp-section-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mmp-section-body { flex: 1; min-width: 0; }
.mmp-section-title { font-size: 14px; font-weight: 600; color: #191C1E; }
.mmp-section-sub { font-size: 13px; color: #6b7280; margin-top: 2px; }
.mmp-section-btn { border: 1.5px solid #1c75e5; background: transparent; color: #1c75e5; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.mmp-section-btn:active { background: #eff6ff; }
.mmp-section-label { font-size: 12px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.5px; margin: 20px 0 8px; }
.mmp-sessions-list { margin-bottom: 20px; }
.mmp-sessions-loading { color: #9ca3af; font-size: 14px; padding: 8px 0; }
.mmp-logout-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
    padding: 14px; background: #fff5f5; border: 1.5px solid #fecaca; border-radius: 12px;
    color: #BA1A1A; font-size: 15px; font-weight: 600; text-decoration: none; margin-top: 8px;
}
.mmp-logout-btn:active { background: #fee2e2; }

/* Settings form */
.mmp-ava-upload { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 24px; }
.mmp-ava-circle {
    width: 90px; height: 90px; border-radius: 50%;
    background: #1c75e5; color: #fff; font-size: 38px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.mmp-ava-circle img { width:100%; height:100%; object-fit:cover; }
.mmp-ava-btn { display: flex; align-items: center; gap: 6px; padding: 8px 18px; background: #f3f4f6; border-radius: 20px; font-size: 14px; font-weight: 500; color: #374151; cursor: pointer; }
.mmp-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mmp-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.mmp-field label { font-size: 13px; font-weight: 600; color: #374151; }
.mmp-input {
    width: 100%; padding: 13px 14px; border: 1.5px solid #e5e7eb; border-radius: 10px;
    font-size: 15px; background: #fff; color: #191C1E; box-sizing: border-box;
    outline: none; transition: border-color 0.15s; font-family: inherit;
}
.mmp-input:focus { border-color: #1c75e5; }
.mmp-textarea { resize: none; }
.mmp-save-btn {
    width: 100%; padding: 15px; background: #1c75e5; color: #fff; border: none;
    border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; margin-top: 6px;
}
.mmp-save-btn:active { opacity: 0.85; }
.mmp-form-msg { padding: 12px; border-radius: 10px; font-size: 14px; margin-bottom: 10px; }
.mmp-form-msg.ok { background: #f0fdf4; color: #166534; }
.mmp-form-msg.err { background: #fef2f2; color: #991b1b; }

/* Bottom-sheet modals */
.mmp-modal { position: fixed; inset: 0; z-index: 600; display: none; align-items: flex-end; }
.mmp-modal[style*="flex"] { display: flex !important; }
.mmp-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.mmp-modal-box { position: relative; background: #fff; border-radius: 20px 20px 0 0; padding: 20px 16px 40px; width: 100%; z-index: 1; }
.mmp-modal-hd { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 700; color: #191C1E; margin-bottom: 16px; }
.mmp-modal-x { background: #f3f4f6; border: none; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; cursor: pointer; color: #374151; display: flex; align-items: center; justify-content: center; }

/* Скрытие «Безопасность» / удаления аккаунта (YORDAMCHI_SHOW_SECURITY_ACCOUNT_UI = false) */
body.yd-hide-security-ui .profile-tab-new[data-tab="security"],
body.yd-hide-security-ui .profile-tab[data-tab="security"],
body.yd-hide-security-ui #security-section,
body.yd-hide-security-ui #mmp-security,
body.yd-hide-security-ui .msb-nav-item[href*="tab=security"],
body.yd-hide-security-ui a.stats-link-item[href*="tab=security"],
body.yd-hide-security-ui .delete-account-block,
body.yd-hide-security-ui .deleteAccountBtn {
    display: none !important;
}
