/* ── PORUKE (MESSAGES) PAGE ─────────────────────────────── */

.messages-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Reuse dash-sidebar from dashboard.css */
.dash-sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 14px;
  gap: 28px;
  height: 100vh;
  overflow-y: auto;
}

.dash-logo { display:flex; align-items:center; gap:9px; text-decoration:none; padding:0 6px; flex-shrink:0; }
.dash-nav  { display:flex; flex-direction:column; gap:2px; flex:1; }

.dn-item {
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; border-radius:var(--radius);
  text-decoration:none; color:var(--ink-soft);
  font-size:13.5px; font-weight:500;
  transition:all 0.15s; position:relative;
}
.dn-item:hover { background:var(--cream); color:var(--ink); }
.dn-item.active { background:var(--amber-light); color:var(--amber-dark); }
.dn-item.active::before {
  content:''; position:absolute; left:0; top:15%; bottom:15%;
  width:3px; background:var(--amber); border-radius:0 3px 3px 0;
}
.dn-icon { font-size:15px; width:18px; text-align:center; flex-shrink:0; }
.dn-badge {
  margin-left:auto; background:var(--amber); color:white;
  font-size:10px; font-weight:700; font-family:var(--font-mono);
  padding:1px 7px; border-radius:100px; min-width:20px; text-align:center;
}

.dash-sidebar__bottom { border-top:1px solid var(--border); padding-top:14px; }
.dash-profile-link {
  display:flex; align-items:center; gap:10px; padding:8px 10px;
  border-radius:var(--radius); text-decoration:none; cursor:pointer;
  transition:background 0.15s; position:relative;
}
.dash-profile-link:hover { background:var(--cream); }
.dp-avatar {
  width:32px; height:32px; border-radius:8px;
  background:var(--amber-light); border:1.5px solid var(--amber);
  color:var(--amber-dark); font-size:11px; font-weight:700;
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.dp-name { font-size:13px; font-weight:600; color:var(--ink); }
.dp-role { font-size:11px; color:var(--ink-muted); font-family:var(--font-mono); }
.dp-status {
  width:7px; height:7px; border-radius:50%;
  background:var(--green); box-shadow:0 0 6px var(--green);
  margin-left:auto; flex-shrink:0;
}

/* ── MESSAGES LAYOUT ─────────────────────── */
.messages-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100vh;
  overflow: hidden;
}

.messages-layout.with-details {
  grid-template-columns: 300px 1fr 280px;
}

/* ── INBOX ────────────────────────────────── */
.inbox {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--white);
  overflow: hidden;
}

.inbox__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
  flex-shrink: 0;
}

.inbox__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
}

.inbox__search {
  position: relative;
  padding: 0 12px 12px;
  flex-shrink: 0;
}

.inbox__search input {
  width: 100%;
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px 8px 32px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.inbox__search input:focus { border-color: var(--amber); }
.inbox__search input::placeholder { color: var(--ink-muted); }

.inbox__search-icon {
  position: absolute;
  left: 22px; top: 50%;
  transform: translateY(-65%);
  color: var(--ink-muted);
  font-size: 14px;
  pointer-events: none;
}

.inbox__tabs {
  display: flex;
  gap: 2px;
  padding: 0 12px 10px;
  flex-shrink: 0;
}

.itab {
  flex: 1;
  padding: 6px 8px;
  background: none;
  border: none;
  border-radius: var(--radius);
  font-size: 12.5px;
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.itab:hover { background: var(--cream); color: var(--ink); }
.itab.active { background: var(--amber-light); color: var(--amber-dark); }

.itab-badge {
  background: var(--amber);
  color: white;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 100px;
  font-family: var(--font-mono);
}

.inbox__list {
  flex: 1;
  overflow-y: auto;
}

/* ── THREAD ITEM ──────────────────────────── */
.thread-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.thread-item:hover { background: var(--cream); }
.thread-item.active { background: var(--amber-light); }
.thread-item.unread { background: #fffbf5; }

.thread-item.unread::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--amber);
  border-radius: 0 2px 2px 0;
}

.thread-avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--cream-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  position: relative;
}

.thread-online {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 9px; height: 9px;
  background: var(--green);
  border: 2px solid white;
  border-radius: 50%;
}

.thread-body { flex: 1; min-width: 0; }

.thread-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3px;
}

.thread-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-time {
  font-size: 11px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.thread-preview {
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-item.unread .thread-preview { color: var(--ink); font-weight: 500; }

.thread-topic {
  font-size: 11px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── CHAT WINDOW ──────────────────────────── */
.chat {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--cream);
  overflow: hidden;
}

.chat__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-muted);
}

.chat__empty-icon { font-size: 52px; opacity: 0.4; }
.chat__empty-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink-soft); }
.chat__empty-sub { font-size: 14px; }

.chat__active { display: flex; flex-direction: column; height: 100%; }

/* ── CHAT HEADER ──────────────────────────── */
.chat__header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ch-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--cream-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}

.ch-info { flex: 1; }
.ch-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.ch-status { font-size: 12px; color: var(--green); }
.ch-topic { font-size: 11px; color: var(--ink-muted); font-family: var(--font-mono); }

.ch-actions { display: flex; gap: 6px; }

.ch-action {
  width: 32px; height: 32px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}

.ch-action:hover { background: var(--cream); border-color: var(--ink-muted); }

/* ── MESSAGES AREA ────────────────────────── */
.chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-date-sep {
  text-align: center;
  font-size: 11px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  padding: 12px 0 8px;
}

.msg-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.msg-row.mine { flex-direction: row-reverse; }

.msg-avatar-sm {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--cream-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  flex-shrink: 0; align-self: flex-end;
}

.msg-row.mine .msg-avatar-sm { display: none; }

.msg-bubble {
  max-width: 68%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

.msg-row:not(.mine) .msg-bubble {
  background: var(--white);
  color: var(--ink);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-row.mine .msg-bubble {
  background: var(--amber);
  color: white;
  border-bottom-right-radius: 4px;
}

.msg-time {
  font-size: 10px;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  padding: 0 4px;
  align-self: flex-end;
}

.msg-row.mine .msg-time { text-align: right; }

/* System message */
.msg-system {
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 16px;
  align-self: center;
  margin: 8px 0;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.typing-dots {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-muted);
  animation: typingPulse 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* ── COMPOSER ─────────────────────────────── */
.chat__composer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.composer__attachments { display: flex; gap: 4px; }

.composer-action {
  width: 32px; height: 32px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  color: var(--ink-muted);
}

.composer-action:hover { background: var(--cream); }

.composer__input-wrap { flex: 1; }

.composer__input {
  width: 100%;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.2s;
  line-height: 1.4;
}

.composer__input:focus { border-color: var(--amber); }
.composer__input::placeholder { color: var(--ink-muted); }

.composer__send {
  width: 36px; height: 36px;
  background: var(--amber);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  color: white;
  font-size: 16px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.composer__send:hover { background: var(--amber-dark); transform: scale(1.06); }

/* ── DETAILS PANEL ────────────────────────── */
.chat-details {
  background: var(--white);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  height: 100vh;
  overflow-y: auto;
}

.cd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cd-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--ink); }

.cd-close {
  background: none; border: none; cursor: pointer;
  color: var(--ink-muted); font-size: 14px;
  padding: 4px 8px; border-radius: var(--radius);
  transition: all 0.15s;
}
.cd-close:hover { background: var(--cream); color: var(--ink); }

.cd-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 16px;
  background: var(--cream);
  border-radius: var(--radius-lg);
}

.cd-profile-avatar {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--cream-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}

.cd-profile-name { font-weight: 700; font-size: 15px; color: var(--ink); }
.cd-profile-sub  { font-size: 12px; color: var(--ink-soft); }
.cd-profile-rating { font-size: 13px; color: var(--amber); }

.cd-section { display: flex; flex-direction: column; gap: 10px; }

.cd-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  font-family: var(--font-mono);
}

.cd-inquiry {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.cd-actions { display: flex; flex-direction: column; gap: 8px; }

/* ── RESPONSIVE ───────────────────────────── */
@media (max-width: 1100px) {
  .messages-layout { grid-template-columns: 280px 1fr; }
  .chat-details { display: none !important; }
}

@media (max-width: 768px) {
  .messages-body { grid-template-columns: 1fr; }
  .dash-sidebar { display: none; }
  .messages-layout { grid-template-columns: 1fr; }
  .inbox { display: none; }
  .inbox.mobile-visible { display: flex; }
}
