/* ============================================
   MOBILE HEADER — Современный мобильный хедер
   ============================================ */

/* === ПЕРЕМЕННЫЕ === */
:root {
  --mobile-header-bg: #1a1f2e;
  --mobile-header-top-height: 56px;
  --mobile-tab-bar-height: 64px;
  --mobile-drawer-width: 85vw;
  --mobile-drawer-max-width: 360px;
  --mobile-accent: #298CFF;
  --mobile-accent-glow: rgba(41, 140, 255, 0.35);
  --mobile-surface: #242d40;
  --mobile-surface-hover: #2d3750;
  --mobile-text: #ffffff;
  --mobile-text-secondary: #8892a8;
  --mobile-border: rgba(41, 140, 255, 0.15);
  --mobile-danger: #ff4757;
  --mobile-success: #2ed573;
  --mobile-warning: #ffa502;
  --mobile-radius: 14px;
  --mobile-radius-sm: 10px;
  --mobile-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --mobile-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === ОСНОВНОЙ КОНТЕЙНЕР === */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--mobile-header-top-height) + var(--mobile-tab-bar-height));
  z-index: 9999;
  display: none; /* Показываем только на мобильных через media query */
  flex-direction: column;
  pointer-events: none;
  bottom: auto;
}

/* === ВЕРХНЯЯ ПАНЕЛЬ === */
.mobile-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--mobile-header-top-height);
  padding: 0 16px;
  background: linear-gradient(180deg, #23293b 0%, #1e2435 100%);
  border-bottom: 1px solid var(--mobile-border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* === БУРГЕР КНОПКА === */
.burger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--mobile-radius-sm);
  transition: background var(--mobile-transition);
  -webkit-tap-highlight-color: transparent;
}

.burger-btn:active {
  background: var(--mobile-surface);
}

.burger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--mobile-text);
  border-radius: 2px;
  transition: all var(--mobile-transition);
  transform-origin: center;
}

.burger-btn.active .burger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger-btn.active .burger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.burger-btn.active .burger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* === МОБИЛЬНОЕ ЛОГО === */
.mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.mobile-logo-icon {
  flex-shrink: 0;
  transition: transform var(--mobile-bounce);
}

.mobile-logo:active .mobile-logo-icon {
  transform: scale(0.9) rotate(-8deg);
}

.mobile-logo-text {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* === КНОПКА ПОИСКА === */
.mobile-search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  color: var(--mobile-text-secondary);
  cursor: pointer;
  border-radius: var(--mobile-radius-sm);
  transition: all var(--mobile-transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-search-toggle:active {
  background: var(--mobile-surface);
  color: var(--mobile-accent);
}

/* === ПОИСКОВАЯ СТРОКА === */
.mobile-search-bar {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0 16px;
  background: linear-gradient(180deg, #1e2435 0%, #1a1f2e 100%);
}

.mobile-search-bar.open {
  max-height: 64px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--mobile-border);
}

.mobile-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-search-form input {
  flex: 1;
  height: 42px;
  padding: 0 16px;
  background: var(--mobile-surface);
  border: 1px solid var(--mobile-border);
  border-radius: 12px;
  color: var(--mobile-text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--mobile-transition);
}

.mobile-search-form input:focus {
  border-color: var(--mobile-accent);
  box-shadow: 0 0 0 3px var(--mobile-accent-glow);
}

.mobile-search-form input::placeholder {
  color: var(--mobile-text-secondary);
}

.mobile-search-form button[type="submit"] {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--mobile-accent);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: transform var(--mobile-bounce), background var(--mobile-transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-search-form button[type="submit"]:active {
  transform: scale(0.92);
}

.mobile-search-cancel {
  height: 42px;
  padding: 0 14px;
  background: none;
  border: 1px solid var(--mobile-border);
  border-radius: 12px;
  color: var(--mobile-text-secondary);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--mobile-transition);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.mobile-search-cancel:active {
  background: var(--mobile-surface);
  color: var(--mobile-text);
}

/* === НИЖНИЙ ТАБ-БАР === */
.mobile-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--mobile-tab-bar-height);
  background: var(--mobile-header-bg);
  border-top: 1px solid var(--mobile-border);
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  position: relative;
}

/* Градиент сверху таб-бара для плавного перехода */
.mobile-tab-bar::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(180deg, transparent, var(--mobile-header-bg));
  pointer-events: none;
}

.mobile-tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1;
  max-width: 80px;
  padding: 8px 4px;
  text-decoration: none;
  color: var(--mobile-text-secondary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-radius: var(--mobile-radius-sm);
  transition: all var(--mobile-transition);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.mobile-tab-item svg {
  transition: transform var(--mobile-bounce), color var(--mobile-transition);
}

.mobile-tab-item:active {
  transform: scale(0.9);
}

.mobile-tab-item.active {
  color: var(--mobile-accent);
}

.mobile-tab-item.active svg {
  transform: translateY(-1px);
  filter: drop-shadow(0 2px 8px var(--mobile-accent-glow));
}

/* Бейджи на таб-элементах */
.mobile-tab-badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(14px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: white;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: translateX(14px) scale(1); }
  50% { transform: translateX(14px) scale(1.1); }
}

/* Кнопка уведомлений в таб-баре */
.mobile-notif-tab-btn {
  cursor: pointer;
}

/* Кнопка уведомлений */
.mobile-notif-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-60%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--mobile-text-secondary);
  border-radius: 50%;
  transition: all var(--mobile-transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-notif-btn:active {
  background: var(--mobile-surface);
  color: var(--mobile-accent);
}

/* === МОБИЛЬНЫЙ ДРОПДАУН УВЕДОМЛЕНИЙ === */
.mobile-notif-dropdown {
  position: fixed;
  top: var(--mobile-header-top-height);
  left: 12px;
  right: 12px;
  max-height: 70vh;
  background: var(--mobile-surface);
  border: 1px solid var(--mobile-border);
  border-radius: var(--mobile-radius);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.96);
  transform-origin: top center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  pointer-events: none;
}

.mobile-notif-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mobile-notif-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--mobile-border);
  flex-shrink: 0;
}

.mobile-notif-dropdown-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--mobile-text);
}

.mobile-notif-dropdown-close {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  background: var(--mobile-surface-hover);
  border: none;
  border-radius: 50%;
  color: var(--mobile-text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--mobile-transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-notif-dropdown-close:active {
  background: var(--mobile-accent);
  color: white;
  transform: scale(0.9);
}

.mobile-notif-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  -webkit-overflow-scrolling: touch;
}

.mobile-notif-dropdown-actions {
  padding: 12px 16px;
  border-top: 1px solid var(--mobile-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.mobile-notif-action-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--mobile-surface-hover);
  border: 1px solid var(--mobile-border);
  border-radius: var(--mobile-radius-sm);
  color: var(--mobile-text-secondary);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--mobile-transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-notif-action-btn:active {
  background: var(--mobile-accent);
  color: white;
  border-color: var(--mobile-accent);
  transform: scale(0.98);
}

/* Зелёная кнопка "Отметить все как прочитанные" */
.mobile-notif-action-btn.mark-all-read {
  background: rgba(76, 217, 100, 0.13) !important;
  border: 1px solid rgba(76, 217, 100, 0.33) !important;
  color: #7CFFB2 !important;
}

.mobile-notif-action-btn.mark-all-read:active {
  background: rgba(76, 217, 100, 0.27) !important;
  color: #fff !important;
  border-color: rgba(76, 217, 100, 0.5) !important;
}

/* Красная кнопка "Удалить всё" */
.mobile-notif-delete-all {
  background: rgba(255, 71, 87, 0.13) !important;
  border: 1px solid rgba(255, 71, 87, 0.33) !important;
  color: #ff8080 !important;
}

.mobile-notif-delete-all:active {
  background: rgba(255, 71, 87, 0.27) !important;
  color: #fff !important;
  border-color: rgba(255, 71, 87, 0.5) !important;
}

/* === БОКОВОЕ МЕНЮ (DRAWER) === */
.mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--mobile-transition);
  z-index: 10001;
  pointer-events: none;
}

.mobile-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--mobile-drawer-width);
  max-width: var(--mobile-drawer-max-width);
  background: var(--mobile-header-bg);
  z-index: 10002;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 4px 0 40px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.mobile-drawer.open {
  pointer-events: auto;
}

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

/* Свайп для закрытия */
.mobile-drawer.swiping {
  transition: none;
}

/* Шапка drawer */
.mobile-drawer-header {
  padding: 20px 20px 16px;
  background: linear-gradient(180deg, #23293b 0%, transparent 100%);
  position: relative;
}

.mobile-drawer-user {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
}

.mobile-drawer-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--mobile-accent);
  box-shadow: 0 0 16px var(--mobile-accent-glow);
}

.mobile-drawer-user-info {
  flex: 1;
}

.mobile-drawer-username {
  font-size: 17px;
  font-weight: 700;
  color: var(--mobile-text);
  margin-bottom: 2px;
}

.mobile-drawer-balance {
  font-size: 14px;
  font-weight: 600;
  color: var(--mobile-accent);
  display: flex;
  align-items: center;
  gap: 4px;
}

.mobile-drawer-balance::before {
  content: '';
  width: 14px;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23298CFF'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6v12M8 10h8M8 14h8' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

.mobile-drawer-guest {
  text-align: center;
  padding: 8px 0;
}

.mobile-drawer-guest-text {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.mobile-drawer-guest-sub {
  font-size: 13px;
  color: var(--mobile-text-secondary);
}

.mobile-drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  background: var(--mobile-surface);
  border: none;
  border-radius: 50%;
  color: var(--mobile-text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--mobile-transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-close:active {
  background: var(--mobile-surface-hover);
  color: var(--mobile-text);
  transform: scale(0.9);
}

/* Навигация drawer */
.mobile-drawer-nav {
  flex: 1;
  padding: 8px 12px;
}

.mobile-drawer-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--mobile-text);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--mobile-radius-sm);
  transition: all var(--mobile-transition);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.mobile-drawer-link svg {
  flex-shrink: 0;
  color: var(--mobile-text-secondary);
  transition: color var(--mobile-transition);
}

.mobile-drawer-link:active {
  background: var(--mobile-surface);
  transform: scale(0.98);
}

.mobile-drawer-link:active svg {
  color: var(--mobile-accent);
}

.mobile-drawer-link--accent {
  justify-content: center;
  background: var(--mobile-accent);
  color: white;
  font-weight: 700;
  margin: 4px 0;
}

.mobile-drawer-link--accent svg {
  color: white;
}

.mobile-drawer-link--accent:active {
  background: #2173d4;
}

.mobile-drawer-count-badge {
  margin-left: auto;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: linear-gradient(135deg, #ff4757, #ff6b81);
  color: white;
  font-size: 12px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
  border-radius: 11px;
  box-shadow: 0 2px 8px rgba(255, 71, 87, 0.35);
}

.mobile-drawer-separator {
  height: 1px;
  background: var(--mobile-border);
  margin: 8px 16px;
}

.mobile-drawer-admin {
  color: #ffe978;
}

.mobile-drawer-admin svg {
  color: #ffe978;
}

.mobile-drawer-balance-link {
  color: var(--mobile-success);
}

.mobile-drawer-balance-link svg {
  color: var(--mobile-success);
}

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

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

/* Футер drawer */
.mobile-drawer-footer {
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid var(--mobile-border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-drawer-footer-link {
  font-size: 12px;
  color: var(--mobile-text-secondary);
  text-decoration: none;
  transition: color var(--mobile-transition);
}

.mobile-drawer-footer-link:active {
  color: var(--mobile-accent);
}

/* === ПРОФИЛЬ ДРОПДАУН === */
.mobile-profile-dropdown {
  position: fixed;
  bottom: var(--mobile-tab-bar-height);
  left: 12px;
  right: 12px;
  background: var(--mobile-surface);
  border: 1px solid var(--mobile-border);
  border-radius: var(--mobile-radius);
  padding: 16px;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.96);
  transform-origin: bottom center;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.3);
  max-height: 60vh;
  overflow-y: auto;
  pointer-events: none;
}

.mobile-profile-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mobile-profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--mobile-border);
}

.mobile-profile-dropdown-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--mobile-accent);
}

.mobile-profile-dropdown-username {
  font-size: 16px;
  font-weight: 700;
}

.mobile-profile-dropdown-balance {
  font-size: 13px;
  color: var(--mobile-accent);
  font-weight: 600;
}

.mobile-profile-dropdown-link {
  display: block;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--mobile-text);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--mobile-radius-sm);
  transition: all var(--mobile-transition);
  -webkit-tap-highlight-color: transparent;
}

.mobile-profile-dropdown-link:active {
  background: var(--mobile-surface-hover);
  transform: scale(0.98);
}

.mobile-profile-dropdown-admin {
  color: #ffe978;
}

.mobile-profile-dropdown-logout {
  color: var(--mobile-danger);
  font-weight: 600;
}

.mobile-profile-dropdown-separator {
  height: 1px;
  background: var(--mobile-border);
  margin: 6px 0;
}

/* === ANIMATIONS === */
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* === ДОСТУПНОСТЬ === */
@media (prefers-reduced-motion: reduce) {
  .mobile-header *,
  .mobile-header *::before,
  .mobile-header *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
