/* Global mobile adaptation for whole engine */

/* Desktop (≥992px): мобильная шапка с полосой ссылок только для телефона */
@media (min-width: 992px) {
  #kt_header_mobile {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  .container,
  .container-fluid {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .card {
    border-radius: 12px !important;
  }

  .card-body,
  .card-spacer {
    padding: 1rem !important;
  }

  .btn-group {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .btn-group .btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .modal-dialog {
    margin: 0.75rem;
  }
}

@media (max-width: 767.98px) {
  body {
    font-size: 14px;
  }

  .content {
    padding-top: 0.5rem !important;
  }

  .font-size-h1,
  .font-size-h2,
  .font-size-h3 {
    line-height: 1.2;
  }

  .font-size-h3 {
    font-size: 1.35rem !important;
  }

  .font-size-h4 {
    font-size: 1.1rem !important;
  }

  .font-size-h5,
  .font-size-h6 {
    font-size: 1rem !important;
  }

  .table-responsive {
    border: 1px solid #ebedf3;
    border-radius: 10px;
    overflow: auto;
  }

  .table td,
  .table th {
    white-space: nowrap;
  }

  /* auth pages */
  .login .form.w-xxl-550px {
    width: 100% !important;
    padding: 1rem !important;
  }

  .login .col-lg-6.d-flex.align-items-center {
    padding-left: 0;
    padding-right: 0;
  }

  .login .login-footer .container {
    text-align: center;
    gap: 4px;
  }
}

/* Metronic mobile: .topbar uses position:fixed + low z-index and can steal taps / cover content. Force normal flow on phones. */

@media (max-width: 991.98px) {
  /* Hamburger bar must stay above page content */
  #kt_header_mobile {
    z-index: 1005 !important;
  }

  /* Гамбургер убран — кнопка может отсутствовать в разметке */

  #kt_header .container-fluid .topbar,
  #kt_header .container .topbar {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    justify-content: flex-end !important;
    z-index: 2 !important;
  }

  .header-mobile-fixed .topbar {
    position: relative !important;
    margin-top: 0 !important;
  }

  /* Выпадающее меню Metronic на телефоне скрыто — навигация в #kt_header_mobile .mobile-static-nav */
  #kt_header_menu_wrapper {
    display: none !important;
  }

  /* Отступ контента: фикс. шапка + полоса ссылок */
  body.header-mobile-fixed #kt_wrapper {
    padding-top: calc(56px + var(--mobile-nav-strip-height, 52px)) !important;
  }

  #kt_header_mobile.mobile-header-user {
    min-height: auto !important;
    height: auto !important;
    justify-content: flex-start !important;
  }

  /* Полоса ссылок (вторая строка в зелёной шапке) */
  #kt_header_mobile .mobile-static-nav {
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  }

  #kt_header_mobile .mobile-static-nav__scroll {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 8px 8px;
    scrollbar-width: thin;
  }

  #kt_header_mobile .mobile-static-nav__link {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 6px 8px;
    border-radius: 999px;
    color: #1b283f !important;
    background: #f3f6f9;
    border: 1px solid #ebedf3;
    text-decoration: none !important;
    transition: background 0.15s ease, color 0.15s ease;
  }

  #kt_header_mobile .mobile-static-nav__link i {
    font-size: 0.75rem;
    opacity: 0.85;
  }

  #kt_header_mobile .mobile-static-nav__link.is-active {
    background: rgba(11, 183, 131, 0.18);
    border-color: rgba(11, 183, 131, 0.45);
    color: #0a7a5a !important;
  }

  #kt_header_mobile .mobile-static-nav__link--accent {
    background: rgba(137, 80, 252, 0.12);
    border-color: rgba(137, 80, 252, 0.35);
    color: #5b2fc9 !important;
  }

  #kt_header_mobile .mobile-static-nav__link--danger {
    background: rgba(246, 78, 96, 0.1);
    border-color: rgba(246, 78, 96, 0.35);
    color: #c82333 !important;
  }

  .mobile-header-user__btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
