/* ═══════════════════════════════════════════════════════════════════
   PBC Platform — main.css
   Covers: auth pages, admin portal, client portal
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700&family=DM+Sans:wght@300;400;500&display=swap');

/* ── Reset & base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #8c52ff;
  --brand-light: #ede8ff;
  --brand-dark:  #6b3de8;
  --teal:        #01e5c3;
  --dark:        #0f0f0f;
  --text:        #1a1a1a;
  --text-mid:    #555;
  --text-muted:  #888;
  --border:      #e8e8e4;
  --surface:     #f7f7f5;
  --white:       #ffffff;
  --radius:      10px;
  --radius-lg:   16px;
  --sidebar-w:   240px;

  /* Status colours */
  --c-success: #16a34a;
  --c-warning: #d97706;
  --c-danger:  #dc2626;
  --c-info:    #2563eb;

  --bg-success: #dcfce7;
  --bg-warning: #fef3c7;
  --bg-danger:  #fee2e2;
  --bg-info:    #dbeafe;
}

html { font-size: 16px; }
body { font-family: 'DM Sans', sans-serif; color: var(--text); background: var(--surface); line-height: 1.6; }
h1, h2, h3, h4 { font-family: 'Syne', sans-serif; font-weight: 600; line-height: 1.2; }
a { color: var(--brand); }
img { max-width: 100%; }

/* ── Auth layout ──────────────────────────────────────────────────── */
.auth-body { background: var(--white); min-height: 100vh; }

.auth-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

.auth-brand-panel {
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 3rem;
}

.auth-brand-inner { max-width: 340px; }

.auth-logo { margin-bottom: 3rem; }
.logo-mark {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: .04em;
}

.auth-headline {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 1.2rem;
}
.auth-headline em { font-style: normal; color: var(--teal); }
.auth-sub { color: #666; font-size: .95rem; line-height: 1.7; }

.auth-dots { display: flex; gap: .5rem; margin-top: 3rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-1 { background: var(--brand); }
.dot-2 { background: var(--teal); }
.dot-3 { background: #333; }

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 3rem;
}

.auth-form-inner { width: 100%; max-width: 380px; }

.form-title { font-size: 1.8rem; margin-bottom: .4rem; }
.form-subtitle { color: var(--text-muted); margin-bottom: 2rem; font-size: .95rem; }

.auth-form { display: flex; flex-direction: column; gap: 1.2rem; }

.auth-link { margin-top: 1.5rem; font-size: .88rem; color: var(--text-muted); text-align: center; }
.auth-link a { color: var(--brand); text-decoration: none; font-weight: 500; }
.auth-link a:hover { text-decoration: underline; }

@media (max-width: 700px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-brand-panel { display: none; }
}

/* ── Portal layout ────────────────────────────────────────────────── */
.portal-body { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform .25s ease;
}

.sidebar-brand {
  padding: 1.5rem 1.4rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid #1e1e1e;
}
.brand-mark { font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700; color: var(--brand); }
.brand-name { font-family: 'Syne', sans-serif; font-size: .85rem; font-weight: 500; color: #555; }

.sidebar-nav {
  flex: 1;
  padding: 1.2rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .2rem;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .65rem .9rem;
  border-radius: 8px;
  text-decoration: none;
  color: #777;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
}
.nav-item:hover { background: #181818; color: #ccc; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.active svg { stroke: #fff; }

.nav-badge {
  margin-left: auto;
  background: #ff4444;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem .8rem;
  border-top: 1px solid #1e1e1e;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .4rem;
  margin-bottom: .6rem;
}
.user-avatar {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: .82rem; color: #ddd; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .72rem; color: #555; text-transform: capitalize; }

.btn-logout {
  width: 100%;
  padding: .55rem;
  background: transparent;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  color: #555;
  font-size: .8rem;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .2s, color .2s;
}
.btn-logout:hover { border-color: #444; color: #aaa; }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: .8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}

.sidebar-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: .3rem;
}
.sidebar-toggle span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; }

.top-bar-right { display: flex; align-items: center; gap: 1rem; }

.page-body { flex: 1; padding: 2rem 2.5rem; max-width: 1200px; }

/* ── Page header ──────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.6rem; font-weight: 700; margin-bottom: .2rem; }
.page-subtitle { color: var(--text-muted); font-size: .9rem; }

/* ── Stats grid ───────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.stat-card-accent { border-left: 3px solid var(--brand); }
.stat-label { font-size: .78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 2rem; font-weight: 700; line-height: 1; }

/* ── Section card ─────────────────────────────────────────────────── */
.section-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}
.section-title { font-size: 1rem; font-weight: 700; }
.section-link { font-size: .82rem; color: var(--brand); text-decoration: none; }
.section-link:hover { text-decoration: underline; }

/* ── Data table ───────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.data-table th {
  text-align: left;
  padding: .6rem .8rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1.5px solid var(--border);
}
.data-table td {
  padding: .8rem .8rem;
  border-bottom: 1px solid #f0f0ee;
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafaf8; }

.cell-name { font-weight: 500; }
.cell-sub { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.cell-notes { color: var(--text-mid); max-width: 260px; }
.cell-avatar-row { display: flex; align-items: center; gap: .6rem; }

/* ── Badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success  { background: var(--bg-success); color: var(--c-success); }
.badge-warning  { background: var(--bg-warning); color: var(--c-warning); }
.badge-danger   { background: var(--bg-danger);  color: var(--c-danger); }
.badge-info     { background: var(--bg-info);    color: var(--c-info); }
.badge-primary  { background: var(--brand-light); color: var(--brand-dark); }
.badge-secondary { background: #f0f0ee; color: #777; }

/* ── Buttons ──────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--brand);
  color: #fff;
  padding: .65rem 1.4rem;
  border: none;
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 600;
  font-family: 'Syne', sans-serif;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: opacity .2s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: .88; }
.btn-primary.btn-full { width: 100%; text-align: center; }

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  padding: .65rem 1.4rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: border-color .2s;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.btn-sm {
  padding: .35rem .85rem;
  font-size: .78rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .2s;
}
.btn-sm:hover { border-color: var(--brand); color: var(--brand); }

/* ── Forms ────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .45rem; }
.field label { font-size: .83rem; font-weight: 500; color: var(--text-mid); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea,
select {
  padding: .7rem .95rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color .2s;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
}
textarea { min-height: 90px; resize: vertical; }

.form-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 760px;
}
.form-section { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; }
.form-section-title { font-size: .95rem; font-weight: 700; margin-bottom: .3rem; }
.form-section-desc { font-size: .83rem; color: var(--text-muted); margin-bottom: 1.2rem; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.field-full { grid-column: 1 / -1; }

.form-actions { display: flex; gap: 1rem; align-items: center; justify-content: flex-end; padding-top: .5rem; }

.select-sm {
  padding: .35rem .6rem;
  font-size: .8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  font-family: inherit;
}
.inline-form { display: flex; align-items: center; gap: .4rem; }

/* ── Alerts ───────────────────────────────────────────────────────── */
.alert { padding: .8rem 1rem; border-radius: 8px; font-size: .875rem; margin-bottom: 1rem; }
.alert-danger  { background: var(--bg-danger);  color: var(--c-danger);  border: 1px solid #fca5a5; }
.alert-success { background: var(--bg-success); color: var(--c-success); border: 1px solid #86efac; }
.alert-info    { background: var(--bg-info);    color: var(--c-info);    border: 1px solid #93c5fd; }

/* ── Empty states ─────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state h3 { font-size: 1rem; color: var(--text-mid); margin-bottom: .4rem; }
.empty-state p  { font-size: .875rem; margin-bottom: 1.2rem; }

/* ── Client grid ──────────────────────────────────────────────────── */
.client-grid { display: flex; flex-direction: column; gap: .6rem; }
.client-chip { display: flex; align-items: center; gap: .8rem; padding: .8rem; border-radius: 8px; border: 1px solid var(--border); }
.client-chip:hover { background: var(--surface); }
.client-avatar { width: 36px; height: 36px; background: var(--brand-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; color: var(--brand); flex-shrink: 0; }
.client-info { flex: 1; min-width: 0; }
.client-name { font-size: .875rem; font-weight: 500; display: block; }
.client-email { font-size: .78rem; color: var(--text-muted); }

/* ── Mini avatar ──────────────────────────────────────────────────── */
.mini-avatar { width: 28px; height: 28px; background: var(--brand-light); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .68rem; font-weight: 700; color: var(--brand); flex-shrink: 0; }

/* ── Onboarding card ──────────────────────────────────────────────── */
.onboarding-card {
  background: var(--brand);
  border-radius: var(--radius-lg);
  padding: 1.8rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
}
.onboarding-content { display: flex; align-items: center; gap: 1.2rem; }
.onboarding-icon { color: rgba(255,255,255,.7); flex-shrink: 0; }
.onboarding-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 1.05rem; color: #fff; margin-bottom: .3rem; }
.onboarding-text { font-size: .875rem; color: rgba(255,255,255,.75); }
.onboarding-card .btn-primary { background: #fff; color: var(--brand); }

/* ── Site info grid ───────────────────────────────────────────────── */
.site-info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.2rem; }
.site-info-item { display: flex; flex-direction: column; gap: .3rem; }
.info-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.info-value { font-size: .9rem; font-weight: 500; }

/* ── Feature pills ────────────────────────────────────────────────── */
.feature-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.pill { background: var(--brand-light); color: var(--brand-dark); padding: .18rem .65rem; border-radius: 999px; font-size: .72rem; font-weight: 600; }

/* ── Template picker ──────────────────────────────────────────────── */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.template-option { cursor: pointer; }
.template-option input { display: none; }
.template-card {
  display: block;
  padding: .8rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  text-align: center;
  transition: border-color .2s, background .2s;
}
.template-option input:checked + .template-card {
  border-color: var(--brand);
  background: var(--brand-light);
}
.template-name { font-size: .82rem; font-weight: 500; }

/* ── Color input ──────────────────────────────────────────────────── */
.color-input-row { display: flex; align-items: center; gap: .8rem; }
input[type="color"] { width: 44px; height: 36px; padding: 2px 4px; border-radius: 8px; cursor: pointer; flex-shrink: 0; }
.color-hint { font-size: .8rem; color: var(--text-muted); }

/* ── Misc ─────────────────────────────────────────────────────────── */
.link-mono { font-family: monospace; font-size: .82rem; color: var(--brand); text-decoration: none; }
.link-mono:hover { text-decoration: underline; }

/* ── Mobile sidebar ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: flex; }
  .main-content { margin-left: 0; }
  .page-body { padding: 1.2rem 1rem; }
  .field-grid { grid-template-columns: 1fr; }
}
