/* Logistics Dashboard Styles */
.logistics-layout {
  display: flex;
  height: 100vh;
  background-color: #f8f9fa;
  font-family: 'Inter', sans-serif;
}

.logistics-sidebar {
  width: 260px;
  background-color: #1a202c;
  color: white;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar-header {
  padding: 0 20px 30px;
  text-align: center;
}

.sidebar-header .logo {
  height: 40px;
  margin-bottom: 10px;
}

.sidebar-nav {
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: #a0aec0;
  text-decoration: none;
  transition: all 0.3s;
}

.nav-item:hover, .nav-item.active {
  background-color: #2d3748;
  color: white;
}

.nav-item i {
  margin-right: 12px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid #2d3748;
}

.user-info {
  margin-bottom: 15px;
}

.user-name {
  display: block;
  font-weight: bold;
}

.user-role {
  font-size: 0.8rem;
  color: #a0aec0;
}

.logout-btn {
  width: 100%;
  padding: 10px;
  background-color: #e53e3e;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.logistics-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.logistics-header {
  height: 70px;
  background-color: white;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #48bb78;
}

.logistics-content {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
}

/* Dashboard Specifics */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.stat-card .label {
  display: block;
  color: #718096;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: bold;
  color: #2d3748;
}

.orders-list {
  display: grid;
  gap: 15px;
}

.order-card {
  background: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.order-number {
  font-weight: bold;
  color: #3182ce;
}

.assign-btn {
  padding: 10px 20px;
  background-color: #3182ce;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

/*
 * Оверлей модалки логистики (#courier-modal). Не трогать глобальный .modal —
 * иначе z-index:1000 оказывается ниже Bootstrap .modal-backdrop (1050), и любые
 * Bootstrap .modal.fade (телефон после Google, support, админка) уходят под пленку.
 */
#courier-modal.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#courier-modal.modal.hidden {
  display: none;
}

#courier-modal .modal-content {
  background: white;
  width: 500px;
  max-height: 80vh;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#courier-modal .modal-header {
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.couriers-list {
  padding: 20px;
  overflow-y: auto;
}

.courier-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #f7fafc;
}

.courier-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.online .status-dot { background-color: #48bb78; }
.offline .status-dot { background-color: #a0aec0; }
.offline { opacity: 0.6; }

.select-btn {
  padding: 5px 15px;
  background-color: #48bb78;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.select-btn:disabled {
  background-color: #a0aec0;
  cursor: not-allowed;
}

/* Login Page */
.logistics-login-container {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f7fafc;
}

.login-box {
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h2 {
  margin: 15px 0 5px;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.login-form input {
  width: 100%;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
}

.login-form .submit-btn {
  width: 100%;
  padding: 12px;
  background-color: #3182ce;
  color: white;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}

.error-message {
  color: #e53e3e;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.hidden { display: none; }

/*
 * Фикс только лого + поиск; фиолетовая полоса (.header-top) в потоке и уезжает при скролле.
 * top у .kerben-fixed-header-shell задаётся в layout.js под нижний край .header-top.
 * position:sticky на body{display:flex} часто не срабатывает — fixed + спейсер в потоке.
 */
.kerben-fixed-header-spacer {
  width: 100%;
  flex-shrink: 0;
  pointer-events: none;
}

.kerben-fixed-header-shell {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Kerben: шапка — мобильный столбец (лого и поиск по центру); md+ — поиск по центру шапки (1fr | поиск | 1fr) */
.kerben-header-main {
  display: grid;
  width: 100%;
  align-items: center;
  gap: 12px;
}

@media (max-width: 767.98px) {
  .kerben-header-main {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .kerben-header-logo-cell {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .kerben-header-logo-link {
    justify-content: center !important;
  }

  .kerben-header-search-cell {
    width: 100%;
    max-width: 420px;
    padding: 0 12px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .kerben-header-search-row {
    max-width: 100%;
  }

}

@media (min-width: 768px) {
  .kerben-header-main {
    grid-template-columns: 1fr minmax(0, 600px) 1fr;
    gap: 16px 24px;
  }

  .kerben-header-logo-cell {
    justify-self: start;
  }

  .kerben-header-search-cell {
    grid-column: 2;
    justify-self: stretch;
    width: 100%;
    max-width: 600px;
  }

  .kerben-header-search-wrap {
    width: 100%;
    justify-content: center;
  }

  .kerben-header-actions {
    grid-column: 3;
    justify-self: end;
  }
}

/* Строка поиска в шапке: на мобильном скругление как у карточки, на md+ — «пилюля» */
.kerben-search-bar-inner {
  border-radius: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.kerben-search-bar-inner:focus-within {
  border-color: hsl(var(--main) / 0.35) !important;
  box-shadow: 0 4px 12px rgba(18, 74, 60, 0.08);
}

@media (min-width: 768px) {
  .kerben-search-bar-inner {
    border-radius: 999px;
  }
}

@media (max-width: 400px) {
  .kerben-header-logo-img {
    max-width: 108px !important;
    height: 36px !important;
  }
}

/* Плавающее нижнее меню (мобильный веб), как в приложении Flutter */
.kerben-mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1050;
  padding: 0 16px 12px;
  pointer-events: none;
  background: transparent;
  border: none;
  box-shadow: none;
}

.kerben-mobile-bottom-nav__pill {
  pointer-events: auto;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 2px;
  background: #fff;
  border-radius: 20px;
  padding: 10px 6px 12px;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.1),
    0 4px 12px rgba(0, 0, 0, 0.06);
  max-width: 100%;
}

/* Палитра нижнего меню (Kerben): #3F0071 тёмный, #B983FF средний, #E1C1FF активный фон, #F2E7FF hover */
.kerben-mobile-nav-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 6px 4px 8px;
  margin: 0 1px;
  text-decoration: none;
  color: #9e9e9e;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.15;
  border-radius: 14px;
  transition: color 0.2s ease, background 0.2s ease;
}

.kerben-mobile-nav-item:hover:not(.active),
.kerben-mobile-nav-item:focus-visible:not(.active) {
  background: #f2e7ff;
  color: #3f0071;
  text-decoration: none;
}

.kerben-mobile-nav-item.active {
  background: #e1c1ff;
  color: #3f0071;
  font-weight: 700;
  border-radius: 14px;
}

.kerben-mobile-nav-item.active:hover,
.kerben-mobile-nav-item.active:focus-visible {
  background: #e1c1ff;
  color: #3f0071;
  text-decoration: none;
}

.kerben-mobile-nav-item.active .kerben-mobile-nav-item__icon {
  color: #3f0071;
}

.kerben-mobile-nav-item__icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
}

.kerben-mobile-nav-item__icon {
  font-size: 1.35rem;
  line-height: 1;
  color: inherit;
}

.kerben-mobile-nav-item__label {
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kerben-mobile-nav-badge {
  position: absolute;
  top: -4px;
  right: 50%;
  transform: translateX(calc(50% + 10px));
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  padding: 0 4px;
  line-height: 1.4;
}

.kerben-mobile-nav-item .cart-badge {
  background: hsl(var(--main)) !important;
  color: #fff !important;
}

.kerben-mobile-nav-item .wishlist-badge {
  background: #dc3545 !important;
  color: #fff !important;
}

@media (max-width: 991.98px) {
  main#app {
    padding-bottom: 88px;
  }
}

/* ========== Профиль: боковое меню (белый фон; без тёмных плашек; активный — светлая пилюля #F3E5F5 + #3F0071) ========== */
.kerben-profile-sidebar {
  background: #fff !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

.kerben-profile-sidebar .text-gray-600 {
  color: #6c757d !important;
}

.kerben-profile-sidebar .bg-gray-100 {
  background-color: #e8fcf1 !important;
  color: #0f251f !important;
}

.kerben-profile-sidebar #profile-tabs {
  --kerben-profile-menu-fg: #0f251f;
  --kerben-profile-menu-active-bg: #e8fcf1;
  --kerben-profile-menu-hover-bg: #d1fae5;
  --kerben-profile-menu-glow: 232, 252, 241; /* #E8FCF1 — свечение активного пункта */
  /* Перебиваем Bootstrap nav-pills, чтобы не подмешивались primary/тёмные активные цвета */
  --bs-nav-pills-link-active-bg: #e8fcf1;
  --bs-nav-pills-link-active-color: #0f251f;
}

.kerben-profile-sidebar #profile-tabs .nav-item {
  background: transparent !important;
  box-shadow: none !important;
}

.kerben-profile-sidebar #profile-tabs .nav-item .nav-link {
  color: var(--kerben-profile-menu-fg) !important;
  background-color: transparent !important;
  border: 0 !important;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.kerben-profile-sidebar #profile-tabs .nav-item .nav-link i {
  color: inherit !important;
}

.kerben-profile-sidebar #profile-tabs .nav-item .nav-link:hover:not(.active):not(.text-danger):not(.opacity-50) {
  background-color: var(--kerben-profile-menu-hover-bg) !important;
  color: var(--kerben-profile-menu-fg) !important;
}

.kerben-profile-sidebar #profile-tabs .nav-item .nav-link:focus {
  box-shadow: none;
}

.kerben-profile-sidebar #profile-tabs .nav-item .nav-link:focus-visible:not(.text-danger):not(.opacity-50) {
  outline: 2px solid #00bf63;
  outline-offset: 2px;
}

.kerben-profile-sidebar #profile-tabs .nav-item button.nav-link.active,
.kerben-profile-sidebar #profile-tabs .nav-item .nav-link.active {
  background-color: var(--kerben-profile-menu-active-bg) !important;
  color: var(--kerben-profile-menu-fg) !important;
  font-weight: 700;
  box-shadow:
    0 4px 18px rgba(var(--kerben-profile-menu-glow), 0.95),
    0 10px 32px rgba(var(--kerben-profile-menu-glow), 0.55),
    0 0 0 1px rgba(var(--kerben-profile-menu-glow), 0.85);
}

.kerben-profile-sidebar #profile-tabs .nav-item button.nav-link.active:active,
.kerben-profile-sidebar #profile-tabs .nav-item .nav-link.active:active {
  background-color: var(--kerben-profile-menu-active-bg) !important;
  color: var(--kerben-profile-menu-fg) !important;
}

.kerben-profile-sidebar #profile-tabs .nav-item button.nav-link.active i,
.kerben-profile-sidebar #profile-tabs .nav-item .nav-link.active i {
  color: var(--kerben-profile-menu-fg) !important;
}

/* Ссылка «Пригласи друга» — как обычный пункт меню */
.kerben-profile-sidebar #profile-tabs a.nav-link[data-link] i.text-main-600 {
  color: inherit !important;
}

.kerben-profile-sidebar #profile-tabs .nav-link.text-danger {
  color: #dc3545 !important;
}

.kerben-profile-sidebar #profile-tabs .nav-link.text-danger:hover {
  background-color: rgba(220, 53, 69, 0.12) !important;
  color: #b02a37 !important;
}

.kerben-profile-sidebar #profile-tabs .nav-link.opacity-50:hover {
  background-color: rgba(220, 53, 69, 0.08) !important;
}

.kerben-profile-sidebar #profile-menu-toggle.btn-main {
  background: #00bf63 !important;
  border-color: #00a857 !important;
  color: #fff !important;
}

.kerben-profile-sidebar #profile-menu-toggle.btn-main:hover {
  background: #00a857 !important;
  border-color: #008f4a !important;
  color: #fff !important;
}

/* Кнопка «Google» на /login и /register — как btn-main: таблетка и «выпуклая» тень */
.kerben-google-signin-block {
  position: relative;
}

.kerben-google-custom-btn {
  position: relative;
  z-index: 0;
  /* Клики обрабатывает слой GSI поверх — иначе виджет в 1×1px + clip не рендерится нормально. */
  pointer-events: none;
  box-shadow:
    0 4px 16px hsla(var(--main-h), var(--main-s), var(--main-l), 0.34),
    0 2px 6px hsla(var(--main-h), var(--main-s), var(--main-l), 0.2);
  border: none;
  transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.12s ease;
}

.kerben-google-signin-block:hover .kerben-google-custom-btn {
  filter: brightness(1.07);
  box-shadow:
    0 6px 22px hsla(var(--main-h), var(--main-s), var(--main-l), 0.4),
    0 3px 10px hsla(var(--main-h), var(--main-s), var(--main-l), 0.22);
}

.kerben-google-signin-block:active .kerben-google-custom-btn {
  transform: translateY(1px);
  box-shadow:
    0 2px 10px hsla(var(--main-h), var(--main-s), var(--main-l), 0.3),
    0 1px 4px hsla(var(--main-h), var(--main-s), var(--main-l), 0.18);
}

.kerben-google-icon-wrap {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14);
}

.kerben-google-gsi-host {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50rem;
  overflow: hidden;
  cursor: pointer;
  /* Слегка непрозрачный слой: 0 ломает клики в части браузеров; виджет Google получает реальные hit-targets. */
  opacity: 0.03;
}
