/* UpdaWa Admin UI — Modern redesign */

:root {
  --uw-accent:      #00cfc8;
  --uw-accent-dim:  rgba(0, 207, 200, .10);
  --uw-accent-dark: #009e98;
  --uw-bg:          #f0f2f5;
  --uw-card:        #ffffff;
  --uw-border:      #e5e7eb;
  --uw-border2:     #d1d5db;
  --uw-text:        #111827;
  --uw-muted:       #6b7280;
  --uw-muted2:      #9ca3af;
  --uw-green:       #10b981;
  --uw-green-bg:    #ecfdf5;
  --uw-yellow:      #d97706;
  --uw-yellow-bg:   #fffbeb;
  --uw-red:         #dc2626;
  --uw-red-bg:      #fef2f2;
  --uw-radius:      10px;
  --uw-shadow:      0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --uw-shadow-md:   0 4px 12px rgba(0,0,0,.08);
}

/* ── Page wrapper ─────────────────────────────────────────── */
#updawa-page {
  margin: 20px 20px 40px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--uw-text);
  background: var(--uw-bg);
  min-height: 100vh;
  padding: 0 0 60px;
}

/* ── Header ───────────────────────────────────────────────── */
.uw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.uw-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.uw-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
  box-shadow: var(--uw-shadow-md);
}
.uw-header-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--uw-text);
  margin: 0;
  line-height: 1.2;
}
.uw-header-sub {
  font-size: 12px;
  color: var(--uw-muted);
  margin-top: 2px;
}
.uw-version-badge {
  display: inline-block;
  background: var(--uw-accent-dim);
  color: var(--uw-accent-dark);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(0,207,200,.2);
  letter-spacing: .02em;
}
.uw-header-meta {
  font-size: 11px;
  color: var(--uw-muted2);
  text-align: right;
  line-height: 1.6;
}
.uw-header-meta strong {
  color: var(--uw-muted);
  font-weight: 600;
}

/* ── Tabs ─────────────────────────────────────────────────── */
.uw-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--uw-border);
  margin-bottom: 24px;
}
.uw-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--uw-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: color .15s, background .15s;
}
.uw-tab:hover {
  color: var(--uw-text);
  background: rgba(0,0,0,.03);
  text-decoration: none;
}
.uw-tab.is-active {
  color: var(--uw-accent-dark);
  border-bottom-color: var(--uw-accent);
  font-weight: 600;
  background: var(--uw-accent-dim);
}
.uw-tab svg {
  opacity: .6;
}
.uw-tab.is-active svg {
  opacity: 1;
}

/* ── Cards ────────────────────────────────────────────────── */
.uw-card {
  background: var(--uw-card);
  border: 1px solid var(--uw-border);
  border-radius: var(--uw-radius);
  box-shadow: var(--uw-shadow);
  margin-bottom: 20px;
  overflow: hidden;
}
.uw-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--uw-border);
  gap: 12px;
}
.uw-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--uw-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.uw-card-title svg {
  color: var(--uw-muted2);
  flex-shrink: 0;
}
.uw-card-body {
  padding: 20px;
}

/* ── Stat grid (top of Status tab) ───────────────────────── */
.uw-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.uw-stat {
  background: var(--uw-card);
  border: 1px solid var(--uw-border);
  border-radius: var(--uw-radius);
  box-shadow: var(--uw-shadow);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.uw-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--uw-accent-dim);
  color: var(--uw-accent-dark);
}
.uw-stat.is-warn .uw-stat-icon {
  background: var(--uw-yellow-bg);
  color: var(--uw-yellow);
}
.uw-stat-num {
  font-size: 26px;
  font-weight: 700;
  color: var(--uw-text);
  line-height: 1;
}
.uw-stat-num.is-warn { color: var(--uw-yellow); }
.uw-stat-label {
  font-size: 11px;
  color: var(--uw-muted);
  margin-top: 2px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Tables ───────────────────────────────────────────────── */
.uw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.uw-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--uw-muted);
  background: #fafafa;
  border-bottom: 1px solid var(--uw-border);
}
.uw-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--uw-border);
  color: var(--uw-text);
  vertical-align: middle;
}
.uw-table tbody tr:last-child td {
  border-bottom: none;
}
.uw-table tbody tr:hover td {
  background: #fafbfc;
}
.uw-table tbody tr.is-warn td {
  background: var(--uw-yellow-bg);
}
.uw-table tbody tr.is-warn:hover td {
  background: #fef3c7;
}
.uw-table code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  background: #f3f4f6;
  border: 1px solid var(--uw-border2);
  padding: 2px 6px;
  border-radius: 4px;
  color: #374151;
}

/* ── Badges ───────────────────────────────────────────────── */
.uw-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.uw-badge-ok {
  background: var(--uw-green-bg);
  color: var(--uw-green);
}
.uw-badge-warn {
  background: var(--uw-yellow-bg);
  color: var(--uw-yellow);
}
.uw-badge-err {
  background: var(--uw-red-bg);
  color: var(--uw-red);
}
.uw-badge-muted {
  background: #f3f4f6;
  color: var(--uw-muted);
}
.uw-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Active pill ──────────────────────────────────────────── */
.uw-pill-active {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: #e0f2fe;
  color: #0369a1;
}
.uw-pill-inactive {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  background: #f3f4f6;
  color: var(--uw-muted);
}

/* ── Refresh button (custom) ──────────────────────────────── */
.uw-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  border: none;
  transition: background .15s, box-shadow .15s;
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
}
.uw-btn-primary {
  background: var(--uw-accent);
  color: #fff;
}
.uw-btn-primary:hover {
  background: var(--uw-accent-dark);
  box-shadow: 0 0 0 3px rgba(0,207,200,.2);
  color: #fff;
}
.uw-btn-ghost {
  background: transparent;
  color: var(--uw-muted);
  border: 1px solid var(--uw-border2);
}
.uw-btn-ghost:hover {
  background: #f3f4f6;
  color: var(--uw-text);
  text-decoration: none;
}
.uw-btn-danger {
  background: var(--uw-red-bg);
  color: var(--uw-red);
  border: 1px solid #fecaca;
}
.uw-btn-danger:hover {
  background: #fee2e2;
  color: var(--uw-red);
  text-decoration: none;
}

/* ── JSON tab ─────────────────────────────────────────────── */
.uw-json-pre {
  margin: 0 !important;
  padding: 20px 24px 20px 40px !important;
  text-indent: 0 !important;
  background: #fafafa;
  color: var(--uw-text);
  border-top: 1px solid var(--uw-border);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.8;
  white-space: pre;
  overflow-x: auto;
  border-radius: 0 0 var(--uw-radius) var(--uw-radius);
}

/* ── Token tab ────────────────────────────────────────────── */
.uw-token-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
}
.uw-token-field-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}
.uw-token-input {
  flex: 1;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  padding: 9px 12px;
  border: 1px solid var(--uw-border2);
  border-radius: 7px;
  background: #fafafa;
  color: var(--uw-text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.uw-token-input:focus {
  border-color: var(--uw-accent);
  box-shadow: 0 0 0 3px rgba(0,207,200,.15);
}
.uw-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid var(--uw-border2);
  background: #fff;
  color: var(--uw-muted);
  font-family: inherit;
  transition: all .15s;
  white-space: nowrap;
}
.uw-copy-btn:hover {
  background: var(--uw-accent-dim);
  border-color: var(--uw-accent);
  color: var(--uw-accent-dark);
}
.uw-copy-btn.copied {
  background: var(--uw-green-bg);
  border-color: var(--uw-green);
  color: var(--uw-green);
}
.uw-token-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--uw-muted);
}
.uw-token-hint code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  background: #f3f4f6;
  border: 1px solid var(--uw-border2);
  padding: 1px 5px;
  border-radius: 4px;
}
.uw-curl-block {
  background: #0f172a;
  color: #94a3b8;
  border-radius: 8px;
  padding: 16px 18px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.9;
  overflow-x: auto;
  margin-top: 0;
}
.uw-curl-cmd  { color: #00cfc8; }
.uw-curl-flag { color: #f97316; }
.uw-curl-str  { color: #86efac; }
.uw-curl-url  { color: #7dd3fc; }

.uw-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.uw-qr-box {
  background: #fff;
  border: 1px solid var(--uw-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--uw-shadow);
}
.uw-qr-label {
  font-size: 11px;
  color: var(--uw-muted);
  text-align: center;
  font-weight: 500;
}

/* ── Notice override ──────────────────────────────────────── */
#updawa-page .notice {
  border-radius: 8px;
  border-left-width: 4px;
  margin: 0 0 20px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 960px) {
  .uw-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .uw-stats { grid-template-columns: 1fr 1fr; }
  .uw-token-layout { grid-template-columns: 1fr; }
  .uw-header { flex-direction: column; align-items: flex-start; }
  .uw-header-meta { text-align: left; }
}
@media (max-width: 480px) {
  .uw-stats { grid-template-columns: 1fr; }
}
