/* ==========================================================
   Nexora Live Chat — Admin / Agent Panel Styles
   ========================================================== */

* { box-sizing: border-box; }

body.nx-admin-body {
  margin: 0;
  font-family: var(--nx-font-body);
  background: var(--nx-bg);
  color: var(--nx-text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Auth screens ---------- */
.nx-auth {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 20%, #6C5CE7 0%, #4338CA 45%, #1A1D29 100%);
  padding: 20px;
}
.nx-auth__card {
  width: 100%; max-width: 400px; background: var(--nx-surface);
  border-radius: var(--nx-radius-lg); box-shadow: var(--nx-shadow-lg);
  padding: 40px 36px;
}
.nx-auth__logo { display:flex; align-items:center; gap:10px; justify-content:center; margin-bottom: 6px;}
.nx-auth__logo span.nx-dot { width:10px; height:10px; border-radius:50%; background: var(--nx-success); }
.nx-auth__logo strong { font-family: var(--nx-font-display); font-size: 20px; }
.nx-auth h2 { text-align:center; font-size: 22px; margin: 18px 0 4px; }
.nx-auth p.nx-sub { text-align:center; color: var(--nx-text-muted); font-size: 13.5px; margin: 0 0 26px; }

.nx-field { margin-bottom: 18px; }
.nx-field label { display:block; font-size: 13px; font-weight:600; margin-bottom: 7px; color: var(--nx-text); }
.nx-field input, .nx-field select, .nx-field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--nx-radius-sm);
  border: 1.5px solid var(--nx-border); font-size: 14px; font-family: var(--nx-font-body);
  background: #fbfbfe; transition: border-color .15s ease, box-shadow .15s ease;
}
.nx-field input:focus, .nx-field select:focus, .nx-field textarea:focus {
  outline: none; border-color: var(--nx-primary); box-shadow: 0 0 0 3px var(--nx-primary-light); background:#fff;
}
.nx-alert { padding: 12px 14px; border-radius: var(--nx-radius-sm); font-size: 13.5px; margin-bottom: 18px; }
.nx-alert--error { background: #FFEDED; color: #C0392B; border: 1px solid #FFD3D3; }
.nx-alert--success { background: #E8FBF5; color: #05966B; border: 1px solid #C3F2E2; }
.nx-auth__footer { text-align:center; margin-top: 20px; font-size: 13px; color: var(--nx-text-muted); }

/* ---------- Shell layout ---------- */
.nx-shell { display: flex; min-height: 100vh; }

.nx-sidebar {
  width: 240px; background: #1A1D29; color: #fff; flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.nx-sidebar__brand { display:flex; align-items:center; gap:10px; padding: 22px 22px 18px; }
.nx-sidebar__brand strong { font-family: var(--nx-font-display); font-size: 17px; }
.nx-sidebar__brand span.nx-dot { width:9px; height:9px; border-radius:50%; background: var(--nx-success); box-shadow: 0 0 0 4px rgba(0,217,160,0.25);}
.nx-sidebar nav { flex: 1; padding: 10px 12px; overflow-y:auto; }
.nx-nav-link {
  display:flex; align-items:center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  color: #B7B9C8; font-size: 14px; font-weight: 500; margin-bottom: 3px; transition: all .15s ease;
}
.nx-nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nx-nav-link.active { background: var(--nx-primary); color: #fff; }
.nx-nav-link .nx-icon { width: 18px; text-align:center; }
.nx-sidebar__foot { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.nx-sidebar__user { display:flex; align-items:center; gap:10px; }
.nx-avatar {
  width: 36px; height: 36px; border-radius: 50%; display:flex; align-items:center; justify-content:center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; background: var(--nx-primary);
}
.nx-sidebar__user strong { display:block; font-size: 13px; }
.nx-sidebar__user small { color: #8B8DA0; font-size: 11.5px; }

.nx-main { flex: 1; min-width: 0; display:flex; flex-direction:column; }
.nx-topbar {
  display:flex; align-items:center; justify-content: space-between;
  padding: 16px 28px; background: #fff; border-bottom: 1px solid var(--nx-border);
  position: sticky; top: 0; z-index: 5;
}
.nx-topbar h1 { font-size: 19px; }
.nx-topbar__right { display:flex; align-items:center; gap: 16px; }
.nx-badge-count {
  background: var(--nx-accent); color:#fff; font-size: 10.5px; font-weight:700;
  border-radius: 999px; padding: 1px 6px; margin-left: 6px;
}

.nx-content { padding: 26px 28px 60px; flex: 1; }

/* ---------- Stat cards ---------- */
.nx-stats { display:grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 26px; }
.nx-stat-card {
  background: #fff; border: 1px solid var(--nx-border); border-radius: var(--nx-radius-md);
  padding: 20px 22px; position: relative; overflow: hidden;
}
.nx-stat-card__icon {
  width: 40px; height:40px; border-radius: 11px; display:flex; align-items:center; justify-content:center;
  font-size: 18px; margin-bottom: 14px;
}
.nx-stat-card h3 { font-size: 26px; margin-bottom: 2px; }
.nx-stat-card p { margin:0; font-size: 13px; color: var(--nx-text-muted); }

/* ---------- Cards / tables ---------- */
.nx-card { background:#fff; border:1px solid var(--nx-border); border-radius: var(--nx-radius-md); overflow:hidden; margin-bottom: 22px; }
.nx-card__head { padding: 18px 22px; border-bottom: 1px solid var(--nx-border); display:flex; align-items:center; justify-content:space-between; }
.nx-card__head h2 { font-size: 15.5px; }
.nx-table { width: 100%; border-collapse: collapse; }
.nx-table th { text-align:left; font-size: 12px; text-transform:uppercase; letter-spacing:.04em; color: var(--nx-text-muted); padding: 12px 22px; background: #FAFAFD; border-bottom: 1px solid var(--nx-border);}
.nx-table td { padding: 14px 22px; border-bottom: 1px solid var(--nx-border); font-size: 13.5px; vertical-align: middle; }
.nx-table tr:last-child td { border-bottom: none; }
.nx-table tr:hover td { background: #FAFAFD; }

.nx-pill { display:inline-flex; align-items:center; gap:6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.nx-pill--pending { background:#FFF6E5; color:#B9770E; }
.nx-pill--active { background:#E8FBF5; color:#05966B; }
.nx-pill--closed { background:#F1F1F5; color:#6B7280; }
.nx-pill--online { background:#E8FBF5; color:#05966B; }
.nx-pill--offline { background:#F1F1F5; color:#6B7280; }
.nx-pill--away { background:#FFF6E5; color:#B9770E; }

.nx-empty { text-align:center; padding: 60px 20px; color: var(--nx-text-muted); }
.nx-empty .nx-icon { font-size: 40px; margin-bottom: 12px; }

.nx-btn-sm { padding: 7px 14px; font-size: 12.5px; border-radius: 7px; }
.nx-btn-icon { width: 34px; height:34px; border-radius: 8px; display:inline-flex; align-items:center; justify-content:center; border: 1px solid var(--nx-border); background:#fff; cursor:pointer; color: var(--nx-text-muted); transition: all .15s ease;}
.nx-btn-icon:hover { border-color: var(--nx-primary); color: var(--nx-primary); }

/* ---------- Chat workspace (admin/agent) ---------- */
.nx-chatapp { display: flex; height: calc(100vh - 65px); background:#fff; border-top: 1px solid var(--nx-border); }
.nx-chatlist { width: 320px; flex-shrink:0; border-right: 1px solid var(--nx-border); display:flex; flex-direction:column; }
.nx-chatlist__search { padding: 14px; border-bottom: 1px solid var(--nx-border); }
.nx-chatlist__search input { width:100%; padding:10px 14px; border-radius: 999px; border:1px solid var(--nx-border); font-size:13px; background: var(--nx-bg); }
.nx-chatlist__tabs { display:flex; gap: 6px; padding: 10px 14px 0; }
.nx-chatlist__tab { padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight:600; color: var(--nx-text-muted); cursor:pointer; }
.nx-chatlist__tab.active { background: var(--nx-primary-light); color: var(--nx-primary-dark); }
.nx-chatlist__items { flex:1; overflow-y:auto; padding: 8px; }

.nx-chatitem { display:flex; gap: 12px; padding: 12px; border-radius: 12px; cursor: pointer; position: relative; margin-bottom: 2px;}
.nx-chatitem:hover { background: var(--nx-bg); }
.nx-chatitem.active { background: var(--nx-primary-light); }
.nx-chatitem__meta { flex:1; min-width:0; }
.nx-chatitem__top { display:flex; justify-content:space-between; align-items:baseline; gap: 6px;}
.nx-chatitem__top strong { font-size: 13.5px; }
.nx-chatitem__top time { font-size: 11px; color: var(--nx-text-muted); flex-shrink:0; }
.nx-chatitem__preview { font-size: 12.5px; color: var(--nx-text-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px;}
.nx-chatitem__unread { position:absolute; right: 10px; bottom: 10px; background: var(--nx-accent); color:#fff; font-size: 10px; font-weight:700; border-radius:999px; min-width:18px; height:18px; display:flex; align-items:center; justify-content:center; padding: 0 5px;}

.nx-chatwin { flex:1; display:flex; flex-direction:column; min-width:0; }
.nx-chatwin__head { display:flex; align-items:center; justify-content:space-between; padding: 14px 22px; border-bottom:1px solid var(--nx-border); }
.nx-chatwin__who { display:flex; align-items:center; gap: 12px; }
.nx-chatwin__who strong { display:block; font-size: 14.5px; }
.nx-chatwin__who small { color: var(--nx-text-muted); font-size: 12px; }
.nx-chatwin__body { flex:1; overflow-y:auto; padding: 22px; background: var(--nx-bg); display:flex; flex-direction:column; gap: 12px; }
.nx-msg-row { display:flex; }
.nx-msg-row.out { justify-content:flex-end; }
.nx-msg { max-width: 62%; padding: 11px 15px; border-radius: var(--nx-radius-bubble); font-size: 13.8px; line-height:1.5; box-shadow: var(--nx-shadow-sm); }
.nx-msg-row:not(.out) .nx-msg { background:#fff; border-bottom-left-radius:4px; }
.nx-msg-row.out .nx-msg { background: var(--nx-primary); color:#fff; border-bottom-right-radius:4px; }
.nx-msg time { display:block; font-size: 10.5px; opacity:.65; margin-top: 5px; }
.nx-msg img { max-width: 220px; border-radius: 10px; display:block; margin-top:4px; }
.nx-msg .nx-file-chip { display:flex; align-items:center; gap:8px; }
.nx-msg-row.system { justify-content:center; }
.nx-msg-row.system .nx-msg { background: transparent; box-shadow:none; color: var(--nx-text-muted); font-size:12px; text-align:center; }

.nx-typing { display:flex; gap:4px; padding: 8px 15px; background:#fff; border-radius: var(--nx-radius-bubble); width:fit-content; box-shadow: var(--nx-shadow-sm);}
.nx-typing span { width:6px; height:6px; border-radius:50%; background: var(--nx-text-muted); animation: nxTyping 1.2s infinite ease-in-out; }
.nx-typing span:nth-child(2) { animation-delay: .2s; }
.nx-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes nxTyping { 0%,60%,100%{ transform: translateY(0); opacity:.5;} 30%{ transform: translateY(-4px); opacity:1;} }

.nx-chatwin__composer { padding: 14px 18px; border-top: 1px solid var(--nx-border); display:flex; align-items:flex-end; gap: 10px; background:#fff;}
.nx-chatwin__composer textarea {
  flex:1; resize:none; border:1.5px solid var(--nx-border); border-radius: var(--nx-radius-md);
  padding: 11px 14px; font-family: var(--nx-font-body); font-size: 13.8px; max-height: 120px;
}
.nx-chatwin__composer textarea:focus { outline:none; border-color: var(--nx-primary); }
.nx-composer-btn { width: 40px; height: 40px; border-radius: 10px; border:1px solid var(--nx-border); background:#fff; cursor:pointer; color: var(--nx-text-muted); flex-shrink:0; display:flex; align-items:center; justify-content:center;}
.nx-composer-btn:hover { color: var(--nx-primary); border-color: var(--nx-primary); }
.nx-send-btn { width: 42px; height:42px; border-radius: 10px; background: var(--nx-primary); color:#fff; border:none; cursor:pointer; flex-shrink:0; display:flex; align-items:center; justify-content:center; transition: background .15s ease;}
.nx-send-btn:hover { background: var(--nx-primary-dark); }

.nx-chatwin__empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; color: var(--nx-text-muted); }

/* Modal */
.nx-modal-backdrop { position:fixed; inset:0; background: rgba(26,29,41,.5); display:flex; align-items:center; justify-content:center; z-index: 50; }
.nx-modal { background:#fff; border-radius: var(--nx-radius-lg); width: 100%; max-width: 440px; padding: 26px; box-shadow: var(--nx-shadow-lg); }
.nx-modal h3 { font-size:17px; margin-bottom: 6px; }
.nx-modal p.nx-sub { color: var(--nx-text-muted); font-size: 13px; margin-bottom: 20px;}
.nx-modal__actions { display:flex; gap: 10px; justify-content:flex-end; margin-top: 8px;}

@media (max-width: 1100px) {
  .nx-stats { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 860px) {
  .nx-sidebar { position: fixed; left: -240px; z-index: 40; transition: left .2s ease; }
  .nx-sidebar.open { left: 0; }
  .nx-chatlist { width: 100%; position:absolute; inset:0; z-index: 3; background:#fff;}
  .nx-chatlist.hide-mobile { display:none; }
}
