/* ============================================================
   Sekai — inbox.css
   Экран «Inbox»: входящие ответы продавцов.
============================================================ */

.inbox {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  height: 100%;
  min-height: 0;
  animation: viewIn 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Список чатов */
.inbox-list {
  display: flex;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.inbox-list::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  pointer-events: none;
  z-index: 2;
}

.inbox-head {
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--glass-line);
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex-shrink: 0;
}

.inbox-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.inbox-head-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.1px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.inbox-head-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.inbox-head-actions { display: flex; gap: 6px; }

.inbox-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-pill);
}

.inbox-tabs .pill { font-size: 11px; padding: 6px 14px; }

.inbox-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-pill);
  color: var(--text-3);
  font-size: 12px;
  transition: border-color var(--t);
}

.inbox-search:focus-within {
  border-color: var(--glass-line-hover);
  background: rgba(255, 255, 255, 0.04);
}

.inbox-search svg {
  width: 13px;
  height: 13px;
  opacity: 0.7;
  flex-shrink: 0;
  stroke-width: 1.6;
}

.inbox-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 12.5px;
  font-family: inherit;
}

.inbox-search input::placeholder { color: var(--text-4); }

.inbox-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

.inbox-scroll::-webkit-scrollbar { width: 6px; }
.inbox-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

.inbox-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t), border-color var(--t);
  position: relative;
  min-width: 0;
}

.inbox-item:hover { background: rgba(255, 255, 255, 0.03); }

.inbox-item.active {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-line-hover);
}

.inbox-item.unread { background: rgba(255, 255, 255, 0.04); }

.inbox-ava {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-line-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  flex-shrink: 0;
  overflow: hidden;
}

.inbox-ava img { width: 100%; height: 100%; object-fit: cover; }

.inbox-ava::after {
  content: '';
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid var(--bg);
  box-shadow: 0 0 6px rgba(160, 220, 180, 0.5);
}

.inbox-ava.offline::after {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: none;
}

.inbox-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.inbox-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.1px;
  min-width: 0;
}

.inbox-time {
  font-size: 10.5px;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.inbox-preview {
  font-size: 12.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  min-width: 0;
}

.inbox-item.unread .inbox-preview {
  color: var(--text-2);
  font-weight: 500;
}

.inbox-item-status {
  display: inline-flex;
  gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.inbox-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--glass-soft);
  border: 1px solid var(--glass-line);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-3);
  white-space: nowrap;
}

.inbox-status::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.inbox-status.new      { color: rgba(180, 210, 255, 0.9); }
.inbox-status.sent     { color: var(--warn); }
.inbox-status.replied  { color: var(--ok); }
.inbox-status.done     { color: var(--text-4); }
.inbox-status.banned   { color: var(--err); }

.inbox-item-badge {
  position: absolute;
  right: 14px;
  bottom: 16px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Чат */
.inbox-chat {
  display: flex;
  flex-direction: column;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  position: relative;
  min-height: 0;
}

.inbox-chat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  pointer-events: none;
  z-index: 2;
}

.inbox-chat-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--glass-line);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.10);
  flex-wrap: wrap;
}

.inbox-chat-ava {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-line-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  flex-shrink: 0;
  overflow: hidden;
}

.inbox-chat-ava img { width: 100%; height: 100%; object-fit: cover; }

.inbox-chat-head-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-chat-head-name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 10px;
}

.inbox-chat-head-sub {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-chat-head-actions { display: flex; gap: 6px; flex-shrink: 0; }

.inbox-info-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--glass-line);
  background: rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-3);
}

.inbox-info-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.inbox-info-item svg {
  width: 13px;
  height: 13px;
  stroke-width: 1.5;
  opacity: 0.6;
  flex-shrink: 0;
}

.inbox-info-item b {
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-info-sep {
  width: 1px;
  height: 14px;
  background: var(--glass-line);
  flex-shrink: 0;
}

.inbox-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 26px 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.inbox-msgs::-webkit-scrollbar { width: 6px; }
.inbox-msgs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

.inbox-bubble {
  max-width: 64%;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
  animation: msgIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inbox-bubble.in {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-line);
  color: var(--text);
  border-bottom-left-radius: 6px;
}

.inbox-bubble.out {
  align-self: flex-end;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: var(--accent-ink);
  border-bottom-right-radius: 6px;
  font-weight: 500;
}

.inbox-bubble-text { white-space: pre-wrap; }

.inbox-bubble-time {
  font-size: 9.5px;
  opacity: 0.5;
  text-align: right;
  font-variant-numeric: tabular-nums;
  align-self: flex-end;
  margin-top: 3px;
}

.inbox-date {
  align-self: center;
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-4);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin: 12px 0 6px;
}

.inbox-reply {
  padding: 16px 20px 20px;
  border-top: 1px solid var(--glass-line);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.10);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inbox-quick {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.inbox-quick::-webkit-scrollbar { display: none; }

.inbox-quick-chip {
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: var(--glass-soft);
  border: 1px solid var(--glass-line);
  font-size: 11.5px;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  flex-shrink: 0;
}

.inbox-quick-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--glass-line-hover);
  color: var(--text);
}

.inbox-reply-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.inbox-reply-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 4px 18px;
  background: var(--glass-soft);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-md);
  transition: border-color var(--t), background var(--t);
}

.inbox-reply-field:focus-within {
  border-color: rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.04);
}

.inbox-reply-field textarea {
  flex: 1;
  min-width: 0;
  padding: 14px 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
}

.inbox-reply-field textarea::placeholder { color: var(--text-4); }

.inbox-reply-send {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--accent);
  border: none;
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t);
  flex-shrink: 0;
  box-shadow: 0 0 22px rgba(255, 255, 255, 0.12);
}

.inbox-reply-send:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(255, 255, 255, 0.22);
}

.inbox-reply-send:active { transform: scale(0.96); }
.inbox-reply-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.inbox-reply-send svg { width: 17px; height: 17px; stroke-width: 2; }

/* Пустое */
.inbox-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 50px 30px;
  text-align: center;
}

.inbox-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  background: var(--accent-soft);
  border: 1px solid var(--glass-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  margin-bottom: 8px;
}

.inbox-empty-icon svg { width: 28px; height: 28px; stroke-width: 1.5; }

.inbox-empty-t {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-2);
}

.inbox-empty-s {
  font-size: 13px;
  color: var(--text-4);
  max-width: 360px;
  line-height: 1.6;
}

/* Адаптив */
@media (max-width: 1000px) {
  .inbox { grid-template-columns: 320px 1fr; }
  .inbox-bubble { max-width: 78%; }
  .inbox-info-bar { padding: 12px 16px; gap: 12px; }
}
@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox-chat { display: none; }
  .inbox.chat-open .inbox-list { display: none; }
  .inbox.chat-open .inbox-chat { display: flex; }
}