@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Merriweather:wght@700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background: #f5f6f8; color: #1e293b; }
a { text-decoration: none; color: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c7d2dc; border-radius: 4px; }

/* ── Animations ── */
@keyframes fadeUp  { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }
@keyframes pulse   { 0%,100%{opacity:1} 50%{opacity:.35} }
@keyframes blink   { 0%,80%,100%{opacity:.2} 40%{opacity:1} }
.fade-up { animation: fadeUp .35s ease both; }
.fade-in { animation: fadeIn .3s ease both; }

/* ── Navbar ── */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  position: sticky; top: 0; z-index: 10;
}
.navbar-brand {
  display: flex; align-items: center; gap: 9px;
  font-family: 'Merriweather', serif; font-weight: 700;
  font-size: 14px; color: #1e3a5f;
}
.navbar-user {
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #1e3a5f; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; cursor: pointer;
  text-decoration: none;
}
.avatar-sm {
  width: 28px; height: 28px; border-radius: 7px;
  background: #1e3a5f; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 10px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px; border: none;
  font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: #1d4ed8; color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(29,78,216,.3); }
.btn-danger  { background: #fff; color: #dc2626; border: 1px solid #fca5a5; }
.btn-danger:hover { background: #fef2f2; }
.btn-ghost   { background: transparent; color: #64748b; border: 1px solid #e2e8f0; }
.btn-ghost:hover { background: #f1f5f9; }
.btn-green   { background: #0f766e; color: #fff; }
.btn-green:hover:not(:disabled) { filter: brightness(1.07); transform: translateY(-1px); }
.btn-sm { padding: 6px 13px; font-size: 12px; }

/* ── Cards ── */
.card {
  background: #fff; border: 1.5px solid #e2e8f0;
  border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.card-body { padding: 24px; }

/* ── Form ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 7px; }
.form-control {
  width: 100%; background: #fff; border: 1.5px solid #d1d5db;
  border-radius: 8px; padding: 11px 14px;
  color: #1e293b; font-size: 14px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea.form-control { resize: vertical; line-height: 1.6; }

/* ── Alert ── */
.alert { border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }

/* ── Badge ── */
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.badge-waiting  { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-active   { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-ended    { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

/* ── Topic card ── */
.topic-card {
  background: #fff; border: 1.5px solid #e2e8f0; border-radius: 10px;
  padding: 22px 20px; cursor: pointer;
  transition: box-shadow .2s, transform .18s, border-color .2s;
  display: block; text-decoration: none; color: inherit;
}
.topic-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); transform: translateY(-2px); border-color: #93c5fd; }

/* ── Chat bubbles ── */
.bubble-wrap {
  display: flex; gap: 9px; align-items: flex-end;
  animation: fadeUp .25s ease both;
}
.bubble-wrap.me   { justify-content: flex-end; }
.bubble-wrap.them { justify-content: flex-start; }
.bubble {
  display: inline-block; width: fit-content;
  padding: 10px 14px; font-size: 14px;
  line-height: 1.65; word-break: break-word; 
}
.bubble.me   { max-width: 100%; background: var(--accent, #1d4ed8); color: #fff; border-radius: 16px 16px 4px 16px; }
.bubble.them { max-width: 100%; background: #fff; color: #1e293b; border-radius: 16px 16px 16px 4px; border: 1px solid #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.bubble.system-msg { background: #f1f5f9; color: #64748b; border-radius: 20px; padding: 4px 16px; font-size: 12px; border: 1px solid #e2e8f0; }
.bubble-time { font-size: 11px; color: #94a3b8; margin-top: 3px; }

/* ── Dot indicators ── */
.dot-pulse { width: 8px; height: 8px; border-radius: 50%; display: inline-block; animation: pulse 1.5s infinite; }
.dot-green  { background: #16a34a; }
.dot-yellow { background: #f59e0b; }
.dot-blue   { background: #1d4ed8; }
.dot-gray   { background: #94a3b8; }

/* ── Login layout ── */
.login-wrap { min-height: 100vh; display: flex; }
.login-left {
  width: 42%; background: #1e3a5f; display: flex; flex-direction: column;
  justify-content: center; padding: 60px 52px;
  position: relative; overflow: hidden;
}
.login-right {
  flex: 1; display: flex; align-items: center;
  justify-content: center; padding: 40px 32px;
}
.login-box { width: 100%; max-width: 400px; }
@media (max-width: 700px) {
  .login-left { display: none; }
  .login-right { padding: 32px 20px; }
}

/* ── Table ── */
.req-table { background: #fff; border: 1.5px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
.req-table-head {
  display: grid; padding: 10px 18px;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0;
  font-size: 11px; font-weight: 600; color: #64748b;
  text-transform: uppercase; letter-spacing: .04em;
}
.req-table-row {
  display: grid; padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9; align-items: center;
  cursor: pointer; transition: background .15s;
}
.req-table-row:last-child { border-bottom: none; }
.req-table-row:hover { background: #f8fafc; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 2px solid #e2e8f0; margin-bottom: 20px; }
.tab-btn {
  background: none; border: none; font-family: inherit; font-size: 13px;
  padding: 9px 18px; cursor: pointer; display: flex; align-items: center; gap: 7px;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  color: #64748b; font-weight: 400; transition: color .15s;
}
.tab-btn.active { color: #1d4ed8; font-weight: 600; border-bottom-color: #1d4ed8; }
.tab-btn:hover:not(.active) { color: #1d4ed8; }

/* ── Stars ── */
.star { font-size: 32px; cursor: pointer; color: #e2e8f0; transition: color .12s, transform .12s; display: inline-block; user-select: none; }
.star.on, .star:hover { color: #f59e0b; transform: scale(1.15); }

/* ── Stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 28px; }
.stat-card { border-radius: 10px; padding: 18px 20px; }

/* ── Chat layout ── */
.chat-wrap { height: 100vh; display: flex; flex-direction: column; }
.chat-header { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.chat-subheader { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 8px 20px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-input-area { background: #fff; border-top: 1px solid #e2e8f0; padding: 14px 20px; flex-shrink: 0; }
.chat-textarea { flex: 1; background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 8px; padding: 11px 14px; color: #1e293b; font-size: 14px; font-family: inherit; resize: none; line-height: 1.5; max-height: 110px; overflow-y: auto; transition: border-color .2s, box-shadow .2s; }
.chat-textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.send-btn { width: 42px; height: 42px; border: none; border-radius: 8px; cursor: pointer; font-size: 16px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .15s; }
.send-btn:hover:not(:disabled) { filter: brightness(1.08); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .navbar { padding: 0 14px; }
  .chat-messages { padding: 14px 12px; }
}
