/* /home/vserver/Documents/project/dodohelper-crm/static/css/mobile-nav.css */

/* =========================
   MOBILE NAVIGATION
   ========================= */

/* Базовые переменные */
:root {
  --mobile-header-height: 60px;
  --mobile-bottom-nav-height: 70px;
  --drawer-width: 280px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* По умолчанию скрываем мобильные элементы */
.mobile-header,
.mobile-bottom-nav,
.mobile-drawer,
.drawer-overlay,
.user-popup {
  display: none;
}

/* Мобильная версия */
@media (max-width: 768px) {
  /* Скрываем десктопные элементы */
  .dh-desktop-only,
  .dh-topbar,
  .dh-leftnav {
    display: none !important;
  }

  /* Показываем мобильные элементы */
  .mobile-header {
    display: flex !important;
  }

  .mobile-bottom-nav {
    display: block !important;
  }

  /* Корректировка основного контента */
  .app-wrapper {
    padding-top: var(--mobile-header-height) !important;
    padding-bottom: var(--mobile-bottom-nav-height) !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

/* ===== Верхний заголовок ===== */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--mobile-header-height);
  background: var(--dh-glass-1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--dh-stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 2000;
  box-shadow: var(--dh-shadow);
}

.mobile-menu-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--dh-text);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.2s;
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle:active {
  background: var(--dh-glass-2);
}

.mobile-header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dh-text);
  flex: 1;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 8px;
}

.mobile-user-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dh-brand-1), var(--dh-brand-2));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===== Нижнее меню ===== */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--dh-glass-1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--dh-stroke);
  z-index: 2000;
  padding: 8px 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
}

.nav-scroll-container {
  display: flex;
  overflow-x: auto;
  gap: 4px;
  padding: 0 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.nav-scroll-container::-webkit-scrollbar {
  display: none;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 12px;
  min-width: 56px;
  flex-shrink: 0;
  color: var(--dh-muted);
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  border: 1px solid transparent;
}

.nav-item i {
  font-size: 20px;
}

.nav-item span {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.nav-item.active {
  color: var(--dh-brand-1);
  background: color-mix(in srgb, var(--dh-brand-1) 10%, transparent);
  border-color: color-mix(in srgb, var(--dh-brand-1) 20%, transparent);
}

.nav-item.active i {
  transform: scale(1.1);
}

.nav-badge {
  position: absolute;
  top: 2px;
  right: 6px;
  background: var(--accent-danger);
  color: white;
  border-radius: 12px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  text-align: center;
  border: 2px solid var(--bg-primary);
}

/* ===== Левое выезжающее меню ===== */
.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--drawer-width);
  background: var(--dh-glass-1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-right: 1px solid var(--dh-stroke);
  z-index: 3000;
  transform: translateX(-100%);
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
}

.mobile-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  height: var(--mobile-header-height);
  padding: 0 20px;
  border-bottom: 1px solid var(--dh-stroke);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--dh-text);
}

.drawer-close {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--dh-text);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.drawer-close:hover,
.drawer-close:active {
  background: var(--dh-glass-2);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
}

.drawer-loading {
  text-align: center;
  color: var(--dh-muted);
  padding: 40px 0;
}

.drawer-section {
  margin-bottom: 24px;
}

.drawer-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--dh-muted);
  padding: 0 20px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--dh-text);
  text-decoration: none;
  transition: background 0.2s;
  border-left: 3px solid transparent;
}

.drawer-item i {
  width: 20px;
  font-size: 16px;
  color: var(--dh-muted);
}

.drawer-item span {
  font-size: 15px;
  font-weight: 500;
}

.drawer-item.active {
  background: color-mix(in srgb, var(--dh-brand-1) 8%, transparent);
  border-left-color: var(--dh-brand-1);
}

.drawer-item.active i {
  color: var(--dh-brand-1);
}

.drawer-item:hover,
.drawer-item:active {
  background: color-mix(in srgb, var(--dh-glass-2) 70%, transparent);
}

.drawer-divider {
  height: 1px;
  background: var(--dh-stroke);
  margin: 16px 0;
}

.drawer-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--dh-stroke);
  display: flex;
  gap: 12px;
}

.drawer-theme,
.drawer-logout {
  flex: 1;
  height: 44px;
  border: 1px solid var(--dh-stroke);
  background: transparent;
  border-radius: 10px;
  color: var(--dh-text);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.drawer-theme:hover,
.drawer-logout:hover {
  background: var(--dh-glass-2);
}

.drawer-logout {
  color: var(--accent-danger);
}

.drawer-logout:hover {
  background: color-mix(in srgb, var(--accent-danger) 10%, transparent);
}

/* ===== Оверлей ===== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2500;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition);
}

.drawer-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ===== Попап пользователя ===== */
.user-popup {
  position: fixed;
  top: calc(var(--mobile-header-height) + 8px);
  right: 16px;
  width: 280px;
  background: var(--dh-glass-1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--dh-stroke);
  border-radius: 16px;
  box-shadow: var(--dh-shadow);
  z-index: 3500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.user-popup.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-popup-header {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--dh-stroke);
}

.user-popup-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--dh-brand-1), var(--dh-brand-2));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
}

.user-popup-info {
  flex: 1;
  min-width: 0;
}

.user-popup-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--dh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.user-popup-email {
  font-size: 13px;
  color: var(--dh-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-popup-menu {
  padding: 8px;
}

.user-popup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  color: var(--dh-text);
  text-decoration: none;
  border-radius: 10px;
  transition: background 0.2s;
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
}

.user-popup-item i {
  width: 20px;
  font-size: 16px;
  color: var(--dh-muted);
}

.user-popup-item:hover,
.user-popup-item:active {
  background: var(--dh-glass-2);
}

.user-popup-item.logout {
  color: var(--accent-danger);
}

.user-popup-item.logout i {
  color: var(--accent-danger);
}

.user-popup-divider {
  height: 1px;
  background: var(--dh-stroke);
  margin: 8px;
}

/* ===== Анимации ===== */
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Блокировка скролла */
body.drawer-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
  touch-action: none;
}