/* ============================================================
   PREMIUM MOBILE NAVIGATION
   Luxury design with refined aesthetics and smooth animations
   ============================================================ */

/* Hide mobile elements on desktop */
@media (min-width: 769px) {
  .mobile-header,
  .mobile-sidebar,
  .mobile-overlay {
    display: none !important;
  }
}

/* Mobile Premium Styles */
@media (max-width: 768px) {
  
  /* Hide desktop header and footer */
  .site-header {
    display: none !important;
  }

  footer.footer {
    display: none !important;
  }

  /* Adjust body padding */
  body {
    padding-top: 70px !important;
    padding-bottom: 0 !important;
  }

  /* ============================================================
     PREMIUM MOBILE HEADER
     ============================================================ */
  .mobile-header {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: linear-gradient(180deg, 
      rgba(10, 10, 10, 0.98) 0%, 
      rgba(15, 15, 15, 0.95) 100%);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Premium Logo Styling */
  .mobile-logo {
    font-size: 19px;
    font-weight: 300;
    color: #ffffff;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .mobile-logo::before {
    content: '';
    width: 4px;
    height: 4px;
    background: linear-gradient(135deg, #ffffff 0%, #888888 100%);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
    animation: pulse-glow 3s ease-in-out infinite;
  }

  @keyframes pulse-glow {
    0%, 100% {
      opacity: 1;
      transform: scale(1);
    }
    50% {
      opacity: 0.6;
      transform: scale(1.2);
    }
  }

  /* ============================================================
     PREMIUM HAMBURGER MENU
     ============================================================ */
  .mobile-menu-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-menu-toggle:active {
    transform: scale(0.95);
  }

  .mobile-menu-toggle span {
    display: block;
    width: 26px;
    height: 1.5px;
    background: linear-gradient(90deg, #ffffff 0%, #cccccc 100%);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  }

  .mobile-menu-toggle span:nth-child(2) {
    width: 22px;
  }

  /* Elegant animation when active */
  .mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
    background: linear-gradient(90deg, #ffffff 0%, #aaaaaa 100%);
  }

  .mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
  }

  .mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
    width: 26px;
    background: linear-gradient(90deg, #ffffff 0%, #aaaaaa 100%);
  }

  /* ============================================================
     PREMIUM SIDEBAR
     ============================================================ */
  .mobile-sidebar {
    display: block !important;
    position: fixed;
    top: 0;
    left: -100%;
    width: 320px;
    height: 100vh;
    background: linear-gradient(165deg, 
      rgba(18, 18, 18, 0.98) 0%, 
      rgba(12, 12, 12, 0.98) 100%);
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    z-index: 10000;
    transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
  }

  /* Custom scrollbar for sidebar */
  .mobile-sidebar::-webkit-scrollbar {
    width: 6px;
  }

  .mobile-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
  }

  .mobile-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
  }

  .mobile-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
  }

  .mobile-sidebar.active {
    left: 0;
  }

  /* Premium Sidebar Header */
  .mobile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 24px;
    background: linear-gradient(180deg, 
      rgba(20, 20, 20, 0.5) 0%, 
      transparent 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
  }

  .mobile-sidebar-header h3 {
    font-size: 16px;
    font-weight: 300;
    color: #ffffff;
    margin: 0;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.9;
  }

  /* Elegant Close Button */
  .mobile-close-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 200;
  }

  .mobile-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: rotate(90deg);
  }

  .mobile-close-btn:active {
    transform: rotate(90deg) scale(0.9);
  }

  /* ============================================================
     PREMIUM NAVIGATION
     ============================================================ */
  .mobile-nav {
    padding: 32px 0;
  }

  .mobile-nav-item {
    display: block;
    padding: 18px 24px 18px 28px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    font-weight: 300;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 2px solid transparent;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
  }

  /* Elegant hover effect */
  .mobile-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(180deg, 
      rgba(255, 255, 255, 0.8) 0%, 
      rgba(255, 255, 255, 0.3) 100%);
    transform: scaleY(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom;
  }

  .mobile-nav-item::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
      rgba(255, 255, 255, 0.03) 0%, 
      transparent 100%);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-nav-item:hover {
    color: #ffffff;
    padding-left: 32px;
    background: rgba(255, 255, 255, 0.02);
  }

  .mobile-nav-item:hover::before {
    transform: scaleY(1);
    transform-origin: top;
  }

  .mobile-nav-item:hover::after {
    transform: translateX(0);
  }

  /* Active state */
  .mobile-nav-item.active {
    color: #ffffff;
    background: linear-gradient(90deg, 
      rgba(255, 255, 255, 0.06) 0%, 
      rgba(255, 255, 255, 0.02) 100%);
    font-weight: 400;
    border-left-color: rgba(255, 255, 255, 0.6);
    padding-left: 32px;
  }

  .mobile-nav-item.active::before {
    transform: scaleY(1);
  }

  /* ============================================================
     PREMIUM SIDEBAR FOOTER
     ============================================================ */
  .mobile-sidebar-footer {
    padding: 24px;
    margin-top: auto;
    background: linear-gradient(180deg, 
      transparent 0%, 
      rgba(8, 8, 8, 0.8) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
  }

  /* Premium Search */
  .mobile-search-wrapper {
    margin-bottom: 20px;
    position: relative;
  }

  .mobile-search-wrapper::before {
    content: '⌕';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 18px;
    pointer-events: none;
  }

  .mobile-search-input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 300;
    letter-spacing: 0.5px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-search-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 300;
  }

  .mobile-search-input:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }

  /* ============================================================
     STATUS INDICATOR — mobile version (mirrors desktop style)
     ============================================================ */

  /* Wrapper с hover-триггером — такой же как .status-wrapper на desktop */
  .mobile-status-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease;
  }

  .mobile-status-wrapper:has(.mobile-status-popup.open) {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.09);
  }

  /* Toggle button — сброс кнопочных стилей */
  .mobile-status-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
  }

  /* Индикатор — точная копия .status-indicator с desktop */
  .mobile-status-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid #888888;
    position: relative;
    flex-shrink: 0;
    animation: mobile-pulse 2s infinite;
  }

  @keyframes mobile-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3); }
    50%  { box-shadow: 0 0 8px 4px rgba(255, 255, 255, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3); }
  }

  /* Метка рядом с индикатором */
  .mobile-status-label {
    font-size: 12px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.45);
    letter-spacing: 0.5px;
    flex: 1;
  }

  /* Стрелка-подсказка что есть popup */
  .mobile-status-caret {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
    user-select: none;
  }

  .mobile-status-toggle[aria-expanded="true"] .mobile-status-caret {
    transform: rotate(180deg);
    color: rgba(255, 255, 255, 0.5);
  }

  /* Popup — адаптирован из .status-popup на desktop */
  .mobile-status-popup {
    position: absolute;
    bottom: calc(100% + 8px); /* открывается вверх, чтобы не уходить за экран */
    left: 0;
    right: 0;
    background-color: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 14px 16px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10002;
  }

  .mobile-status-wrapper .mobile-status-popup.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .mobile-status-popup h4 {
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.3px;
  }

  /* Строки статуса — идентичны .status-line на desktop */
  .mobile-status-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    font-size: 12px;
    color: #d0d0d0;
    font-weight: 300;
  }

  /* Цветные точки — идентичны .dot на desktop */
  .mobile-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .mobile-dot.green  { background: #2ecc71; opacity: 0.9; }
  .mobile-dot.orange { background: #f39c12; opacity: 0.8; }
  .mobile-dot.red    { background: #e74c3c; opacity: 0.8; }

  /* IP и гео */
  .mobile-user-ip {
    margin-top: 6px;
    font-size: 11px;
    color: #aaaaaa;
    font-weight: 300;
  }

  .mobile-user-location {
    font-size: 11px;
    color: #888888;
    margin-top: 2px;
    font-weight: 300;
  }

  .mobile-status-desc {
    font-size: 11px;
    line-height: 1.5;
    color: #666666;
    margin-top: 8px;
    font-weight: 300;
  }

  .mobile-status-popup hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 10px 0;
  }

  /* Ссылки в popup */
  .mobile-status-links {
    display: flex;
    gap: 12px;
    margin-top: 6px;
    flex-wrap: wrap;
  }

  .mobile-status-links a {
    font-size: 11px;
    color: #d0d0d0;
    font-weight: 300;
    letter-spacing: 0.3px;
    transition: color 0.2s ease;
  }

  .mobile-status-links a:hover {
    color: #ffffff;
    text-decoration: underline;
  }

  /* Цвета главного индикатора — наследуют от desktop */
  .mobile-status-indicator.status-green  { background-color: #2ecc71; opacity: 0.9; }
  .mobile-status-indicator.status-orange { background-color: #f39c12; opacity: 0.8; }
  .mobile-status-indicator.status-red    { background-color: #e74c3c; opacity: 0.8; }

  /* ============================================================
     PREMIUM OVERLAY
     ============================================================ */
  .mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
      circle at top left,
      rgba(0, 0, 0, 0.75) 0%,
      rgba(0, 0, 0, 0.85) 100%
    );
    backdrop-filter: blur(8px) saturate(120%);
    -webkit-backdrop-filter: blur(8px) saturate(120%);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-overlay.active {
    display: block !important;
    opacity: 1;
  }

  /* ============================================================
     STAGGERED ANIMATION ON OPEN
     ============================================================ */
  .mobile-sidebar.active .mobile-nav-item {
    animation: slideInFade 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
  }

  .mobile-sidebar.active .mobile-nav-item:nth-child(1) {
    animation-delay: 0.1s;
  }

  .mobile-sidebar.active .mobile-nav-item:nth-child(2) {
    animation-delay: 0.15s;
  }

  .mobile-sidebar.active .mobile-nav-item:nth-child(3) {
    animation-delay: 0.2s;
  }

  .mobile-sidebar.active .mobile-nav-item:nth-child(4) {
    animation-delay: 0.25s;
  }

  .mobile-sidebar.active .mobile-nav-item:nth-child(5) {
    animation-delay: 0.3s;
  }

  @keyframes slideInFade {
    from {
      opacity: 0;
      transform: translateX(-20px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  /* ============================================================
     BODY SCROLL LOCK
     ============================================================ */
  body.menu-open {
    overflow: hidden;
  }

  /* ============================================================
     RESPONSIVE REFINEMENTS
     ============================================================ */
  @media (max-width: 480px) {
    .mobile-header {
      height: 64px;
      padding: 0 20px;
    }

    body {
      padding-top: 64px !important;
    }

    .mobile-logo {
      font-size: 17px;
      letter-spacing: 2.5px;
    }

    .mobile-sidebar {
      width: 100%;
      max-width: 340px;
    }

    .mobile-nav-item {
      padding: 16px 20px 16px 24px;
      font-size: 14px;
    }

    .mobile-nav-item:hover,
    .mobile-nav-item.active {
      padding-left: 28px;
    }
  }

  @media (max-width: 360px) {
    .mobile-sidebar {
      width: 100%;
      max-width: 100%;
    }
  }
}