/* Mobile Navigation Styles */
/* This file is only loaded on mobile devices using the mobile-detect plugin */

/* Prevent pinch zoom on mobile navigation */
.mobile-navigation {
    touch-action: pan-x pan-y;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.mobile-navigation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--bg-page, #1c1d21);
    box-shadow: none;
    border-bottom: none;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: static;
}

.mobile-nav-brand {
    position: static;
    transform: none;
    z-index: 1;
    margin-left: 0.25rem;
    flex: 0 0 auto;
}

/* Кнопка: зона тапа строго по размеру кнопки, без выхода за границы */
.mobile-nav-toggle {
    background: var(--chip-bg, rgba(255, 255, 255, 0.06));
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.08));
    border-radius: 10px;
    cursor: pointer;
    padding: 11px 10px;
    margin-right: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    box-sizing: border-box;
    position: relative;
    z-index: 10001;
    flex: 0 0 auto;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Тапы обрабатывает только кнопка; иконка внутри не перехватывает клики */
.mobile-nav-toggle .nav-line {
    pointer-events: none;
}

.mobile-nav-toggle.active {
    transform: none;
}

/* Three lines as on reference: equal length, equal thickness, evenly spaced, no animation */
.nav-line {
    width: 20px;
    height: 2px;
    background: var(--nav-text, #e6e6ea);
    border-radius: 1px;
    flex-shrink: 0;
    display: block;
}

.nav-line-1,
.nav-line-2,
.nav-line-3 {
    width: 20px;
    height: 2px;
}

/* Active state: only color change, no transform */
.mobile-nav-toggle.active .nav-line-1,
.mobile-nav-toggle.active .nav-line-2,
.mobile-nav-toggle.active .nav-line-3 {
    transform: none;
    background: var(--accent, #4da3ff);
}

.mobile-nav-toggle.active .nav-line {
    background: var(--accent, #4da3ff) !important;
    transform: none !important;
}

.mobile-nav-brand a {
    color: var(--nav-text, #e6e6ea);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: auto;
}

.mobile-logo {
    height: 34px;
    width: auto;
    display: block;
}

/* Keep logo left and hamburger right */

/* Панель меню: только появление по opacity (как на desktop), без выезда и без затемнения */
.mobile-nav-content {
    position: fixed;
    top: 60px;
    left: 0;
    width: 280px;
    height: calc(100vh - 60px);
    height: calc(100dvh - 60px);
    background: var(--bg-page, #1c1d21);
    box-shadow: none;
    overflow-y: auto;
    z-index: 9999;
    overflow-x: hidden;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.28s;
}

.mobile-nav-content.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
}

/* CTA block inside mobile menu */
.mobile-cta {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 14px 16px 16px;
    border-top: 1px solid var(--border-soft, rgba(255,255,255,0.08));
    border-bottom: none;
    background: var(--bg-page, #1c1d21);
    z-index: 2;
}

.mobile-cta a {
    display: block;
    background: var(--accent, #4da3ff);
    color: var(--bg-page, #1c1d21);
    text-decoration: none;
    text-align: center;
    padding: 12px 16px;
    border-radius: 6px;
    font-weight: 600;
    position: relative;
}

/* Remove any pseudo-elements that might be adding the caret icon */
.mobile-cta a::before,
.mobile-cta a::after {
    content: none !important;
    display: none !important;
}

/* Remove Spectre icon classes if they get applied */
.mobile-cta a.icon-caret::before,
.mobile-cta a.icon-arrow-down::before,
.mobile-cta a.icon-arrow-up::before,
.mobile-cta a.icon-chevron-down::before,
.mobile-cta a.icon-chevron-up::before {
    content: none !important;
    display: none !important;
    border: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Remove any child elements that might be icons */
.mobile-cta a .icon,
.mobile-cta a .icon-caret,
.mobile-cta a .icon-arrow-down,
.mobile-cta a .icon-arrow-up,
.mobile-cta a .icon-chevron-down,
.mobile-cta a .icon-chevron-up {
    display: none !important;
}

/* Ultra-specific rule to override any framework styles */
.mobile-navigation .mobile-nav-content .mobile-cta a::before,
.mobile-navigation .mobile-nav-content .mobile-cta a::after,
.mobile-navigation .mobile-nav-content .mobile-cta a *::before,
.mobile-navigation .mobile-nav-content .mobile-cta a *::after {
    content: none !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    border: none !important;
    background: none !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
}

/* Remove pseudo-elements from any button classes that might be applied */
.mobile-cta a.btn::before,
.mobile-cta a.btn::after,
.mobile-cta a.button::before,
.mobile-cta a.button::after,
.mobile-cta a.btn-clear::before,
.mobile-cta a.btn-clear::after,
.mobile-cta a.btn-primary::before,
.mobile-cta a.btn-primary::after,
.mobile-cta a.btn-success::before,
.mobile-cta a.btn-success::after,
.mobile-cta a.btn-error::before,
.mobile-cta a.btn-error::after,
.mobile-cta a.btn-warning::before,
.mobile-cta a.btn-warning::after {
    content: none !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    border: none !important;
    background: none !important;
}

/* Remove any icon classes that might be applied */
.mobile-cta a.icon::before,
.mobile-cta a.icon::after,
.mobile-cta a.icon-caret::before,
.mobile-cta a.icon-arrow-down::before,
.mobile-cta a.icon-arrow-up::before,
.mobile-cta a.icon-chevron-down::before,
.mobile-cta a.icon-chevron-up::before {
    content: none !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    border: none !important;
    background: none !important;
}

/* Additional rules to remove the orange rectangle specifically */
.mobile-cta a::before,
.mobile-cta a::after {
    all: unset !important;
    content: none !important;
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    border: none !important;
    background: none !important;
    position: static !important;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transform: none !important;
    transition: none !important;
}

/* Target any element that might have the orange border */
.mobile-cta a *,
.mobile-cta a *::before,
.mobile-cta a *::after {
    border-color: transparent !important;
    background-color: transparent !important;
    color: transparent !important;
}

/* Nuclear option - completely disable all pseudo-elements and borders */
.mobile-cta a,
.mobile-cta a * {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.mobile-cta a::before,
.mobile-cta a::after,
.mobile-cta a *::before,
.mobile-cta a *::after {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    content: "" !important;
    width: 0 !important;
    height: 0 !important;
    border: none !important;
    background: none !important;
    color: transparent !important;
    font-size: 0 !important;
    line-height: 0 !important;
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    z-index: -9999 !important;
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

/* CTA base state (align with desktop accent) */
.mobile-cta a,
.mobile-cta a:hover,
.mobile-cta a:focus,
.mobile-cta a:active,
.mobile-cta a:visited {
    border-color: transparent !important;
    outline-color: transparent !important;
    background-color: var(--accent, #4da3ff) !important;
    color: var(--bg-page, #1c1d21) !important;
}

/* Override any orange focus/active states */
.mobile-cta a:focus,
.mobile-cta a:active {
    outline: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Final override - ensure no orange colors can appear */
.mobile-cta a,
.mobile-cta a *,
.mobile-cta a::before,
.mobile-cta a::after,
.mobile-cta a *::before,
.mobile-cta a *::after {
    border-color: transparent !important;
    outline-color: transparent !important;
    background-color: transparent !important;
    color: transparent !important;
}

.mobile-cta a {
    background-color: var(--accent, #4da3ff) !important;
    color: var(--bg-page, #1c1d21) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.mobile-cta a:hover {
    background: var(--accent-hover, #76b8ff) !important;
}

.mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.mobile-nav-item {
    border-bottom: none;
}

/* Level 1: фиксированная высота строки */
.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    padding: 0 20px;
    box-sizing: border-box;
    color: var(--text-body, rgba(255,255,255,0.85)) !important;
    text-decoration: none;
    font-family: var(--font-sans, 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.3;
    transition: color 160ms cubic-bezier(0.2, 0.8, 0.2, 1), background 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Remove underlines from all mobile navigation links */
.mobile-nav-link,
.mobile-nav-link.active {
    text-decoration: none;
}

/* Force-disable underline for all mobile navbar link states */
.mobile-navigation a.mobile-nav-link,
.mobile-navigation a.mobile-dropdown-link,
.mobile-navigation a.mobile-child-dropdown-link,
.mobile-navigation a.mobile-nav-link:hover,
.mobile-navigation a.mobile-dropdown-link:hover,
.mobile-navigation a.mobile-child-dropdown-link:hover,
.mobile-navigation a.mobile-nav-link:focus,
.mobile-navigation a.mobile-dropdown-link:focus,
.mobile-navigation a.mobile-child-dropdown-link:focus,
.mobile-navigation a.mobile-nav-link:active,
.mobile-navigation a.mobile-dropdown-link:active,
.mobile-navigation a.mobile-child-dropdown-link:active,
.mobile-navigation a.mobile-nav-link:visited,
.mobile-navigation a.mobile-dropdown-link:visited,
.mobile-navigation a.mobile-child-dropdown-link:visited {
    text-decoration: none !important;
}

/* Plus/minus icon: two lines (horizontal + vertical). When submenu is open, hide horizontal = minus */
.mobile-dropdown-arrow {
    width: 40px;
    min-width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--border-soft, rgba(255,255,255,0.08));
    background: var(--chip-bg, rgba(255,255,255,0.06));
    color: var(--text-body, rgba(255,255,255,0.85));
    position: relative;
    flex-shrink: 0;
}
.mobile-dropdown-arrow::before,
.mobile-dropdown-arrow::after {
    content: '';
    position: absolute;
    background: currentColor;
    border-radius: 1px;
}
/* horizontal bar (stays visible when open → minus "−") */
.mobile-dropdown-arrow::before {
    width: 14px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
/* vertical bar (hidden when submenu open → minus) */
.mobile-dropdown-arrow::after {
    width: 2px;
    height: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease;
}
/* When submenu is open: hide vertical bar → minus "−" (horizontal line only) */
.mobile-nav-item:has(> .mobile-dropdown-menu.active) > .mobile-nav-link > .mobile-dropdown-arrow::after,
.mobile-dropdown-item:has(> .mobile-child-dropdown-menu.active) > .mobile-dropdown-link > .mobile-dropdown-arrow::after {
    opacity: 0;
    pointer-events: none;
}

.mobile-dropdown-menu {
    list-style: none;
    margin: 0.25rem 0.5rem 0.5rem;
    padding: 0.35rem;
    background: var(--bg-surface, #202127);
    border: 1px solid var(--border-soft, rgba(255,255,255,0.08));
    border-radius: 12px;
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-dropdown-menu.active {
    display: block;
    max-height: 500px;
}

.mobile-dropdown-menu.mobile-dropdown-menu-compact {
    max-width: calc(100% - 1rem);
}

.mobile-dropdown-menu.mobile-dropdown-menu-grouped {
    max-width: calc(100% - 0.75rem);
    padding: 0.8rem 0.55rem 0.7rem;
}

.mobile-dropdown-group {
    margin: 0;
    padding: 0 0 0.6rem;
    list-style: none;
}

.mobile-dropdown-group:first-child {
    padding-top: 0.1rem;
}

.mobile-dropdown-group + .mobile-dropdown-group {
    margin-top: 0.55rem;
    padding-top: 0.1rem;
}

.mobile-dropdown-group-title {
    margin: 0 0 0.55rem;
    padding: 0 0.6rem;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-heading, rgba(255,255,255,0.95));
}

.mobile-dropdown-group-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mobile-dropdown-item {
    border-bottom: none;
    margin: 0;
    padding: 0;
}

.mobile-dropdown-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Level 2: фиксированная высота строки */
.mobile-dropdown-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    padding: 0.52rem 0.72rem;
    box-sizing: border-box;
    color: var(--text-body, rgba(255,255,255,0.85)) !important;
    text-decoration: none;
    font-family: var(--font-sans, 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
    font-weight: 400;
    font-size: 0.94rem;
    line-height: 1.45;
    transition: color 160ms cubic-bezier(0.2, 0.8, 0.2, 1), background 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mobile-dropdown-link.mobile-dropdown-link-grouped {
    padding-left: 0.6rem;
}

.mobile-dropdown-group-links .mobile-dropdown-item + .mobile-dropdown-item {
    margin-top: 0.2rem;
}

.mobile-child-dropdown-menu {
    list-style: none;
    margin: 0.25rem 0.5rem 0.375rem;
    padding: 0.25rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-soft, rgba(255,255,255,0.08));
    border-radius: 10px;
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-child-dropdown-menu.mobile-child-dropdown-menu-attached {
    margin-left: 0.375rem;
    margin-right: 0.375rem;
}

.mobile-child-dropdown-menu.active {
    display: block;
    max-height: 300px;
}

.mobile-child-dropdown-item {
    border-bottom: none;
    margin: 0;
    padding: 0;
}

.mobile-child-dropdown-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Level 3: фиксированная высота строки */
.mobile-child-dropdown-link {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0.4rem 0.5rem 0.4rem 0.75rem;
    box-sizing: border-box;
    color: var(--text-body, rgba(255,255,255,0.85)) !important;
    text-decoration: none;
    font-family: var(--font-sans, 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif);
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.3;
    transition: color 160ms cubic-bezier(0.2, 0.8, 0.2, 1), background 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Без лишней высоты у последнего пункта в подменю */
.mobile-dropdown-menu .mobile-dropdown-item:last-child .mobile-dropdown-link,
.mobile-child-dropdown-menu .mobile-child-dropdown-item:last-child .mobile-child-dropdown-link {
    margin-bottom: 0;
}

/* Фиксированные высоты уже заданы выше для level2/level3 */

/* Smooth transitions for all interactive elements */
.mobile-navigation * {
    transition: all 0.2s ease;
}

/* Переходы панели меню — приоритет над * (только opacity, без выезда) */
.mobile-navigation .mobile-nav-content {
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s 0.28s;
}
.mobile-navigation .mobile-nav-content.active {
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s;
}

/* Overlay только для закрытия по клику вне меню, без затемнения */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s, visibility 0s 0.2s;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.2s, visibility 0s;
}

/* Lock background scroll when mobile navigation is open */
html.mobile-nav-open,
body.mobile-nav-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
}

body.mobile-nav-open {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .mobile-nav-content {
        width: 100%;
    }
}

/* Ensure mobile navigation doesn't interfere with desktop */
@media (min-width: 769px) {
    .mobile-navigation {
        display: none !important;
    }
}

/* Hide desktop custom header on small screens as a fallback if detection fails */
@media (max-width: 768px) {
    #custom-header {
        display: none !important;
    }
}

/* Loading states */
.mobile-nav-content.loading {
    opacity: 0.7;
}

/* No blue underline/outline on tap or focus in navbar (removes blue line on press/selection) */
.mobile-navigation,
.mobile-navigation a,
.mobile-nav-content,
.mobile-nav-content .mobile-nav-link,
.mobile-nav-content .mobile-dropdown-link,
.mobile-nav-content .mobile-child-dropdown-link {
    -webkit-tap-highlight-color: transparent;
    tap-highlight-color: transparent;
}
.mobile-nav-link:focus,
.mobile-nav-link:active,
.mobile-dropdown-link:focus,
.mobile-dropdown-link:active,
.mobile-child-dropdown-link:focus,
.mobile-child-dropdown-link:active {
    outline: none !important;
    text-decoration: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
}

/* Remove focus rectangle from hamburger toggle */
.mobile-nav-toggle:focus,
.mobile-nav-toggle:active {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mobile-navigation {
        border: 2px solid #000000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mobile-nav-content,
    .mobile-dropdown-menu,
    .mobile-child-dropdown-menu,
    .mobile-nav-toggle,
    .nav-line {
        transition: none;
    }
}

/* Additional mobile-specific features */

/* Prevent text selection during touch gestures */
.mobile-nav-content {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Smooth scrolling for mobile */
.mobile-nav-content {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Better touch feedback */
.mobile-nav-link:active,
.mobile-dropdown-link:active,
.mobile-child-dropdown-link:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* No swipe animation — content appears instantly */

/* Prevent zoom on double tap */
.mobile-nav-content {
    touch-action: pan-x pan-y;
}

/* No blue outline on drawer when focus is inside */
.mobile-nav-content:focus-within {
    outline: none !important;
}

/* Hover highlight disabled for mobile navbar items */

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .mobile-nav-content {
        height: calc(100vh - 60px);
        max-height: calc(100vh - 60px);
    }
}

/* ===== Final mobile navbar placement overrides (requested) ===== */
.mobile-nav-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
}

/* Logo on the left */
.mobile-nav-brand {
    order: 1 !important;
    margin-left: 0 !important;
    flex: 0 0 auto !important;
}

.mobile-nav-brand a {
    justify-content: flex-start !important;
}

/* Button on the right, зона тапа только по кнопке */
.mobile-nav-toggle {
    order: 2 !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    flex: 0 0 auto !important;
}

/* Force CTA block to the bottom of drawer */
.mobile-nav-content {
    display: flex !important;
    flex-direction: column !important;
}

.mobile-nav-menu {
    flex: 1 1 auto !important;
}

.mobile-cta {
    margin-top: auto !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 2 !important;
}

/* ===== Requested follow-up tweaks ===== */
/* 1) Bigger logo in top navbar */
.mobile-logo {
    height: 42px !important;
}

/* 2) Disable submenu open/close animation on plus click */
.mobile-dropdown-arrow,
.mobile-dropdown-menu,
.mobile-child-dropdown-menu {
    transition: none !important;
}

/* 3) Remove selected-page underline/highlight in mobile navbar */
.mobile-nav-link.active,
.mobile-dropdown-link.active,
.mobile-child-dropdown-link.active {
    background: transparent !important;
    box-shadow: none !important;
    text-decoration: none !important;
    color: var(--text-body, rgba(255,255,255,0.85)) !important;
}
