/* ============================================================
   Tagora — Partner Portal (partner.html)
   ============================================================ */

/* ── Page shell ── */
.partner-page {
  min-height: 100vh; display: flex; flex-direction: column;
  background: #020617; color: #e2e8f0;
}
.partner-main {
  max-width: 72rem; margin: 0 auto;
  padding: 3rem 1.5rem; width: 100%; flex: 1;
}

/* ── Hero header ── */
.partner-hero { margin-bottom: 3rem; }
.partner-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: rgb(99 102 241 / .10); color: #a5b4fc;
  font-size: 0.75rem; font-weight: 700;
  padding: 0.375rem 0.75rem; border-radius: 9999px;
  text-transform: uppercase; letter-spacing: 0.05em;
  border: 1px solid rgb(99 102 241 / .20); margin-bottom: 1.5rem;
}
.partner-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem); font-weight: 800;
  color: #fff; letter-spacing: -0.025em; margin: 0 0 1rem;
}
.partner-hero p { color: #94a3b8; font-size: 1.125rem; line-height: 1.625; max-width: 48rem; margin: 0; }

/* ── Tag search ── */
.partner-search-wrap { max-width: 42rem; margin: 0 auto 4rem; }
.partner-search-form {
  position: relative; display: flex; align-items: center;
  box-shadow: 0 20px 50px -12px rgb(0 0 0 / .60);
}
.partner-search-icon {
  position: absolute; left: 0; top: 0; bottom: 0;
  padding-left: 1rem; display: flex; align-items: center;
  pointer-events: none; color: #64748b;
}
.partner-search-input {
  width: 100%; padding: 1rem 9rem 1rem 2.75rem;
  background: #0f172a; border: 1px solid #1e293b;
  border-radius: 1rem; color: #e2e8f0;
  font-family: 'Menlo', monospace;
  font-size: 0.875rem; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.partner-search-input::placeholder { color: #64748b; }
.partner-search-input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgb(99 102 241 / .20); }
.partner-search-btn {
  position: absolute; right: 0.5rem; top: 0.5rem; bottom: 0.5rem;
  background: #4f46e5; color: #fff; font-weight: 600;
  padding: 0 1.5rem; border-radius: 0.75rem; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem;
  transition: background 0.15s;
}
.partner-search-btn:hover { background: #4338ca; }

/* Search result card */
.partner-result-card {
  margin-top: 1.5rem; background: #0f172a;
  border: 1px solid #1e293b; border-radius: 1rem;
  padding: 1.5rem; box-shadow: 0 25px 50px -12px rgb(0 0 0 / .60);
}
.partner-result-title {
  font-size: 1.125rem; font-weight: 700; color: #fff;
  margin: 0 0 1.5rem; display: flex; align-items: center; gap: 0.5rem;
}
.partner-result-query { color: #818cf8; font-family: monospace; margin-left: 0.5rem; }
.partner-result-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 768px) { .partner-result-grid { grid-template-columns: repeat(2, 1fr); } }

/* Battery + status fields */
.partner-metric { display: flex; flex-direction: column; gap: 1.5rem; }
.partner-metric-row { display: flex; flex-direction: column; gap: 0.5rem; }
.partner-metric-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.875rem;
}
.partner-metric-name { color: #94a3b8; display: flex; align-items: center; gap: 0.5rem; }
.partner-metric-value { color: #fff; font-weight: 700; font-family: monospace; }
.partner-battery-track { width: 100%; height: 0.5rem; background: #1e293b; border-radius: 9999px; overflow: hidden; }
.partner-battery-fill  { height: 100%; border-radius: 9999px; }
.partner-status-online {
  color: #4ade80; font-weight: 700; font-size: 0.75rem;
  background: rgb(34 197 94 / .10); border: 1px solid rgb(34 197 94 / .20);
  padding: 0.125rem 0.5rem; border-radius: 9999px;
}

/* Pings panel */
.partner-pings-panel {
  background: #020617; border-radius: 0.75rem; padding: 1rem;
  border: 1px solid rgb(30 41 59 / .60);
}
.partner-pings-title {
  font-size: 0.875rem; font-weight: 600; color: #cbd5e1;
  margin: 0 0 0.75rem; display: flex; align-items: center; gap: 0.5rem;
}
.partner-ping-list { display: flex; flex-direction: column; gap: 0.75rem; }
.partner-ping-item {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.875rem; border-bottom: 1px solid rgb(30 41 59 / .50);
  padding-bottom: 0.5rem;
}
.partner-ping-item:last-child { border-bottom: none; padding-bottom: 0; }
.partner-ping-time { color: #64748b; font-family: monospace; font-size: 0.75rem; }
.partner-ping-event { color: #cbd5e1; }

/* ── Sparkline charts grid ── */
.partner-charts-grid {
  display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 4rem;
}
@media (min-width: 768px)  { .partner-charts-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .partner-charts-grid { grid-template-columns: repeat(4, 1fr); } }

.sparkline-card {
  background: #0f172a; border: 1px solid #1e293b;
  border-radius: 1rem; padding: 1.25rem;
  position: relative; overflow: hidden;
  transition: border-color 200ms;
}
.sparkline-card:hover { border-color: #475569; }
.sparkline-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.sparkline-title { font-size: 0.875rem; font-weight: 700; color: #cbd5e1; letter-spacing: 0.025em; margin: 0; }
.sparkline-chart { position: relative; width: 100%; height: 80px; }
.sparkline-chart svg { width: 100%; height: 100%; }
.sparkline-footer {
  margin-top: 0.75rem; font-size: 10px; color: #475569;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}

/* ── Customer table ── */
.partner-table-wrap {
  background: #0f172a; border: 1px solid #1e293b;
  border-radius: 1.5rem; overflow: hidden;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / .60);
}
.partner-table-header {
  padding: 1.5rem 2rem; border-bottom: 1px solid #1e293b;
  display: flex; align-items: center; gap: 0.75rem;
}
.partner-table-title { font-size: 1.25rem; font-weight: 700; color: #fff; margin: 0; }
.partner-table-scroll { overflow-x: auto; }
.partner-table {
  width: 100%; text-align: left; font-size: 0.875rem;
  white-space: nowrap; border-collapse: collapse;
}
.partner-table thead tr {
  background: rgb(2 6 23 / .50); color: #94a3b8;
  font-weight: 600; border-bottom: 1px solid #1e293b;
}
.partner-table th { padding: 1rem 1.5rem; }
.partner-table td { padding: 1rem 1.5rem; }
.partner-table .td-right { text-align: right; }
.customer-row { cursor: pointer; transition: background 0.15s; }
.customer-row:hover { background: rgb(30 41 59 / .30); }
.customer-name { font-weight: 700; color: #e2e8f0; display: flex; align-items: center; gap: 0.5rem; }
.customer-status-cell { display: flex; align-items: center; gap: 0.5rem; }
.customer-status-badge {
  font-size: 0.75rem; font-weight: 700;
  padding: 0.25rem 0.625rem; border-radius: 9999px; border: 1px solid;
}
.customer-status-badge--online  { background: rgb(34 197 94  / .10); color: #4ade80; border-color: rgb(34 197 94  / .20); }
.customer-status-badge--warning { background: rgb(245 158 11 / .10); color: #fbbf24; border-color: rgb(245 158 11 / .20); }
.customer-status-badge--offline { background: rgb(239 68 68  / .10); color: #f87171; border-color: rgb(239 68 68  / .20); }
.customer-msg { font-family: monospace; color: #cbd5e1; }
.customer-battery-cell { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; }
.customer-battery-track { width: 5rem; height: 0.375rem; background: #1e293b; border-radius: 9999px; overflow: hidden; }
.customer-battery-fill  { height: 100%; border-radius: 9999px; }
.customer-battery-pct   { font-family: monospace; color: #94a3b8; font-size: 0.75rem; width: 2rem; text-align: right; }

/* ── Customer popup ── */
.partner-popup-backdrop {
  position: fixed; inset: 0; background: rgb(2 6 23 / .75);
  backdrop-filter: blur(4px); z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.partner-popup-backdrop.hidden { display: none; }
.partner-popup {
  width: 100%; max-width: 32rem;
  background: #0f172a; border: 1px solid #334155;
  border-radius: 1.5rem; box-shadow: 0 25px 50px -12px rgb(0 0 0 / .80);
  overflow: hidden;
}
.partner-popup-head {
  padding: 1.25rem; border-bottom: 1px solid #1e293b;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
.partner-popup-id { display: flex; align-items: center; gap: 0.75rem; }
.partner-popup-dot { width: 0.625rem; height: 0.625rem; border-radius: 9999px; flex-shrink: 0; }
.partner-popup-title {
  font-size: 1rem; font-weight: 700; color: #fff; margin: 0; line-height: 1.3;
}
.partner-popup-subtitle { font-size: 0.75rem; color: #64748b; margin: 0.125rem 0 0; }
.partner-popup-close {
  color: #64748b; background: none; border: none; cursor: pointer;
  padding: 0.25rem; border-radius: 0.5rem; transition: color 0.15s, background 0.15s;
  display: flex;
}
.partner-popup-close:hover { color: #fff; background: #1e293b; }
.partner-popup-body { padding: 1rem; }
.partner-popup-cols-head {
  display: grid; grid-template-columns: 1fr 7rem 6rem;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: #64748b;
  padding: 0 0.75rem 0.5rem; border-bottom: 1px solid rgb(30 41 59 / .60);
}
.partner-popup-cols-head span:last-child { text-align: right; }
.partner-popup-list { max-height: 18rem; overflow-y: auto; }
.partner-popup-user {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.75rem; gap: 0.5rem; border-radius: 0.5rem;
  font-size: 0.75rem;
  transition: background 0.15s;
}
.partner-popup-user:hover { background: rgb(15 23 42 / .60); }
.partner-popup-foot {
  padding: 0.75rem 1.25rem; background: rgb(2 6 23 / .60);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.75rem; color: #64748b;
}

/* ── Popup user list items ── */
.partner-popup-user {
  display: grid; grid-template-columns: 1fr 7rem 6rem;
  align-items: center; gap: 0 0.75rem;
  padding: 0.625rem 0.75rem; border-radius: 0.5rem;
  font-size: 0.75rem; transition: background 0.15s;
}
.partner-popup-user:hover { background: rgb(15 23 42 / .60); }
.partner-popup-user-info { display: flex; align-items: center; gap: 0.625rem; min-width: 0; }
.partner-popup-avatar {
  width: 2rem; height: 2rem; border-radius: 9999px;
  background: rgb(139 92 246 / .10); border: 1px solid rgb(139 92 246 / .20);
  display: flex; align-items: center; justify-content: center;
  color: #a78bfa; font-weight: 700; font-size: 0.75rem; flex-shrink: 0;
}
.partner-popup-user-details { min-width: 0; }
.partner-popup-user-name {
  color: #e2e8f0; font-weight: 600; font-size: 0.875rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.partner-popup-user-time {
  color: #64748b; font-size: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.partner-popup-tag-bar-wrap {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 0.5rem; padding-right: 0.5rem;
}
.partner-popup-tag-track {
  width: 3.5rem; height: 0.375rem; background: #1e293b;
  border-radius: 9999px; overflow: hidden; flex-shrink: 0;
}
.partner-popup-tag-fill { height: 100%; border-radius: 9999px; background: #8b5cf6; }
.partner-popup-tag-count {
  color: #94a3b8; font-family: monospace; font-size: 0.75rem;
  width: 1.5rem; text-align: right; flex-shrink: 0;
}
.partner-popup-msg-zero  { color: #475569; font-family: monospace; font-size: 0.75rem; text-align: right; }
.partner-popup-msg-active { color: #cbd5e1; font-family: monospace; font-size: 0.75rem; text-align: right; }
.partner-popup-empty { padding: 1.5rem; text-align: center; color: #475569; font-size: 0.875rem; }

/* ── Misc ── */
.hidden { display: none !important; }

/* ── Animations ── */
@keyframes popupIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}
#customer-popup.open {
  animation: popupIn 220ms ease-out forwards;
}
.customer-row { cursor: pointer; }
