/**
 * Демо-страницы B2B-портала SAINT-GOBAIN.
 *
 * К виджету отношения не имеет: это вёрстка хостовой страницы, на которую
 * виджет встраивается. Один файл на все демо (index / history / order),
 * чтобы шапка, сайдбар и футер не расходились между страницами.
 */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #333;
  background: #f5f5f5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.header {
  background: white;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  background: #f9f9f9;
  color: #666;
  padding: 10px 20px;
  font-size: 12px;
  border-bottom: 1px solid #e0e0e0;
}

.header-top-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-main {
  padding: 15px 20px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.logo {
  font-size: 14px;
  font-weight: bold;
  color: #0099cc;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 180px;
}

.logo-main {
  font-size: 16px;
  letter-spacing: 1px;
}

.logo-sub {
  font-size: 12px;
  margin-top: 2px;
  color: #0099cc;
}

.logo::after {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  background: #0099cc;
  margin-top: 6px;
}

.search-bar {
  flex: 1;
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-bar input {
  flex: 1;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 13px;
  background: #fafafa;
}

.search-bar input::placeholder {
  color: #999;
}

.search-bar select {
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 3px;
  background: white;
  font-size: 13px;
  color: #666;
}

.search-btn {
  padding: 10px 15px;
  background: #ff9966;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
}

.account-links {
  display: flex;
  gap: 15px;
  align-items: center;
  font-size: 12px;
  padding-left: 15px;
  border-left: 1px solid #ddd;
}

.account-links a {
  color: #333;
  text-decoration: none;
}

.account-links a:hover {
  color: #0099cc;
}

/* Main Layout */
.wrapper {
  display: flex;
  flex: 1;
}

/* Sidebar */
.sidebar {
  width: 226px;
  background: #555;
  color: white;
  padding: 0;
  flex-shrink: 0;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 16px;
  color: white;
  text-decoration: none;
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.sidebar a:hover {
  background: #666;
  border-left-color: #0099cc;
}

/* Текущий раздел портала — демо-страниц теперь несколько */
.sidebar a.active {
  background: #666;
  border-left-color: #0099cc;
}

.sidebar-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  margin: 20px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.content-header {
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.content-header h2 {
  font-size: 18px;
  color: #333;
  font-weight: 600;
}

.content-body {
  padding: 20px;
  overflow-x: auto;
}

/* Orders Table */
.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.orders-table thead {
  background: #f5f5f5;
  border-bottom: 1px solid #ddd;
}

.orders-table th {
  padding: 12px 8px;
  text-align: left;
  font-weight: 600;
  color: #666;
  border-right: 1px solid #e5e5e5;
}

.orders-table th:last-child {
  border-right: none;
}

.orders-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #f0f0f0;
  border-right: 1px solid #f5f5f5;
}

.orders-table td:last-child {
  border-right: none;
}

.orders-table tbody tr:hover {
  background: #fafafa;
}

.order-number {
  color: #0099cc;
  font-weight: 600;
}

.order-date {
  color: #666;
  font-size: 12px;
}

.order-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.order-status.confirmed {
  background: #e8f5e9;
  color: #2e7d32;
}

.order-status.pending {
  background: #fff3e0;
  color: #e65100;
}

.order-amount {
  color: #333;
  font-weight: 600;
}

/* Bottom Section */
.bottom-section {
  display: flex;
  gap: 20px;
  padding: 20px;
  margin-top: 20px;
}

.info-box {
  flex: 1;
  background: white;
  padding: 20px;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.info-box h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #333;
  border-bottom: 1px solid #e0e0e0;
  padding-bottom: 10px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 13px;
  border-bottom: 1px solid #f5f5f5;
}

.info-row label {
  color: #666;
  font-weight: 500;
}

.info-row value {
  color: #333;
  font-weight: 600;
}

.info-row:last-child {
  border-bottom: none;
}

/* Footer */
.footer {
  background: #1a1a1a;
  color: white;
  margin-top: auto;
  padding: 30px 20px 15px;
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 30px;
  margin-bottom: 20px;
  font-size: 12px;
}

.footer-section h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.footer-section ul {
  list-style: none;
}

.footer-section ul li {
  margin-bottom: 6px;
}

.footer-section a {
  color: #ccc;
  text-decoration: none;
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  border-top: 1px solid #333;
  padding-top: 15px;
  text-align: center;
  font-size: 11px;
  color: #999;
  max-width: 1400px;
  margin: 0 auto;
}
.sgchat-demo-panel {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px dashed #bbb;
  border-radius: 8px;
  background: rgba(255, 255, 255, .95);
  font-size: 12px;
}

.sgchat-demo-panel__title {
  font-weight: 600;
  color: #666;
}

.sgchat-demo-panel button {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  cursor: pointer;
}

/* Акцент виджета (--sg-brand-500). Текст белый — как везде на акценте. */
.sgchat-demo-panel button:hover {
  background: #EC4F00;
  color: #fff;
}

/* Контейнер, в который виджет монтирует инлайн-блок (ТЗ, 2.9). Внутри —
   Shadow DOM виджета: панель сама рисует карточку (фон, скругление, тень),
   поэтому здесь только внешние отступы — те же, что у .main-content. */
.sgchat-embed {
  margin: 20px;
}

/* Панель идёт следом за карточкой заказа — верхний отступ схлопываем */
.main-content + .sgchat-embed {
  margin-top: 0;
}

/* Карточка, под которой стоит блок виджета, не должна тянуться на всю
   высоту: свободное место остаётся странице, а не пустеет внутри карточки */
.main-content--auto {
  flex: none;
}

/* ====================================================================== */
/* Узкий экран                                                            */
/* ====================================================================== */
/* Вёрстка хостовой страницы, а не виджета. Нужна, чтобы мобильный вид
   виджета вообще было на чём смотреть: без этого сайдбар 226px забирал
   почти весь экран и инлайн-панели оставалось около 100px.
   Порог тот же, что у панели виджета (640px), — чтобы оба перестроения
   происходили одновременно. */
@media (max-width: 640px) {
  /* --- Шапка: поиск уезжает на свою строку --- */
  .header-top {
    padding: 8px 12px;
  }

  .header-top-content {
    flex-wrap: wrap;
    gap: 4px;
  }

  .header-main {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
  }

  .logo {
    min-width: 0;
  }

  .search-bar {
    order: 3;
    flex-basis: 100%;
  }

  .account-links {
    flex-wrap: wrap;
    gap: 8px;
    padding-left: 0;
    border-left: 0;
  }

  /* --- Сайдбар: горизонтальная полоса разделов над контентом --- */
  .wrapper {
    flex-direction: column;
  }

  .sidebar {
    display: flex;
    width: 100%;
    overflow-x: auto;
  }

  .sidebar a {
    flex-shrink: 0;
    gap: 8px;
    padding: 10px 12px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
  }

  .sidebar a:hover,
  .sidebar a.active {
    border-bottom-color: #0099cc;
  }

  /* --- Контент и блок виджета: поля 12 вместо 20 --- */
  .main-content,
  .sgchat-embed {
    margin: 12px;
  }

  .content-header,
  .content-body {
    padding: 12px;
  }

  /* Демо-панель уезжает вниз, чтобы не накрывать шапку портала, и стелется
     в строку — столбцом кнопок она закрывала пол-экрана.
     Справа оставляем место лаунчеру виджета (56 + отступ 24). */
  .sgchat-demo-panel {
    top: auto;
    right: 88px;
    bottom: 12px;
    left: 12px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px;
  }

  .sgchat-demo-panel__title {
    flex-basis: 100%;
  }

  .sgchat-demo-panel button {
    padding: 4px 8px;
  }

  .footer {
    padding: 20px 12px 12px;
  }
}
