/* assets/css/layout.css */
.app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: linear-gradient(to bottom, rgba(15, 15, 20, 1) 30%, rgba(15, 15, 20, 0.95) 70%, rgba(15, 15, 20, 0.5) 90%, transparent 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 4000;
}

/* Логотип SVG */
.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
    text-decoration: none !important;
}

.logo-container:hover {
    text-decoration: none !important;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}.app-header,
.header-right,
.user-menu-wrapper,
.user-avatar-btn {
    pointer-events: auto !important;
}

.header-right,
.user-menu-wrapper,
.user-avatar-btn {
    position: relative;
    z-index: 3000;
}

/* Парящий блок баланса */
.balance-pill {
    background: var(--bg-panel);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.balance-pill .tokens { color: var(--accent); font-weight: bold; }

.app-container {
    display: grid;
    width: 100%;
    max-width: none;
    min-width: 0;
    grid-template-columns: 240px minmax(0, 1fr) 380px; /* Правое ухо делаем чуть шире под карточки */
    gap: 20px; /* ПРОСТРАНСТВО МЕЖДУ ПАРЯЩИМИ БЛОКАМИ */
    padding: var(--header-height) 20px 20px 20px;
    height: 100vh;
    height: 100dvh;
    transition: all var(--transition-speed) ease;
    box-sizing: border-box;
}

/* Класс для всех парящих блоков (Острова) */
.floating-island {
    background: var(--bg-panel);
    border-radius: var(--border-rad);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3); /* Легкая тень для объема */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-sidebar, .app-right-sidebar { height: 100%; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.app-center:has(.admin-dashboard-page) {
    align-items: stretch;
}

.app-center:has(.admin-dashboard-page) {
    min-width: 0;
    box-sizing: border-box;
    padding-right: 0;
    padding-left: 0;
}

.app-center:has(.admin-dashboard-page) > .admin-dashboard-page {
    flex: 0 0 auto;
    align-self: stretch;
    width: 100%;
    max-width: none;
    min-width: 0;
    box-sizing: border-box;
}.app-center { height: 100%; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }/* Мобильная страница галереи моделей должна занимать естественную высоту документа. */
@media (max-width: 768px) {
    .app-container.models-gallery-page {
        display: block !important;
        height: auto !important;
        min-height: 100dvh !important;
        padding-bottom: 20px !important;
        overflow: visible !important;
    }

    .app-container.models-gallery-page > .app-center {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: calc(100dvh - var(--header-height)) !important;
        overflow: visible !important;
    }

    .app-container.models-gallery-page .gallery-wrapper {
        display: flex !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }

    .app-container.models-gallery-page .gallery-wrapper > .floating-island {
        flex: 0 0 auto !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .app-container.models-gallery-page .gallery-wrapper > .floating-island:last-child {
        height: auto !important;
        min-height: 260px !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .app-container.models-gallery-page #models-grid {
        display: grid !important;
        width: 100% !important;
        height: auto !important;
        min-height: 180px !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

.app-center:has(.ready-cards-layout) {
    position: relative;
    z-index: auto;
    display: flex !important;
    flex: 1 1 auto !important;
    align-items: stretch !important;
    align-self: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

.app-center:has(.ready-cards-layout) > .ready-cards-layout {
    display: flex !important;
    flex: 1 1 auto !important;
    align-self: stretch !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

body:has(.ready-cards-layout) .app-container {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}.app-header:has(+ .app-container .ready-cards-layout),
body:has(.ready-cards-layout) .app-header {
    z-index: 2147483000 !important;
    isolation: isolate;
}

body:has(.ready-cards-layout) .user-menu-wrapper {
    position: relative;
    z-index: 2147483001 !important;
}

body:has(.ready-cards-layout) .user-dropdown {
    z-index: 2147483002 !important;
}

/* Скроллбар для центральной колонки */
.app-center::-webkit-scrollbar { width: 6px; }
.app-center::-webkit-scrollbar-track { background: transparent; }
.app-center::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 4px; }
.app-center::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

/* Обертка для контента на весь экран (для гостей) */
.app-center-full {
    height: 100%;
    grid-column: 1 / -1; /* Заставляет блок занять всю ширину сетки (все 3 колонки) */
}

/* Гостевой режим (скролл всей страницы) */
.app-container.guest-mode {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-container.guest-mode .app-sidebar,
.app-container.guest-mode .app-right-sidebar {
    /* Растягиваем сайдбары на всю высоту видимой области, если контент страницы меньше */
    height: auto;
    min-height: calc(100vh - var(--header-height) - 40px);
    overflow: visible;
}

.app-container.guest-mode .app-center {
    height: 100%;
    overflow: visible;
}

/* ==========================================
   ГЛОБАЛЬНЫЕ КНОПКИ (BUTTONS) И АНИМАЦИИ
   ========================================== */
.btn {
    position: relative;
    overflow: hidden;
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    /* Пружинистая анимация (cubic-bezier) для плавности */
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, background 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Эффект волны (Ripple) при нажатии */
.btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    padding-top: 300%;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.6s ease-out, opacity 0.6s ease-out;
}

.btn:active::after {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0.5;
    transition: 0s; /* Моментально появляется под кликом */
}

.btn:not(:active)::after {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
    transition: transform 0.6s ease-out, opacity 0.6s ease-out; /* Плавное расширение */
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(0, 168, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 168, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 10px rgba(0, 168, 255, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 168, 255, 0.15);
}

.btn-secondary:active {
    transform: translateY(0) scale(0.95);
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ==========================================
   ГОСТЕВАЯ СТРАНИЦА (GUEST CENTER)
   ========================================== */
.guest-promo-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px;
    width: 100%;
}

.guest-promo-icon {
    margin-bottom: 24px;
    background: rgba(0, 168, 255, 0.05); 
    padding: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(0, 168, 255, 0.1);
}

.guest-welcome-message {
    max-width: 400px;
    margin-bottom: 32px;
}

.guest-welcome-message h2 {
    margin: 0 0 12px 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-main);
}

.guest-welcome-message p {
    margin: 0;
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.5;
}

.guest-actions {
    display: flex;
    gap: 16px;
}

/* Стили меню */
.sidebar-nav {
    padding: 2px 10px 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}.sidebar-nav + .sidebar-nav {
    padding-top: 0;
}

.sidebar-nav + .sidebar-nav .nav-item[onclick="return false;"] {
    margin-top: 8px !important;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    transition: var(--transition-speed);
}
.nav-item:hover {
    background: rgba(255,255,255,0.02);
    color: var(--text-main);
}
.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
}/* Отключение кликов и эффекта наведения на родительских узлах-заголовках в меню */
.nav-item[onclick="return false;"],
.nav-item[onclick="return false;"]:hover {
    cursor: default;
    background: transparent !important;
    color: var(--text-main) !important;
    margin-top: 10px !important;
    opacity: 1;
}
.sidebar-nav > .nav-item[onclick="return false;"]:first-child {
    margin-top: 4px !important;
}
.nav-item[onclick="return false;"] .label {
    font-size: 13px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nav-item[onclick="return false;"] svg {
    opacity: 1;
    color: var(--accent);
}

.icon-btn {
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    transition: 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-btn:hover { color: var(--accent); }

/* Мобильные вкладки скрыты по умолчанию */
.mobile-tabs { display: none; }

#toast-container {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--bg-panel);
    border-left: 4px solid var(--accent);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    transform: translateX(120%);
    transition: transform var(--transition-speed) cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: white;
}
.toast.show { transform: translateX(0); }

/* Выпадающее меню пользователя */
.user-menu-wrapper {
    position: relative;
    z-index: 1002;
}.user-avatar-btn {
    pointer-events: auto !important;
    position: relative;
    z-index: 2000;
}

.user-avatar-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    pointer-events: auto !important;
    position: relative;
    z-index: 2000;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px; /* Скругленный квадрат вместо круга (было 50%) */
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.user-avatar-btn:hover .user-avatar {
    background: var(--accent);
    color: white;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(19, 20, 26, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    min-width: 260px;
    margin-top: 12px;
    opacity: 0;
    visibility: hidden;
    /* Убрана дефолтная анимация трансформации, чтобы меню открывалось сразу */
    z-index: 1003;
}

.user-dropdown.open {
    opacity: 1;
    visibility: visible;
}

.user-dropdown.open,
.user-dropdown.open * {
    pointer-events: auto !important;
}

.dropdown-header {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 14px 14px 0 0;
}

.user-email {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    display: block;
    word-break: break-all;
    opacity: 0.9;
}

.dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    margin: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 4px 8px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.dropdown-item svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s ease;
}

.dropdown-item:hover svg {
    opacity: 1;
    color: var(--accent);
}

.logout-item {
    color: #ef4444;
}

.logout-item svg {
    color: #ef4444;
}

.logout-item:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.logout-item:hover svg {
    color: #ef4444;
}

/* ==========================================
   ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА
   ========================================== */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-panel);
    padding: 4px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.lang-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-muted);
    background: transparent;
    border-radius: 6px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.lang-btn:hover {
    color: var(--text-main);
    background: rgba(255,255,255,0.05);
}

.lang-btn.active {
    color: var(--accent);
    background: var(--accent-glow);
    cursor: default;
}


/* ==========================================
   СИММЕТРИЧНЫЕ ЯЗЫЧКИ (HANDLES) — ПРЕМИУМ ДИЗАЙН
   ========================================== */
@keyframes handle-glow {
    0% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.05) inset; }
    50% { box-shadow: 0 4px 20px rgba(0, 168, 255, 0.3), 0 0 0 1px rgba(0, 168, 255, 0.25) inset; }
    100% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.05) inset; }
}

.sidebar-handle {
    display: none; /* По умолчанию скрыты */
    position: fixed !important;
    top: 20% !important;
    transform: translateY(-50%);
    pointer-events: auto !important;
    isolation: isolate;
    z-index: 2147483005 !important;
    width: 18px;
    height: 76px;

    /* Премиальный глассморфизм */
    background: rgba(15, 15, 20, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    /* Жесткая рамка, чтобы элемент не сливался с контентом */
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-main);

    align-items: center;
    justify-content: center;
    z-index: 2147483005 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Анимация пульсации, чтобы привлекать внимание пользователя */
    animation: handle-glow 3s infinite alternate ease-in-out;
}

/* Эффект объема (внутренний блик по верхнему краю) */
.sidebar-handle::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 40%, rgba(0,0,0,0.5) 100%);
    border-radius: inherit;
    pointer-events: none;
}

.sidebar-handle.right-handle {
    right: 0 !important;
    pointer-events: auto !important;
    border-right: none;
    border-radius: 16px 0 0 16px;
    padding-left: 4px;
}

.sidebar-handle.left-handle {
    left: 0 !important;
    pointer-events: auto !important;
    border-left: none;@media (max-width: 1000px) {
    .sidebar-handle.right-handle {
        display: flex !important;
        position: fixed !important;
        right: 0 !important;
        top: 20% !important;
        z-index: 2147483005 !important;
        pointer-events: auto !important;
        visibility: visible !important;
    }
}

@media (max-width: 768px) {
    .sidebar-handle.left-handle {
        display: flex !important;
        position: fixed !important;
        left: 0 !important;
        top: 20% !important;
        z-index: 2147483005 !important;
        pointer-events: auto !important;
        visibility: visible !important;
    }
}
    border-radius: 0 16px 16px 0;
    padding-right: 4px;
}

.sidebar-handle svg {
    position: relative;
    z-index: 2;
    width: 12px; 
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}body:has(.ready-cards-layout) .sidebar-handle {
    display: flex !important;
    position: fixed !important;
    z-index: 2147483647 !important;
    pointer-events: auto !important;
    visibility: visible !important;
    isolation: auto;
    touch-action: manipulation !important;
    transform: translate3d(0, -50%, 0);
}

body:has(.ready-cards-layout) .sidebar-handle::before,
body:has(.ready-cards-layout) .sidebar-handle svg {
    pointer-events: none !important;
}

body:has(.ready-cards-layout) .sidebar-handle.left-handle {
    left: 0 !important;
    right: auto !important;
}

body:has(.ready-cards-layout) .sidebar-handle.right-handle {
    right: 0 !important;
    left: auto !important;
}

body:has(.ready-cards-layout) #mobile-left-sidebar-btn {
    left: 0 !important;
}

body:has(.ready-cards-layout) #mobile-right-sidebar-btn {
    right: 0 !important;
}body:has(.ready-cards-layout) #mobile-left-sidebar-btn,
body:has(.ready-cards-layout) #mobile-right-sidebar-btn {
    display: flex !important;
    position: fixed !important;
    pointer-events: auto !important;
    visibility: visible !important;
    z-index: 2147483647 !important;
    isolation: auto !important;
    transform: none !important;
    contain: none !important;
}

body:has(.ready-cards-layout) #mobile-left-sidebar-btn {
    left: 0 !important;
    right: auto !important;
}

body:has(.ready-cards-layout) #mobile-right-sidebar-btn {
    right: 0 !important;
    left: auto !important;
}

body:has(.ready-cards-layout) #mobile-left-sidebar-btn::before,
body:has(.ready-cards-layout) #mobile-right-sidebar-btn::before,
body:has(.ready-cards-layout) #mobile-left-sidebar-btn svg,
body:has(.ready-cards-layout) #mobile-right-sidebar-btn svg {
    pointer-events: none !important;
}

/* Ховер / Тап эффекты */
.sidebar-handle:hover {
    background: rgba(0, 168, 255, 0.15);
    color: #ffffff;
    border-color: rgba(0, 168, 255, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 168, 255, 0.4), 0 0 0 1px rgba(0, 168, 255, 0.5) inset;
    animation: none; /* Отключаем пульсацию при наведении */
}

.sidebar-handle.right-handle:hover {
    transform: translateY(-50%) translateX(-4px); 
    width: 22px;
}
.sidebar-handle.right-handle:hover svg {
    transform: translateX(-1px) scale(1.15);
}

.sidebar-handle.left-handle:hover {
    transform: translateY(-50%) translateX(4px); 
    width: 22px;
}
.sidebar-handle.left-handle:hover svg {
    transform: translateX(1px) scale(1.15);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1210;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}.sidebar-overlay.active {
    pointer-events: auto;
}body #mobile-left-sidebar-btn,
body #mobile-right-sidebar-btn {
    display: flex !important;
    pointer-events: auto !important;
    visibility: visible !important;
    z-index: 2147483647 !important;
}

body #mobile-left-sidebar-btn {
    left: 0 !important;
}

body #mobile-right-sidebar-btn {
    right: 0 !important;
}html body button.sidebar-handle#mobile-left-sidebar-btn,
html body button.sidebar-handle#mobile-right-sidebar-btn {
    display: flex !important;
    position: fixed !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 2147483647 !important;
    touch-action: manipulation !important;
    cursor: pointer !important;
}

html body button.sidebar-handle#mobile-left-sidebar-btn {
    left: 0 !important;
    right: auto !important;
}

html body button.sidebar-handle#mobile-right-sidebar-btn {
    right: 0 !important;
    left: auto !important;
}@media (min-width: 769px) {
    html body .sidebar-handle,
    html body #mobile-left-sidebar-btn,
    html body #mobile-right-sidebar-btn {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}body #mobile-left-sidebar-btn,
body #mobile-right-sidebar-btn {
    width: 28px !important;
    min-width: 28px !important;
    height: 76px !important;
    min-height: 76px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    touch-action: manipulation !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
    cursor: pointer !important;
}

body #mobile-left-sidebar-btn {
    transform: translate3d(0, -50%, 0) !important;
}

body #mobile-right-sidebar-btn {
    transform: translate3d(0, -50%, 0) !important;
}

body #mobile-left-sidebar-btn::before,
body #mobile-right-sidebar-btn::before,
body #mobile-left-sidebar-btn svg,
body #mobile-right-sidebar-btn svg {
    pointer-events: none !important;
}


/* --- АДАПТИВНОСТЬ --- */

@media (min-width: 1421px) {
    /* Центральная область получает всё свободное пространство между неизменными сайдбарами. */
    .app-container {
        grid-template-columns: 240px minmax(0, 1fr) 380px;
    }
}

/* Плавное сжатие для экранов < 1400px */
@media (max-width: 1400px) {
    .app-container {
        grid-template-columns: 200px minmax(0, 1fr) 320px;
        gap: 12px;
        padding: var(--header-height) 12px 12px 12px;
    }
    .sidebar-nav {
        padding: 15px 5px;
    }
    .nav-item {
        padding: 10px 15px;
        font-size: 14px;
    }
}@media (min-width: 1401px) {
    .app-container:has(.images-generator-layout),
    .app-container:has(.video-layout),
    .app-container:has(.ready-cards-layout) {
        grid-template-columns: 240px minmax(0, 1fr) 513px;
    }
}

@media (min-width: 1201px) and (max-width: 1400px) {
    .app-container:has(.images-generator-layout),
    .app-container:has(.video-layout),
    .app-container:has(.ready-cards-layout) {
        grid-template-columns: 200px minmax(0, 1fr) 432px;
    }
}

@media (min-width: 1001px) and (max-width: 1200px) {
    .app-container:has(.images-generator-layout),
    .app-container:has(.video-layout),
    .app-container:has(.ready-cards-layout) {
        grid-template-columns: 80px minmax(0, 1fr) 432px;
    }
}




/* Планшеты: Левое меню сворачивается до иконок */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 80px minmax(0, 1fr) 320px;
    }
    .sidebar-nav .label { display: none; }
    .sidebar-nav .nav-item { padding: 12px; justify-content: center; }
    .app-sidebar > div:not(.sidebar-nav) { display: none; }
}

/* Экраны < 1000px: правый сайдбар уходит в шторку, появляется правый "язычок" */
@media (max-width: 1000px) {
    .app-container {
        grid-template-columns: 80px minmax(0, 1fr); /* Левое свернутое меню + расширенный центр */
    }@media (min-width: 1001px) {
    html,
    body,
    .app-container,
    .app-center,
    .app-sidebar,
    .app-right-sidebar {
        touch-action: auto !important;
    }
}

    /* Включаем правый язычок */
    .sidebar-handle.right-handle {
        display: flex;
    }

    .app-right-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        right: -100vw; /* Прячем сайдбар полностью за правый край */
        width: 100vw;
        max-width: 100vw;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 1220; /* Поверх оверлея и Ready-центра */
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0;
        box-shadow: -10px 0 40px rgba(0,0,0,0.6);
        overflow-y: auto;
        overscroll-behavior: contain;
        touch-action: pan-y pinch-zoom;
        -webkit-overflow-scrolling: touch;
    }

    .app-right-sidebar.open {
        right: 0;
        display: flex !important; /* Гарантия видимости поверх других правил */
    }body:has(.ready-cards-layout) .app-right-sidebar,
    body:has(.ready-cards-layout) #app-right-sidebar {
        width: 100vw !important;
        max-width: 100vw !important;
        right: -100vw !important;
        border-radius: 0 !important;
    }

    body:has(.ready-cards-layout) .app-right-sidebar.open,
    body:has(.ready-cards-layout) #app-right-sidebar.open {
        right: 0 !important;
    }.app-container.guest-mode .app-right-sidebar {
        height: 100vh !important;
        height: 100dvh !important;
        min-height: 0;
        overflow: hidden !important;
        touch-action: pan-y;
    }
}

/* Мобильные экраны: Меню прячется, Центр занимает всё место, появляется левый "язычок" */
@media (max-width: 768px) {
    #app-sidebar {
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        overflow-x: hidden !important;
        overflow-y: scroll !important;
        overscroll-behavior-y: contain !important;
        touch-action: pan-y pinch-zoom !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-gutter: stable;
    }

    #app-sidebar .sidebar-nav {
        display: flex !important;
        flex: 0 0 auto !important;
        flex-direction: column !important;
        min-height: max-content !important;
        height: auto !important;
    }@media (max-width: 768px) {
    /* Переопределяем высоту шапки для мобильных (в 1.5 раза меньше) */
    :root {
        --header-height: 48px;
    }

    /* Уменьшаем иконку юзер-профиля */
    .user-avatar {
        width: 28px;
        height: 28px;
        border-radius: 8px; /* Немного уменьшаем радиус скругления пропорционально размеру */
    }
    
    /* Уменьшаем сам SVG внутри иконки профиля */
    .user-avatar svg {
        width: 16px;
        height: 16px;
    }

    /* Скрываем текстовую часть логотипа */
    .logo-container span { display: none; }

    /* Скрываем старый гамбургер в шапке */
    #mobile-menu-btn { display: none !important; }
    /* Включаем левый язычок */
    .sidebar-handle.left-handle { display: flex; }
    
    .app-container {
        display: flex; 
        flex-direction: column;
        padding: var(--header-height) 0 0 0; 
        gap: 0; 
    }
    
    /* Скрытое левое меню */
        .app-sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: 240px;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh;
        z-index: 1220;
        transition: left 0.3s ease;
        border-radius: 0;
        border-top-right-radius: var(--border-rad);
        border-bottom-right-radius: var(--border-rad);
        box-shadow: 10px 0 40px rgba(0,0,0,0.6);
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
        touch-action: pan-y;
        -webkit-overflow-scrolling: touch;
    }
    #app-sidebar {
        display: block !important;
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 240px !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100vh !important;
        max-height: 100dvh !important;
        min-height: 0 !important;
        background: var(--bg-body) !important; /* Убираем прозрачность сайдбара на мобильных */
        padding-bottom: env(safe-area-inset-bottom) !important;
        overflow-x: hidden !important;
        overflow-y: scroll !important;
        overscroll-behavior-y: contain !important;
        touch-action: pan-y !important;
        -webkit-overflow-scrolling: touch;
    }

    #app-sidebar .sidebar-nav {
        display: flex;
        flex-direction: column;
        flex: none;
        width: 100%;
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }.app-sidebar.open {
        left: 0;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        pointer-events: auto;
        touch-action: pan-y !important;
        -webkit-overflow-scrolling: touch;
    }#app-sidebar.open {
        left: 0 !important;
        pointer-events: auto !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior-y: contain !important;
        touch-action: pan-y pinch-zoom !important;
        -webkit-overflow-scrolling: touch !important;
    }@media (max-width: 768px) {
        #app-sidebar,
        #app-sidebar.open {
            display: block !important;
            width: 240px !important;
            height: 100vh !important;
            height: 100dvh !important;
            max-height: 100vh !important;
            max-height: 100dvh !important;
            overflow-x: hidden !important;
            overflow-y: auto !important;
            overscroll-behavior: contain !important;
            touch-action: pan-y !important;
            -webkit-overflow-scrolling: touch !important;
            pointer-events: auto !important;
        }

        #app-sidebar .sidebar-nav {
            display: block !important;
            height: auto !important;
            min-height: max-content !important;
            padding: 4px 8px 12px !important;
        }#app-sidebar .sidebar-nav + .sidebar-nav {
            padding-top: 0 !important;
        }

        #app-sidebar .sidebar-nav .nav-item[onclick="return false;"] {
            margin-top: 6px !important;
        }

        #app-sidebar .sidebar-nav > .nav-item[onclick="return false;"]:first-child {
            margin-top: 0 !important;
        }
    }.app-sidebar {
        display: block !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior-y: contain;
        touch-action: pan-y pinch-zoom;
        -webkit-overflow-scrolling: touch;
        min-height: 0;
        height: 100dvh !important;
        max-height: 100dvh;
        overflow-y: auto !important;
        scrollbar-gutter: stable;
        pointer-events: auto;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }
    .sidebar-nav .label { display: inline; }
    .sidebar-nav .nav-item { justify-content: flex-start; }

    /* Табы */
    .mobile-tabs {
        display: flex;
        position: fixed;
        top: var(--header-height);
        left: 0; right: 0;
        background: var(--bg-body);
        padding: 10px;
        z-index: 800;
        gap: 10px;
    }
    .mobile-tabs .tab-btn {
        flex-grow: 1;
        padding: 10px;
        background: var(--bg-panel);
        color: var(--text-muted);
        border: none;
        border-radius: 8px;
        font-weight: 500;
    }
    .mobile-tabs .tab-btn.active {
        background: var(--accent-glow);
        color: var(--accent);
    }
    
    .app-center {
        width: 100%;
        height: 100%;
        min-width: 0;
        flex: 1;
        display: flex;
    }

    .app-center.floating-island {
        border-radius: 0; 
        overflow: visible; 
    }

    .lang-switcher {
        padding: 3px;
    }
    
    .lang-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
    
    /* Гостевые стили под мобильные */
    .guest-actions {
        flex-direction: column;
        width: 100%;
        max-width: 280px;
    }
    
    .guest-actions .btn {
        width: 100%;
    }
    
    .guest-promo-wrapper {
        border-radius: 0;
        box-shadow: none;
        background: transparent;
    }
}}

/* На /ready открытые мобильные сайдбары начинаются ниже градиента шапки. */
@media (max-width: 1000px) {
    body:has(.ready-cards-layout) .app-right-sidebar {
        top: var(--header-height) !important;
        bottom: 0 !important;
        height: calc(100dvh - var(--header-height)) !important;
        max-height: calc(100dvh - var(--header-height)) !important;
    }
}

@media (max-width: 768px) {
    body:has(.ready-cards-layout) .app-sidebar,
    body:has(.ready-cards-layout) #app-sidebar {
        top: var(--header-height) !important;
        bottom: 0 !important;
        height: calc(100dvh - var(--header-height)) !important;
        max-height: calc(100dvh - var(--header-height)) !important;
    }
}/* Мобильная галерея моделей: контент страницы должен прокручиваться
   вместе с карточками, а не обрезаться высотой app-container/app-center. */
@media (max-width: 768px) {
    html:has(.models-grid),
    body:has(.models-grid) {
        min-height: 100% !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .app-container:has(.models-grid) {
        display: block !important;
        height: auto !important;
        min-height: 100dvh !important;
        padding-bottom: 20px !important;
        overflow: visible !important;
    }

    .app-center:has(.models-grid) {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        min-height: calc(100dvh - var(--header-height)) !important;
        overflow: visible !important;
    }

    .app-center:has(.models-grid) > .gallery-wrapper {
        display: flex !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }

    .app-center:has(.models-grid) > .gallery-wrapper > .floating-island {
        flex: 0 0 auto !important;
        min-width: 0 !important;
        width: 100% !important;
    }

    .app-center:has(.models-grid) > .gallery-wrapper > .floating-island:last-child {
        height: auto !important;
        min-height: 260px !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .app-center:has(.models-grid) #models-grid {
        display: grid !important;
        width: 100% !important;
        height: auto !important;
        min-height: 180px !important;
        max-height: none !important;
        overflow: visible !important;
        visibility: visible !important;
    }

    .app-center:has(.models-grid) #models-grid .model-card {
        min-width: 0 !important;
        visibility: visible !important;
    }
}@media (min-width: 769px) {
    html body button.sidebar-handle#mobile-left-sidebar-btn,
    html body button.sidebar-handle#mobile-right-sidebar-btn,
    html body .sidebar-handle {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}