/* ────────────────────────────────────────────────────────────────────────
   CnvctSocial — Demo Client
   Vanilla CSS, sin dependencias de runtime. Tipografía Inter (Google Fonts).
   ──────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Brand */
  --primary:        #1e3a8a;
  --primary-hover:  #172b6b;
  --primary-soft:   #eef2ff;
  --secondary:      #3b82f6;
  --accent:         #7c3aed;
  --accent-soft:    #f5f3ff;

  /* Platform accents */
  --facebook:        #1877F2;
  --facebook-soft:   #e7f0fe;
  --instagram-a:     #f58529;
  --instagram-b:     #dd2a7b;
  --instagram-c:     #8134af;
  --instagram-soft:  #fdf2f8;
  --whatsapp:        #25D366;
  --whatsapp-dark:   #128C7E;
  --whatsapp-soft:   #ecfdf5;
  --messenger:       #0084ff;

  /* Neutrals */
  --bg:             #f6f7fb;
  --bg-elev:        #ffffff;
  --card-bg:        #ffffff;
  --border:         #e5e7eb;
  --border-strong:  #d1d5db;
  --text:           #1f2937;
  --text-muted:     #6b7280;
  --text-strong:    #0f172a;

  /* Status */
  --success:        #047857;
  --success-bg:     #d1fae5;
  --warning:        #b45309;
  --warning-bg:     #fef3c7;
  --danger:         #b91c1c;
  --danger-bg:      #fee2e2;

  /* Visual tokens */
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --shadow-sm:      0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow:         0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg:      0 20px 40px -12px rgba(30, 58, 138, 0.18), 0 8px 16px -8px rgba(15, 23, 42, 0.08);
  --transition:     150ms cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(124, 58, 237, 0.10), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(59, 130, 246, 0.10), transparent 50%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3, h4 {
  color: var(--text-strong);
  margin: 0 0 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; }
p  { margin: 0 0 12px; }
.muted { color: var(--text-muted); font-size: 14px; }
.error-text { color: var(--danger); font-size: 14px; margin-top: 10px; font-weight: 500; }

a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─────────── TOP BAR ─────────── */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-name {
  font-weight: 800;
  font-size: 18px;
  color: var(--text-strong);
  letter-spacing: -0.02em;
}
.brand-tag {
  font-size: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: var(--text-muted);
}
.user-info #tenant-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
}
.user-info #tenant-label::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.18);
}

/* ─────────── CONTAINER ─────────── */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

/* ─────────── CARDS ─────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover {
  box-shadow: var(--shadow);
}

/* ─────────── LOGIN (split-screen) ─────────── */
.login-screen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  max-width: 1080px;
  margin: 40px auto 0;
  align-items: stretch;
}
.login-card {
  margin: 0;
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: var(--shadow);
}
.login-card h1 { margin-bottom: 8px; }
.login-card > .muted { margin-bottom: 28px; font-size: 15px; }
.login-info {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.login-info h3 { font-size: 13px; color: var(--text); margin-bottom: 6px; }

.login-showcase {
  background:
    radial-gradient(ellipse 100% 80% at 100% 0%, rgba(124, 58, 237, 0.35), transparent 60%),
    linear-gradient(160deg, var(--primary) 0%, #2937a1 60%, #3730a3 100%);
  border-radius: var(--radius);
  padding: 44px 36px;
  color: white;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.login-showcase::before {
  content: "";
  position: absolute;
  inset: -50% -20% auto auto;
  width: 60%;
  height: 80%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}
.login-showcase-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 18px;
}
.login-showcase-eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: rgba(255, 255, 255, 0.6);
}
.login-showcase h2 {
  color: white;
  font-size: 30px;
  line-height: 1.2;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.login-showcase p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  margin: 0 0 28px;
  max-width: 30em;
}
.feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.95);
}
.feature-list .feature-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.feature-list .feature-icon svg { width: 16px; height: 16px; }
.feature-list .feature-text strong {
  display: block;
  color: white;
  font-weight: 600;
  margin-bottom: 2px;
}
.feature-list .feature-text span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}
.platform-badges {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}
.platform-badges .pb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}
.platform-badges .pb svg { width: 14px; height: 14px; }

/* ─────────── FORMS ─────────── */
form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-top: 16px;
  margin-bottom: 6px;
}
form label:first-child { margin-top: 0; }

input, select, textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input::placeholder, textarea::placeholder { color: #9ca3af; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}
textarea { resize: vertical; min-height: 70px; }
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd' /%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 36px;
}

/* ─────────── BUTTONS ─────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 18px;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #2d3fa3 100%);
  color: white;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 4px 10px -4px rgba(30, 58, 138, 0.4);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-hover) 0%, #243388 100%);
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 8px 18px -6px rgba(30, 58, 138, 0.5);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-ghost {
  background: white;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover {
  background: var(--bg);
  border-color: var(--text-muted);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 10px -4px rgba(185, 28, 28, 0.4);
}
.btn-danger:hover {
  background: #991b1b;
  transform: translateY(-1px);
}

.btn-small { padding: 6px 12px; font-size: 12px; margin-top: 0; }
.btn-block { width: 100%; }

/* ─────────── TABS ─────────── */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
  padding: 6px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}
.tab svg { width: 16px; height: 16px; opacity: 0.7; }
.tab:hover {
  color: var(--text);
  background: var(--bg);
}
.tab:hover svg { opacity: 1; }
.tab.active {
  color: white;
  background: linear-gradient(135deg, var(--primary), #2d3fa3);
  box-shadow: 0 2px 6px -2px rgba(30, 58, 138, 0.4);
}
.tab.active svg { opacity: 1; }

.tab-panel { display: block; }
.tab-panel[hidden] { display: none; }

/* ─────────── CARD HEADER (con icono + título) ─────────── */
.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.card-header .card-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
}
.card-header .card-icon svg { width: 20px; height: 20px; }
.card-header.facebook .card-icon { background: var(--facebook-soft); color: var(--facebook); }
.card-header.instagram .card-icon {
  background: linear-gradient(135deg, #fdf2f8, #fef3c7);
  color: var(--instagram-b);
}
.card-header.whatsapp .card-icon { background: var(--whatsapp-soft); color: var(--whatsapp-dark); }
.card-header.messages .card-icon { background: var(--accent-soft); color: var(--accent); }
.card-header.danger .card-icon { background: var(--danger-bg); color: var(--danger); }
.card-header h2, .card-header h3 { margin: 0; }
.card-header .card-header-text { flex: 1; min-width: 0; }
.card-header .card-header-text .muted { margin: 2px 0 0; font-size: 13px; }

/* ─────────── STATUS GRID ─────────── */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.status-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  background: linear-gradient(180deg, #fbfcff 0%, white 100%);
  transition: transform var(--transition), box-shadow var(--transition);
}
.status-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.status-item h4 { margin: 0 0 8px; font-size: 13px; color: var(--text); font-weight: 600; }
.status-item .badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.badge-ok      { background: var(--success-bg); color: var(--success); }
.badge-warn    { background: var(--warning-bg); color: var(--warning); }
.badge-off     { background: #f3f4f6; color: var(--text-muted); }
.status-item .meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ─────────── CONNECT ROWS ─────────── */
.connect-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 0;
  border-top: 1px solid var(--border);
}
.connect-row:first-of-type { border-top: none; padding-top: 4px; }
.connect-row > div { flex: 1; }
.connect-row h3 { margin-bottom: 4px; }
.connect-row .muted { font-size: 13px; margin: 0; }
.connect-row .btn { flex-shrink: 0; margin-top: 0; }
.connect-row.danger {
  margin-top: 12px;
  padding: 16px;
  background: linear-gradient(180deg, #fff5f5, white);
  border: 1px dashed #fca5a5;
  border-radius: var(--radius-sm);
}
.connect-row.danger h3 { color: var(--danger); }

/* ─────────── ENTITY LIST ─────────── */
.entity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.entity-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.entity-list li:first-child { border-top: none; }
.entity-list .entity-name {
  font-weight: 600;
  color: var(--text-strong);
}
.entity-list .entity-id {
  font-size: 12px;
  color: var(--text-muted);
  font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
}
.entity-list .entity-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ─────────── EMPTY STATE ─────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 64px;
  height: 64px;
  opacity: 0.55;
  margin-bottom: 12px;
}
.empty-state-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.empty-state-detail {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─────────── MESSAGE LIST ─────────── */
.message-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.message-list li {
  padding: 16px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fbfcff;
  transition: transform var(--transition), box-shadow var(--transition);
}
.message-list li:hover {
  transform: translateX(2px);
  box-shadow: var(--shadow-sm);
}
.message-list .msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  gap: 10px;
}
.message-list .msg-sender { font-weight: 600; color: var(--text-strong); }
.message-list .msg-platform {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.message-list .msg-platform.messenger   { background: rgba(0, 132, 255, 0.10); color: var(--messenger); }
.message-list .msg-platform.instagram_dm { background: var(--instagram-soft); color: var(--instagram-b); }
.message-list .msg-platform.comment     { background: var(--accent-soft); color: var(--accent); }
.message-list .msg-text { color: var(--text); margin: 4px 0; }
.message-list .msg-time { font-size: 12px; color: var(--text-muted); }

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.filter-row label { font-size: 13px; font-weight: 600; margin: 0; }
.filter-row select { width: auto; min-width: 180px; }
.filter-row .btn { margin: 0; }

/* ─────────── TOASTS ─────────── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  max-width: 380px;
}
.toast {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: white;
  border-left: 4px solid var(--secondary);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  color: var(--text);
  animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warn    { border-left-color: var(--warning); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ─────────── FOOTER ─────────── */
.footer {
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.5);
  padding: 28px 28px 36px;
  margin-top: 40px;
}
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13px;
}
.footer-brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.footer-brand svg { width: 18px; height: 18px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }

/* ─────────── RESPONSIVE ─────────── */
@media (max-width: 900px) {
  .login-screen { grid-template-columns: 1fr; max-width: 520px; }
  .login-showcase { padding: 32px 28px; }
}
@media (max-width: 700px) {
  .container { padding: 20px 14px 60px; }
  .top-bar { padding: 12px 16px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding: 4px; }
  .tab { white-space: nowrap; min-width: max-content; flex: 0 0 auto; padding: 8px 12px; }
  .tab span { display: none; }
  .connect-row { flex-direction: column; align-items: stretch; }
  .connect-row .btn { width: 100%; }
  h1 { font-size: 24px; }
  .login-card { padding: 28px 24px; }
  .login-showcase h2 { font-size: 24px; }
}
