/* ============================================================
   assets/css/app.css — WA Manager Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0c0f0a;
  --surface:     #141710;
  --surface2:    #1c2018;
  --surface3:    #242820;
  --border:      #2a2e26;
  --border2:     #343830;
  --accent:      #a8e063;
  --accent2:     #7ab83a;
  --accent-dim:  rgba(168,224,99,0.12);
  --text:        #e8edd8;
  --text2:       #9da88a;
  --text3:       #5c6350;
  --danger:      #e06363;
  --danger-dim:  rgba(224,99,99,0.12);
  --warn:        #e0c463;
  --warn-dim:    rgba(224,196,99,0.12);
  --online:      #63e08a;
  --radius:      12px;
  --radius-sm:   8px;
}

body {
  font-family: 'DM Mono', monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ── App Shell ──────────────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: 260px; min-width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

.sidebar-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo { display: flex; align-items: center; gap: 9px; }
.sidebar-logo-icon {
  width: 30px; height: 30px;
  background: var(--accent); border-radius: 7px;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.sidebar-logo-text { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }
.sidebar-logo-text span { color: var(--accent); }

.sidebar-section-label {
  font-size: 10px; font-weight: 500; color: var(--text3);
  text-transform: uppercase; letter-spacing: 1.5px; padding: 16px 20px 8px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.15s; font-size: 13px;
  color: var(--text2); margin-bottom: 2px;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); border-color: rgba(168,224,99,0.2); color: var(--accent); }
.nav-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); }
.user-info {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface2); margin-bottom: 8px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent-dim); border: 1px solid rgba(168,224,99,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-family: 'Syne', sans-serif; font-weight: 700; color: var(--accent);
}
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--text3); }

/* ── Main ───────────────────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  padding: 0 28px; height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); flex-shrink: 0;
}
.topbar-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.content { flex: 1; overflow-y: auto; padding: 28px; }

/* ── Flash ──────────────────────────────────────────────────── */
.flash {
  padding: 12px 28px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.flash-success { background: var(--accent-dim); color: var(--accent); }
.flash-error   { background: var(--danger-dim); color: var(--danger); }
.flash-info    { background: var(--warn-dim); color: var(--warn); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 500;
  cursor: pointer; border: none; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #0c0f0a; }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: transparent; border: 1px solid var(--border2); color: var(--text2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.btn-danger { background: var(--danger-dim); border: 1px solid rgba(224,99,99,0.3); color: var(--danger); }
.btn-danger:hover { background: rgba(224,99,99,0.2); }
.btn-warn { background: var(--warn-dim); border: 1px solid rgba(224,196,99,0.3); color: var(--warn); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Forms ──────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 11px; font-weight: 500; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius-sm); padding: 11px 14px;
  font-family: 'DM Mono', monospace; font-size: 14px; color: var(--text); outline: none; transition: border-color 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
.field select option { background: var(--surface2); }
.form-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px 18px; font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; color: var(--text3); border-bottom: 1px solid var(--border); background: var(--surface2); }
td { padding: 13px 18px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }
.table-actions { display: flex; gap: 6px; }

/* ── Pills/Badges ───────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.pill-green  { background: rgba(99,224,138,0.12); border: 1px solid rgba(99,224,138,0.25); color: var(--online); }
.pill-yellow { background: var(--warn-dim); border: 1px solid rgba(224,196,99,0.25); color: var(--warn); }
.pill-gray   { background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text3); }
.pill-red    { background: var(--danger-dim); border: 1px solid rgba(224,99,99,0.25); color: var(--danger); }
.pill-accent { background: var(--accent-dim); border: 1px solid rgba(168,224,99,0.25); color: var(--accent); }

/* ── Stats Row ──────────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-label { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 800; line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--text2); margin-top: 4px; }

/* ── Section Title ──────────────────────────────────────────── */
.section-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }

/* ── Client Cards (User Dashboard) ─────────────────────────── */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-bottom: 28px; }
.client-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden;
  text-decoration: none; color: inherit; display: block;
}
.client-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0; transition: opacity 0.2s;
}
.client-card:hover { border-color: var(--border2); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.client-card:hover::before { opacity: 1; }
.client-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.client-avatar {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-dim); border: 1px solid rgba(168,224,99,0.2);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.online     { background: var(--online); box-shadow: 0 0 8px var(--online); }
.status-dot.offline    { background: var(--text3); }
.status-dot.connecting { background: var(--warn); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

.client-name   { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.client-status { font-size: 11px; color: var(--text2); }
.client-unread { display: inline-flex; align-items: center; margin-top: 12px; font-size: 11px; color: var(--accent); gap: 5px; }

/* ── Chat ───────────────────────────────────────────────────── */
.chat-wrap { display: flex; flex-direction: column; height: 100%; }
.chat-back  { margin-bottom: 16px; }
.chat-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 16px;
}
.chat-header-info .chat-name   { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; }
.chat-header-info .chat-status { font-size: 11px; color: var(--text2); }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); min-height: 300px; max-height: calc(100vh - 340px);
  display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px;
}
.chat-day-label { text-align: center; font-size: 11px; color: var(--text3); padding: 4px; }

.msg { display: flex; max-width: 68%; flex-direction: column; }
.msg.incoming { align-self: flex-start; }
.msg.outgoing { align-self: flex-end; }
.msg-bubble { padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.msg.incoming .msg-bubble { background: var(--surface2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.outgoing .msg-bubble { background: var(--accent-dim); border: 1px solid rgba(168,224,99,0.25); border-bottom-right-radius: 4px; }
.msg-meta { font-size: 10px; color: var(--text3); padding: 3px 4px 0; }
.msg.outgoing .msg-meta { text-align: right; }

.chat-input-area { display: flex; gap: 10px; align-items: flex-end; }
.chat-input {
  flex: 1; background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 12px; padding: 12px 16px;
  font-family: 'DM Mono', monospace; font-size: 13px; color: var(--text);
  outline: none; resize: none; min-height: 44px; max-height: 120px; transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send-btn {
  width: 44px; height: 44px; border-radius: 10px; background: var(--accent);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 16px; transition: all 0.2s; flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--accent2); }

/* ── QR Card ────────────────────────────────────────────────── */
.qr-layout { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }
.qr-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; display: flex; flex-direction: column; align-items: center; gap: 20px; max-width: 380px; }
.qr-box { width: 220px; height: 220px; background: white; border-radius: 12px; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.qr-inner { font-size: 80px; }
.qr-scanning { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: scan 2s linear infinite; }
@keyframes scan { from { top: 0; } to { top: 100%; } }
.qr-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px; }
.qr-sub   { font-size: 12px; color: var(--text2); text-align: center; line-height: 1.6; }
.qr-steps { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.qr-step  { display: flex; align-items: flex-start; gap: 10px; font-size: 12px; color: var(--text2); }
.qr-step-num { width: 20px; height: 20px; border-radius: 50%; background: var(--accent-dim); border: 1px solid rgba(168,224,99,0.3); color: var(--accent); font-size: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 1px; }

/* ── Misc ───────────────────────────────────────────────────── */
.assign-select { background: var(--surface2); border: 1px solid var(--border2); border-radius: 6px; padding: 6px 10px; font-family: 'DM Mono', monospace; font-size: 12px; color: var(--text); outline: none; cursor: pointer; }
.assign-select:focus { border-color: var(--accent); }
.phone-hidden  { font-family: 'DM Mono', monospace; color: var(--text3); letter-spacing: 2px; font-size: 12px; }
.empty-state   { text-align: center; padding: 80px 20px; color: var(--text3); }
.empty-state-icon  { font-size: 48px; margin-bottom: 16px; }
.empty-state-title { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text2); }
.empty-state-sub   { font-size: 13px; }

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }

/* ── Login Page ─────────────────────────────────────────────── */
body.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); position: relative; overflow: hidden; }
.login-bg { position: fixed; inset: 0; background: radial-gradient(ellipse 60% 50% at 20% 80%, rgba(168,224,99,0.07) 0%, transparent 60%), radial-gradient(ellipse 40% 40% at 80% 20%, rgba(168,224,99,0.04) 0%, transparent 60%); pointer-events: none; }
.login-grid { position: fixed; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 60px 60px; opacity: 0.3; pointer-events: none; }
.login-card { position: relative; width: 420px; background: var(--surface); border: 1px solid var(--border2); border-radius: 20px; padding: 48px 40px; animation: fadeUp 0.5s ease; }
@keyframes fadeUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; }
.login-logo-icon { width: 40px; height: 40px; background: var(--accent); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.login-logo-text { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.login-logo-text span { color: var(--accent); }
.login-title { font-family: 'Syne', sans-serif; font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.login-sub  { color: var(--text2); font-size: 13px; margin-bottom: 32px; }
.login-btn  { width: 100%; padding: 14px; font-size: 14px; font-weight: 600; margin-top: 8px; }
.login-error { background: var(--danger-dim); border: 1px solid rgba(224,99,99,0.3); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; color: var(--danger); margin-bottom: 16px; }
