/* ===== static/styles.css ===== */
/* Базовые стили для всех сайтов */

body {
  margin: 0;
  font-family: 	'Nunito Sans', Arial, sans-serif;
  background: #f5f5f5;
  color: #222;
}

h1, h2, h3, h4 {
  margin: 0 0 10px;
  font-weight: 600;
}

p {
  margin: 0 0 10px;
  line-height: 1.4;
}

/* Общая кнопка */
.btn {
  display: inline-block;
  padding: 8px 16px;
  background: #007bff;
  color: #fff;
  font-size: 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn:hover {
  background: #0056b3;
}

/* Бейдж непрочитанных */
.badge {
  margin-left: 6px;
  background: red;
  color: #fff;
  font-size: 12px;
  border-radius: 50%;
  padding: 2px 6px;
  vertical-align: middle;
}

/* ===== Модалка ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
}
.modal-content {
  background-color: #fff;
  margin: 60px auto;
  padding: 20px;
  border-radius: 6px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
  position: relative;
}
.close {
  position: absolute;
  right: 10px; top: 5px;
  font-size: 24px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
}
.close:hover { color: #000; }

/* ===== Чат ===== */
.chat-box {
  flex:1;min-height:260px;overflow:auto;border:1px solid #e5e7eb;border-radius:12px;padding:10px;background:#f8fafc;display:flex;flex-direction:column;gap:8px;
}
.message {
  margin: 4px 0;
  padding: 8px 12px;
  border-radius: 10px;
  max-width: 80%;
  word-wrap: break-word;
  font-size: 14px;
}
.msg-user {
  margin-left: auto;
  background: #e8f0ff;
}
.msg-admin {
  margin-right: auto;
  background: #fff;
  border: 1px solid #e5e7eb;
}
.msg-admin.unread {
  border: 2px dashed #1976d2;
}
.chat-input {
  display: flex;
  gap: 8px;
}
.chat-input input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
}
.tp-head{padding:8px 6px 2px;border-bottom:1px solid #e5e7eb}
.tp-agent{display:flex;align-items:center;gap:10px}
.tp-avatar{width:34px;height:34px;border-radius:50%;background:#f3f4f6;display:inline-flex;align-items:center;justify-content:center;font-weight:700}
.tp-name{font-weight:700}
.tp-status{font-size:12px;color:#6b7280}
.tp-online{display:inline-block;width:8px;height:8px;border-radius:50%;background:#16a34a;margin-right:6px}
#supportModal[aria-hidden="true"] { display: none; }

/* ===== Не блокирующий плавающий чат ===== */
#supportModal.modal {
  display: block !important;
  position: fixed;
  inset: auto 20px 90px auto;
  width: min(400px, calc(100vw - 40px));
  height: auto;
  background: transparent !important;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transform: translateY(18px) scale(0.92);
  transform-origin: bottom right;
  transition: opacity .22s ease, transform .22s ease;
}

#supportModal.modal.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#supportModal .modal-content {
  margin: 0;
  width: 100%;
  max-width: none;
  border-radius: 18px;
  box-shadow: 0 18px 45px rgba(0,0,0,.22);
}

#supportModal[aria-hidden="true"] {
  pointer-events: none;
  opacity: 0;
  transform: translateY(18px) scale(0.92);
}

/* ===== Единая шапка leboncoin ===== */
.lb-header{height:61px;border-bottom:1px solid #eceff2;box-shadow:0 2px 12px rgba(0,0,0,.08);background:#fff;position:relative;z-index:2}
.lb-header__inner{height:100%;max-width:980px;margin:0 auto;display:flex;align-items:center;gap:22px;padding:0 16px;position:relative}
.lb-brand{position:absolute;left:50%;transform:translateX(-50%);font-size:27px;line-height:1;font-weight:800;color:#f56e28;letter-spacing:-1.2px;white-space:nowrap}
.lb-brand img{height:28px;vertical-align:middle}
.lb-safe{margin-left:auto;color:#f56e28;font-size:13px;font-weight:700;display:flex;align-items:center;gap:8px;white-space:nowrap}
.lb-safe span{width:22px;height:22px;border-radius:50%;background:#f56e28;color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:800}
@media(max-width:620px){.lb-brand{font-size:23px}.lb-safe{display:none}}

.fab-chat{position:fixed;right:22px;bottom:22px;z-index:60;width:58px;height:58px;border-radius:50%;background:#fff;border:1px solid #e5e7eb;display:flex;align-items:center;justify-content:center;box-shadow:0 12px 28px rgba(0,0,0,.15);cursor:pointer}
.fab-chat:hover{border-color:#d1d5db}
.fab-ico{font-size:22px}
.fab-dot{position:absolute;width:10px;height:10px;border-radius:50%;background:#16a34a;right:8px;top:8px;box-shadow:0 0 0 4px #eaffea}

/* ===== Мобильная адаптация ===== */
@media (max-width: 600px) {
  .lb-header { height: 50px; }
  .lb-header__inner { padding: 0 16px; gap: 10px; }
  .lb-brand { font-size: 22px; position: static; transform: none; }
  .lb-safe { display: none; }

  /* Чат — компактный попап */
  #supportModal.modal,
  /* Чат — компактный попап */
  #supportModal.modal,
  #supportModal.modal.open {
    left: 8px !important;
    right: 8px !important;
    bottom: 70px !important;
    top: auto !important;
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    height: auto !important;
    max-height: 60vh !important;
    box-sizing: border-box !important;
    inset: unset !important;
    position: fixed !important;
    left: 8px !important;
    right: 8px !important;
    bottom: 70px !important;
  }
  #supportModal .modal-content {
    border-radius: 14px !important;
    max-height: 60vh !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 14px !important;
  }
  #supportModal .close { display: block !important; font-size: 22px; }
  .chat-box { min-height: 120px; max-height: 35vh; flex: 1; overflow-y: auto; overflow-x: hidden; font-size: 14px; width: 100% !important; box-sizing: border-box !important; }
  .chat-input { padding: 8px 0; box-sizing: border-box; width: 100% !important; }
  #chatText { font-size: 16px; padding: 8px 12px; min-width: 0; flex: 3; }
  #sendBtn { font-size: 13px; padding: 8px 16px; white-space: nowrap; flex-shrink: 0; flex: 0; }
  .fab-chat { right: 14px; bottom: 14px; width: 48px; height: 48px; }
  .fab-ico { font-size: 20px; }

  /* Запрет горизонтального скролла */
  html, body { overflow-x: hidden !important; font-size: 16px; -webkit-text-size-adjust: 100%; }
  .ad-wrapper { padding: 16px 12px; }
  .btn { padding: 12px 16px; font-size: 15px; width: 100%; text-align: center; border-radius: 10px; }

  /* Модалки */
  .lb-modal__dialog { padding: 18px !important; }
  .lb-modal__title { font-size: 16px !important; line-height: 1.4 !important; }
  .lb-modal__text { font-size: 14px !important; }
  .lb-modal__input { font-size: 16px !important; height: 46px !important; }
  .lb-modal__textarea { font-size: 16px !important; }
  .lb-modal__btn { height: 44px !important; font-size: 15px !important; width: 100% !important; }
  .lb-modal__actions { flex-direction: column-reverse !important; }
}