/* ═══════════════════════════════════════════════
   Back-Office · QR Code Pro — style.css
   ═══════════════════════════════════════════════ */

:root {
  --bg:          #080818;
  --surface:     #0e0e24;
  --surface2:    #14142e;
  --border:      rgba(255,255,255,.07);
  --border2:     rgba(255,255,255,.12);
  --text:        #f1f5f9;
  --text2:       #a5b4fc;
  --muted:       #64748b;
  --accent:      #6366f1;
  --accent2:     #a855f7;
  --success:     #22c55e;
  --warning:     #f59e0b;
  --danger:      #ef4444;
  --sidebar-w:   240px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
a { color: var(--text2); text-decoration: none; }
a:hover { color: var(--text); }

/* ── LOGIN ──────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 30% 30%, rgba(99,102,241,.18) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 80%, rgba(168,85,247,.12) 0%, transparent 60%),
              var(--bg);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.login-logo {
  width: 64px; height: 64px;
  background: rgba(99,102,241,.12);
  border: 1px solid rgba(99,102,241,.3);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.login-title { font-size: 22px; font-weight: 700; color: var(--text); }
.login-sub { font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 14px; }
.login-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; border-radius: 8px; padding: 8px 12px; font-size: 12px; text-align: center; }
.btn-login {
  width: 100%; padding: 11px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 600; font-size: 14px; border: none; cursor: pointer;
  transition: opacity .2s;
}
.btn-login:hover { opacity: .9; }
.login-hint { font-size: 11px; color: var(--muted); text-align: center; margin-top: 4px; }

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

/* ── SIDEBAR ────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}
.brand-name { font-size: 13px; font-weight: 700; color: var(--text); }
.brand-role { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.sidebar-nav { flex: 1; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-section-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 10px 8px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 8px 10px; border-radius: 8px;
  border: none; background: transparent; color: var(--muted);
  cursor: pointer; font-size: 13px; font-weight: 500;
  text-align: left; transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--text); }
.nav-item.active { background: rgba(99,102,241,.15); color: var(--text2); }
.nav-item.active svg { stroke: var(--accent); }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px;
  min-width: 18px; text-align: center;
  display: none;
}
.nav-badge.show { display: inline; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-user { flex: 1; display: flex; align-items: center; gap: 8px; }
.su-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.su-name { font-size: 13px; font-weight: 600; color: var(--text); }
.su-role { font-size: 10px; color: var(--muted); }
.btn-logout {
  padding: 6px; border-radius: 6px; border: 1px solid var(--border2);
  background: transparent; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.btn-logout:hover { background: rgba(239,68,68,.1); color: #fca5a5; border-color: rgba(239,68,68,.3); }

/* ── MAIN ───────────────────────────────────── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-menu { display: none; padding: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer; border-radius: 6px; }
.topbar-menu:hover { background: rgba(255,255,255,.06); }
.topbar-title { font-size: 16px; font-weight: 700; flex: 1; }
.topbar-link {
  display: flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--muted); padding: 6px 10px;
  border: 1px solid var(--border2); border-radius: 7px;
  transition: color .15s, border-color .15s;
}
.topbar-link:hover { color: var(--text2); border-color: var(--accent); }

.page-wrapper {
  flex: 1; overflow-y: auto; padding: 20px 24px;
}
.page { display: none; }
.page.active { display: block; }

/* ── STATS GRID ─────────────────────────────── */
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
}
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-num { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-lbl { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── DASH GRID ──────────────────────────────── */
.dash-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.dash-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px;
}
.dash-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.dash-card-header h3 { font-size: 13px; font-weight: 600; color: var(--text); }
.dash-more { background: transparent; border: none; color: var(--text2); font-size: 12px; cursor: pointer; }
.dash-more:hover { color: var(--text); }
.dash-list { display: flex; flex-direction: column; gap: 8px; }
.dash-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  background: rgba(255,255,255,.03);
  font-size: 12px; color: var(--text);
}
.dash-row-info { flex: 1; min-width: 0; }
.dash-row-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-row-sub { color: var(--muted); font-size: 11px; }
.dash-row-badge { flex-shrink: 0; }

/* ── STARS CHART ────────────────────────────── */
.stars-chart { display: flex; flex-direction: column; gap: 8px; }
.sc-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sc-label { width: 32px; color: var(--muted); text-align: right; flex-shrink: 0; }
.sc-bar-bg { flex: 1; height: 8px; background: rgba(255,255,255,.07); border-radius: 4px; overflow: hidden; }
.sc-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 4px; transition: width .4s; }
.sc-count { width: 24px; text-align: right; color: var(--muted); }

/* ── TOOLBAR ────────────────────────────────── */
.page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.select-sm {
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); border-radius: 8px; padding: 6px 10px;
  font-size: 12px; cursor: pointer; outline: none;
}
.search-sm {
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--text); border-radius: 8px; padding: 6px 12px;
  font-size: 12px; outline: none; width: 180px;
}
.search-sm::placeholder { color: var(--muted); }
.search-sm:focus { border-color: var(--accent); }
.btn-sm-primary {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 600; font-size: 12px; border: none; cursor: pointer;
}
.btn-sm-primary:hover { opacity: .9; }
.btn-sm-ghost {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  background: transparent; border: 1px solid var(--border2);
  color: var(--muted); font-size: 12px; cursor: pointer;
}
.btn-sm-ghost:hover { border-color: var(--text2); color: var(--text); }
.btn-sm-danger {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5; font-size: 12px; cursor: pointer;
}
.btn-sm-danger:hover { background: rgba(239,68,68,.2); }

/* ── REV STATS BAR ──────────────────────────── */
.rev-stats-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.rsb-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 12px; color: var(--muted);
}
.rsb-item strong { color: var(--text); font-size: 15px; margin-right: 4px; }

/* ── DATA TABLE ─────────────────────────────── */
#reviews-table-wrap { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.data-table th {
  background: var(--surface); border-bottom: 1px solid var(--border2);
  padding: 9px 12px; text-align: left; font-weight: 600;
  color: var(--muted); white-space: nowrap;
}
.data-table td {
  padding: 9px 12px; border-bottom: 1px solid var(--border);
  color: var(--text); vertical-align: middle;
}
.data-table tr:hover td { background: rgba(255,255,255,.02); }

/* ── STATUS BADGES ──────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-new      { background: rgba(99,102,241,.15); color: #a5b4fc; }
.badge-published, .badge-sent { background: rgba(34,197,94,.15); color: #86efac; }
.badge-rejected, .badge-failed { background: rgba(239,68,68,.15); color: #fca5a5; }
.badge-draft    { background: rgba(100,116,139,.15); color: #94a3b8; }
.badge-scheduled { background: rgba(245,158,11,.15); color: #fde68a; }
.badge-in_progress { background: rgba(14,165,233,.15); color: #7dd3fc; }
.badge-resolved { background: rgba(34,197,94,.15); color: #86efac; }
.badge-sms      { background: rgba(14,165,233,.15); color: #7dd3fc; }
.badge-whatsapp { background: rgba(34,197,94,.15); color: #86efac; }
.badge-admin    { background: rgba(168,85,247,.15); color: #d8b4fe; }
.badge-manager  { background: rgba(245,158,11,.15); color: #fde68a; }
.badge-user     { background: rgba(100,116,139,.15); color: #94a3b8; }

/* ── STARS ──────────────────────────────────── */
.stars { color: #f59e0b; font-size: 13px; letter-spacing: 1px; }

/* ── ACTION BTNS ────────────────────────────── */
.act-btn {
  padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border2);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 11px;
  transition: all .15s;
}
.act-btn:hover { border-color: var(--text2); color: var(--text); }
.act-btn.danger:hover { border-color: rgba(239,68,68,.4); color: #fca5a5; background: rgba(239,68,68,.06); }

/* ── CAMPAIGNS LIST ─────────────────────────── */
.campaigns-list { display: flex; flex-direction: column; gap: 10px; }
.camp-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 14px;
}
.camp-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.camp-icon.sms     { background: rgba(14,165,233,.12); }
.camp-icon.whatsapp{ background: rgba(34,197,94,.12); }
.camp-body { flex: 1; min-width: 0; }
.camp-name { font-weight: 600; font-size: 13px; color: var(--text); }
.camp-meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.camp-msg  { font-size: 12px; color: var(--text); opacity: .8; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; }
.camp-stats-row { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.camp-stat { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); background: rgba(99,102,241,.12); border: 1px solid rgba(99,102,241,.25); border-radius: 6px; padding: 3px 8px; }
.camp-stat-num { font-size: 13px; font-weight: 700; color: #a5b4fc; }
.camp-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

/* ── CONTACTS LIST ──────────────────────────── */
.contacts-list { display: flex; flex-direction: column; gap: 10px; }
.cont-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 14px;
}
.cont-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.cont-body { flex: 1; min-width: 0; }
.cont-name { font-weight: 600; font-size: 13px; color: var(--text); }
.cont-meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; gap: 10px; flex-wrap: wrap; }
.cont-msg  { font-size: 12px; color: var(--text); opacity: .8; margin-top: 5px; }
.cont-note { font-size: 11px; color: var(--text2); margin-top: 4px; font-style: italic; }
.cont-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

/* ── USERS LIST ─────────────────────────────── */
.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.user-body { flex: 1; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; color: var(--text); }
.user-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.user-actions { display: flex; gap: 6px; align-items: center; }

/* ── HISTORY ────────────────────────────────── */
.history-list-admin { display: flex; flex-direction: column; gap: 6px; }
.hist-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px;
}
.hist-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.hist-dot.review   { background: #6366f1; }
.hist-dot.campaign { background: #22c55e; }
.hist-dot.contact  { background: #f59e0b; }
.hist-dot.user     { background: #a855f7; }
.hist-desc { flex: 1; color: var(--text); }
.hist-time { color: var(--muted); white-space: nowrap; }

/* ── SETTINGS ───────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 820px; }
.settings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.settings-card h3 { font-size: 13px; font-weight: 700; margin-bottom: 14px; color: var(--text); }

/* ── EMPTY STATE ────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 24px; gap: 12px; color: var(--muted); text-align: center; font-size: 13px;
}

/* ── COMMON FORM ────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.input-field, .select-field, .textarea-field {
  background: rgba(255,255,255,.05); border: 1px solid var(--border2);
  color: var(--text); border-radius: 8px; padding: 8px 11px;
  outline: none; transition: border-color .15s; width: 100%;
}
.input-field:focus, .select-field:focus, .textarea-field:focus { border-color: var(--accent); }
.input-field::placeholder, .textarea-field::placeholder { color: var(--muted); }
.textarea-field { resize: vertical; min-height: 70px; }
.select-field option { background: var(--surface2); }
.field-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── MODAL ──────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 16px;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 16px; width: 100%;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
  max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-hd h3 { font-size: 15px; font-weight: 700; }
.modal-close { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { color: var(--text); background: rgba(255,255,255,.07); }
.modal-bd { padding: 20px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.modal-ft { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.btn-primary { padding: 9px 18px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; font-weight: 600; border: none; cursor: pointer; font-size: 13px; }
.btn-primary:hover { opacity: .9; }
.btn-ghost { padding: 9px 16px; border-radius: 9px; background: transparent; border: 1px solid var(--border2); color: var(--muted); cursor: pointer; font-size: 13px; }
.btn-ghost:hover { border-color: var(--text2); color: var(--text); }
.btn-danger { padding: 9px 16px; border-radius: 9px; background: rgba(239,68,68,.15); border: 1px solid rgba(239,68,68,.3); color: #fca5a5; cursor: pointer; font-size: 13px; }
.btn-danger:hover { background: rgba(239,68,68,.25); }

/* ── TOAST ──────────────────────────────────── */
.toast-admin {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--text); padding: 10px 16px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 8px 32px rgba(0,0,0,.4);
  transform: translateY(20px); opacity: 0;
  transition: all .3s; pointer-events: none; z-index: 999;
}
.toast-admin.show { transform: translateY(0); opacity: 1; }

/* ── RESPONSIVE ─────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 660px) {
  :root { --sidebar-w: 240px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 100;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 32px rgba(0,0,0,.5); }
  .topbar-menu { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-wrapper { padding: 12px 14px; }
}
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .field-row2 { grid-template-columns: 1fr; }
}
