/* ==========================================================================
   MySocialPulse.io Dashboard
   Same design tokens as the marketing site (mysocialpulse.io) so the two
   feel like one product. Dashboard-specific components are added below.
   ========================================================================== */

:root {
  --ink: #0f172a;
  --ink2: #182238;
  --paper: #f8fafc;
  --muted: #64748b;
  --line: #e2e8f0;
  --white: #fff;
  --blue: #2563eb;
  --blue2: #1d4ed8;
  --cyan: #06b6d4;
  --green: #10b981;
  --red: #ef4444;
  --orange: #f59e0b;
  --shadow: 0 24px 80px rgba(15, 23, 42, .13);
  --shadow-sm: 0 14px 35px rgba(15, 23, 42, .06);
  --radius: 24px;
  --radius-sm: 16px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --sidebar-w: 264px;
  --sidebar-w-collapsed: 84px;
  --topbar-h: 76px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: rgba(37, 99, 235, .18); }

/* ---------- Buttons & pills (same as marketing site) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 900;
  font-size: .92rem; transition: .2s var(--ease); white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: linear-gradient(135deg, var(--blue), var(--cyan)); color: #fff; box-shadow: 0 14px 30px rgba(37, 99, 235, .28); }
.btn--soft { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm); color: var(--ink); }
.btn--danger { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.btn--secondary { background: #eff6ff; color: var(--blue); border: 1px solid #bfdbfe; margin-right: 8px; }
.btn--block { width: 100%; }
.btn--sm { padding: 9px 14px; font-size: .82rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 900;
  font-size: .78rem; padding: 5px 11px; border-radius: 999px;
}
.pill--blue { background: #eef7ff; color: var(--blue2); }
.pill--green { background: #ecfdf5; color: #15803d; }
.pill--red { background: #fef2f2; color: var(--red); }
.pill--muted { background: #f1f5f9; color: var(--muted); }

/* ---------- Auth pages (login) ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 40px 20px;
  background: radial-gradient(circle at 20% 10%, #eef7ff, var(--paper) 55%);
}
.auth-card {
  width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line);
  border-radius: 28px; padding: 38px 34px; box-shadow: var(--shadow); text-align: center;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.15rem; justify-content: center; }
.brand span span { color: var(--cyan); }
.brand__mark {
  width: 40px; height: 40px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan)); color: #fff;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .28); flex-shrink: 0;
}
.brand__mark svg { width: 24px; height: 24px; }
.brand__mark path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.auth-card h1 { font-size: 1.5rem; margin: 20px 0 6px; letter-spacing: -.03em; }
.auth-card p.sub { color: var(--muted); margin: 0 0 26px; font-size: .95rem; }
.auth-card form { display: grid; gap: 12px; text-align: left; }
.auth-card label { font-weight: 800; font-size: .82rem; color: #334155; }
.auth-card input {
  width: 100%; padding: 12px 13px; border: 1.5px solid var(--line); border-radius: 14px;
  background: #f8fafc; margin-top: 4px;
}
.auth-card input:focus { outline: none; border-color: var(--blue); background: #fff; }
.auth-card .btn { margin-top: 6px; }
.auth-links { margin-top: 20px; font-size: .88rem; color: var(--muted); }
.auth-links a { color: var(--blue); font-weight: 800; }
.status { min-height: 20px; font-weight: 800; font-size: .88rem; text-align: center; margin-top: 4px; }
.status--success { color: var(--green); }
.status--error { color: var(--red); }
.status--info { color: var(--blue); }

/* ==========================================================================
   Dashboard app shell
   ========================================================================== */

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; background: #0f172a; color: #fff;
  display: flex; flex-direction: column; padding: 22px 16px; position: sticky;
  top: 0; height: 100vh; transition: width .25s var(--ease); z-index: 40;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .nav-label, .sidebar.collapsed .brand-text, .sidebar.collapsed .sidebar-logout span { display: none; }
.sidebar .brand { justify-content: flex-start; padding: 6px 8px 26px; color: #fff; }
.sidebar-nav { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; flex-grow: 1; }
.nav-item {
  display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 14px;
  color: #cbd5e1; font-weight: 800; font-size: .92rem; transition: .2s var(--ease); cursor: pointer;
}
.nav-item i { font-size: 1.15rem; width: 22px; text-align: center; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--blue), var(--cyan)); color: #fff; box-shadow: 0 10px 26px rgba(37, 99, 235, .35); }
.sidebar-divider { border: 0; border-top: 1px solid rgba(255, 255, 255, .1); margin: 14px 0; }
.sidebar-logout {
  display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 14px;
  color: #fca5a5; font-weight: 800; font-size: .92rem; background: none; border: none; width: 100%; text-align: left;
}
.sidebar-logout:hover { background: rgba(239, 68, 68, .12); }

/* ---------- Main column ---------- */
.main-col { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 26px; position: sticky; top: 0; z-index: 30;
}
.topbar-toggle { background: none; border: 0; font-size: 1.3rem; color: var(--ink); padding: 6px; border-radius: 10px; }
.topbar-toggle:hover { background: #f1f5f9; }
.topbar-search {
  flex-grow: 1; max-width: 420px; display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px;
}
.topbar-search input { border: 0; background: none; outline: none; flex-grow: 1; font-size: .92rem; }
.topbar-search i { color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; color: var(--ink); position: relative; flex-shrink: 0;
}
.icon-btn:hover { background: #f1f5f9; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan)); color: #fff; font-weight: 900; flex-shrink: 0;
}

.page { padding: 26px; flex-grow: 1; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 1.6rem; letter-spacing: -.03em; margin: 0 0 4px; }
.page-head p { color: var(--muted); margin: 0; font-size: .95rem; }

/* ---------- Connect-accounts banner (reuses the all-access-card look) ---------- */
.connect-banner {
  background: linear-gradient(135deg, #0f172a, #1d4ed8 140%); color: #fff;
  border-radius: 26px; padding: 26px 30px; margin-bottom: 26px; box-shadow: 0 22px 50px rgba(29, 78, 216, .25);
}
.connect-banner h3 { margin: 10px 0 4px; font-size: 1.25rem; }
.connect-banner > p { margin: 0 0 20px; color: #cbd5e1; }
.connect-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.connect-card {
  display: flex; flex-direction: column; gap: 10px; background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 16px; padding: 14px 16px;
  min-width: 0;
}
.connect-card__top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.connect-card .platform-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 1.05rem; flex-shrink: 0; }
.connect-card strong { flex-grow: 1; font-size: .92rem; min-width: 0; overflow-wrap: anywhere; }
.connect-card__bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.connect-card .btn { padding: 8px 13px; font-size: .8rem; white-space: nowrap; }
.connect-card__progress { color: #cbd5e1; font-size: .78rem; font-weight: 700; white-space: nowrap; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 20px;
  box-shadow: var(--shadow-sm); transition: .2s var(--ease);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 1.2rem; margin-bottom: 14px; }
.stat-card strong { display: block; font-size: 1.7rem; letter-spacing: -.02em; }
.stat-card span { color: var(--muted); font-size: .85rem; font-weight: 700; }
.stat-delta { display: inline-flex; align-items: center; gap: 3px; font-size: .78rem; font-weight: 900; margin-top: 6px; }
.stat-delta.up { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* ---------- Generic cards / panels ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { margin: 0 0 3px; font-size: 1.08rem; }
.panel-head p { margin: 0; color: var(--muted); font-size: .85rem; }
.panel-grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 18px; }
.chart-box { height: 260px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table-wrap--scrollable { max-height: 560px; overflow-y: auto; }
.table-wrap--scrollable thead th { position: sticky; top: 0; background: #fff; z-index: 1; box-shadow: 0 1px 0 var(--line); }
table.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th {
  text-align: left; color: var(--muted); font-weight: 800; font-size: .76rem;
  text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 2px solid var(--line);
}
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:hover td { background: #f8fafc; }
.platform-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: .76rem; font-weight: 900; color: #fff;
}
.post-account-label { font-size: .72rem; color: var(--muted); font-weight: 700; margin-top: 3px; }
.post-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #e2e8f0; }

/* ---------- Filters row ---------- */
.filters-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filters-row select, .filters-row input[type="date"] {
  padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: .86rem;
}

/* ---------- Empty / loading states ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state i { font-size: 2.2rem; color: #cbd5e1; margin-bottom: 10px; display: block; }
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f6f9fc 37%, #eef2f7 63%); background-size: 400% 100%; animation: skeleton 1.4s ease infinite; border-radius: 14px; }
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: start; }
.settings-list { display: grid; gap: 6px; }
.settings-item { padding: 12px 14px; border-radius: 12px; font-weight: 800; color: var(--muted); cursor: pointer; }
.settings-item.active { background: #eef7ff; color: var(--blue2); }
.profile-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.profile-row .avatar { width: 56px; height: 56px; border-radius: 16px; font-size: 1.3rem; }

/* ---------- Blocked platform modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  background: #fff; border-radius: 26px; max-width: 380px; width: 100%; text-align: center;
  padding: 44px 32px 32px; position: relative; box-shadow: 0 30px 70px rgba(0, 0, 0, .3);
  animation: modal-in .25s var(--ease);
}
@keyframes modal-in { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-badge {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%); width: 64px; height: 64px;
  border-radius: 50%; display: grid; place-items: center; box-shadow: 0 12px 28px rgba(0, 0, 0, .25); border: 4px solid #fff;
}
.modal-badge i { color: #fff; font-size: 26px; }
.modal-card h3 { margin: 12px 0 8px; font-size: 1.2rem; }
.modal-card p { color: var(--muted); margin: 0 0 22px; font-size: .92rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #0f172a; color: #fff; padding: 14px 20px;
  border-radius: 14px; box-shadow: 0 20px 45px rgba(0, 0, 0, .3); font-weight: 700; font-size: .88rem;
  display: flex; align-items: center; gap: 10px; z-index: 300; transform: translateY(20px); opacity: 0;
  transition: .25s var(--ease); pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success i { color: #34d399; }
.toast.error i { color: #f87171; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .panel-grid-2 { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -100%; height: 100vh; transition: left .25s var(--ease); box-shadow: var(--shadow); }
  .sidebar.mobile-open { left: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-search { display: none; }
  .page { padding: 16px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
}
