/* ============================================================
   Professional Network -- visual system v2
   Colorful, glassmorphism, CSS-only "3D" hover lift.
   No external fonts/icon libraries/JS frameworks: everything here
   is plain CSS3 so the site stays fast to load. --primary/--accent
   are overridden per-request from Admin > Settings (see
   BrandingHelper), everything else derives from them or from the
   fixed supporting palette below.
   ============================================================ */

:root {
  --primary: #6d28d9;
  --primary-dark: #4c1d95;
  --accent: #ec4899;
  --accent-dark: #be185d;

  --teal: #0d9488;
  --gold: #d97706;
  --coral: #f43f5e;
  --sky: #0284c7;

  --bg-1: #f5f3ff;
  --bg-2: #fdf2f8;
  --bg-3: #eff6ff;

  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(255, 255, 255, 0.6);
  --text: #1e1b2e;
  --text-muted: #6b6480;
  --danger: #b91c1c;
  --danger-bg: #fdecea;
  --success: #0f7b3d;
  --success-bg: #e6f4ea;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-soft: 0 8px 24px rgba(109, 40, 217, 0.10), 0 2px 6px rgba(109, 40, 217, 0.08);
  --shadow-lift: 0 20px 40px rgba(109, 40, 217, 0.22), 0 8px 16px rgba(236, 72, 153, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 8%, var(--bg-1) 0%, transparent 45%),
    radial-gradient(circle at 92% 18%, var(--bg-2) 0%, transparent 45%),
    radial-gradient(circle at 30% 92%, var(--bg-3) 0%, transparent 50%),
    #faf9fc;
  background-attachment: fixed;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent-dark); }

.icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-lg { width: 26px; height: 26px; }
.icon-sm { width: 14px; height: 14px; }

/* ---------------- Navbar ---------------- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}
.navbar .brand {
  font-size: 21px;
  font-weight: 800;
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar .brand .icon { color: var(--primary); -webkit-text-fill-color: initial; }
.navbar .nav-right { display: flex; gap: 6px; align-items: center; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.nav-link:hover { background: rgba(109, 40, 217, 0.10); color: var(--primary); transform: translateY(-1px); text-decoration: none; }
.nav-link .label { display: inline; }
@media (max-width: 720px) {
  .nav-link .label { display: none; }
  .nav-link { padding: 8px; }
}

/* ---------------- Auth pages ---------------- */
.auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  width: 100%;
  max-width: 420px;
}
.auth-card h2 {
  margin-top: 0;
  text-align: center;
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 26px;
}
.auth-tagline { text-align: center; color: var(--text-muted); margin-top: -8px; margin-bottom: 20px; font-size: 14px; }
.auth-logo {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 800; font-size: 19px; color: var(--primary); margin-bottom: 4px;
}
.auth-logo .icon { width: 26px; height: 26px; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13.5px; color: var(--text); }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #ded9ec;
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: rgba(255, 255, 255, 0.85);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.14);
}
.hint { color: var(--text-muted); font-size: 12px; }
.field-error { color: var(--danger); font-size: 12px; display: block; margin-top: 4px; }
.checkbox-group { display: flex; align-items: center; gap: 8px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn-primary {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 6px 16px rgba(109, 40, 217, 0.32);
}
.btn-primary:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 10px 22px rgba(109, 40, 217, 0.4); }
.btn-secondary { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-secondary:hover { background: rgba(109, 40, 217, 0.08); transform: translateY(-1px); }
.btn-light { background: rgba(109, 40, 217, 0.08); color: var(--text); }
.btn-light:hover { background: rgba(109, 40, 217, 0.16); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #fbd8d5; }
.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-icon {
  width: 36px; height: 36px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(109, 40, 217, 0.08); color: var(--text-muted); border: none;
}
.btn-icon:hover { background: rgba(109, 40, 217, 0.16); color: var(--primary); transform: translateY(-1px); }
.btn-icon.active { color: var(--coral); background: rgba(244, 63, 94, 0.12); }

/* ---------------- Alerts / badges ---------------- */
.alert { padding: 11px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-public { background: rgba(2, 132, 199, 0.12); color: var(--sky); }
.badge-private { background: rgba(107, 100, 128, 0.14); color: var(--text-muted); }

/* ---------------- "3D" cards --------------
   Pure-CSS tilt: perspective on the parent, transform on hover. No JS,
   no WebGL -- cheap, GPU-composited (transform + box-shadow only), so
   it stays smooth even on low-end phones. */
.tilt-wrap { perspective: 900px; }
.card-3d {
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.25s ease;
  transform-style: preserve-3d;
}
.card-3d:hover {
  transform: translateY(-6px) rotateX(2deg) rotateY(-1.5deg);
  box-shadow: var(--shadow-lift);
}

/* ---------------- Layout shell ---------------- */
.page-shell {
  max-width: 1080px;
  margin: 24px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}
.page-shell.narrow { grid-template-columns: 1fr; max-width: 680px; }
@media (max-width: 860px) {
  .page-shell { grid-template-columns: 1fr; }
  .sidebar-col { order: 2; }
}

.sidebar-col { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 84px; }
.main-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------------- Profile summary card ---------------- */
.profile-mini { padding: 20px; text-align: center; }
.dp-ring {
  width: 88px; height: 88px; border-radius: 50%; margin: 0 auto 12px;
  padding: 3px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
}
.dp-ring img, .dp-ring .dp-fallback {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  border: 3px solid #fff; background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-weight: 800; font-size: 28px;
}
.dp-ring.sm { width: 40px; height: 40px; padding: 2px; }
.dp-ring.sm .dp-fallback { font-size: 15px; border-width: 2px; }
.dp-ring.lg { width: 128px; height: 128px; padding: 4px; }
.dp-ring.lg .dp-fallback { font-size: 40px; }

.profile-mini h3 { margin: 4px 0 0; font-size: 17px; }
.profile-mini .designation { color: var(--text-muted); font-size: 13px; margin: 2px 0; }
.profile-mini .meta-row { display: flex; align-items: center; justify-content: center; gap: 5px; color: var(--text-muted); font-size: 12.5px; margin-top: 6px; }

/* ---------------- Search box ---------------- */
.search-box {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.85); border: 1.5px solid #ded9ec;
}
.search-box input { border: none; outline: none; background: transparent; flex: 1; font-size: 14px; }
.search-box .icon { color: var(--text-muted); }

/* ---------------- Feed / posts ---------------- */
.create-post-card, .post-card, .profile-card { padding: 20px; }
.post-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 12px; flex-wrap: wrap; }
.visibility-toggle { display: flex; gap: 6px; align-items: center; }

.post-header { display: flex; align-items: flex-start; gap: 10px; }
.post-header .who { flex: 1; min-width: 0; }
.post-header strong { display: block; font-size: 14.5px; }
.post-header small { color: var(--text-muted); font-size: 12.5px; }
.post-date { color: var(--text-muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.post-body { margin-top: 10px; }
.post-body p { white-space: pre-wrap; margin: 0 0 8px; line-height: 1.5; }
.post-img { max-width: 100%; border-radius: var(--radius-sm); margin-top: 4px; display: block; }
.post-footer { margin-top: 12px; border-top: 1px solid rgba(109,40,217,0.10); padding-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.post-footer .btn-light { display: inline-flex; align-items: center; gap: 6px; }
.empty-state { display: block; text-align: center; color: var(--text-muted); padding: 40px 0; }

/* ---------------- Comments / replies ---------------- */
.comments-section { margin-top: 12px; border-top: 1px solid rgba(109,40,217,0.10); padding-top: 12px; }
.comment-item { display: flex; gap: 8px; margin-bottom: 10px; }
.comment-bubble { background: rgba(109,40,217,0.06); border-radius: 14px; padding: 8px 13px; flex: 1; }
.comment-bubble .cname { font-weight: 700; font-size: 13px; }
.comment-bubble .ctext { font-size: 13.5px; margin-top: 2px; white-space: pre-wrap; }
.comment-meta { display: flex; gap: 12px; margin-top: 4px; font-size: 11.5px; color: var(--text-muted); }
.comment-meta button { background: none; border: none; padding: 0; color: var(--text-muted); font-size: 11.5px; font-weight: 700; cursor: pointer; }
.comment-meta button:hover { color: var(--primary); }
.replies { margin-left: 36px; margin-top: 6px; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; align-items: center; }
.comment-form input[type=text] { flex: 1; padding: 8px 13px; border-radius: 999px; border: 1.5px solid #ded9ec; font-size: 13.5px; }

/* ---------------- Share menu ---------------- */
.share-menu { display: none; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.share-menu a.btn-icon { text-decoration: none; }

/* ---------------- Collapsible sections (comments, etc.) ----------------
   Rendered server-side on first load, then shown/hidden purely with CSS
   via appToggle() in js/app.js -- no extra postback/request needed to
   open a post's comments. */
.collapsible { display: none; }
.collapsible.open { display: block; }

/* Inline comment/reply edit form, toggled by appShowEdit/appHideEdit */
.inline-edit-form { display: none; gap: 8px; align-items: center; }

/* ---------------- Profile page ---------------- */
.profile-header-card { padding: 28px; text-align: center; position: relative; overflow: hidden; }
.profile-header-card::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(120deg, rgba(109,40,217,0.10), rgba(236,72,153,0.10));
}
.profile-header-card > * { position: relative; z-index: 1; }
.profile-header-card .full-name { font-size: 24px; font-weight: 800; margin: 10px 0 0; }
.profile-header-card .designation { color: var(--text-muted); font-size: 15px; }
.profile-tags { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.profile-tag { display: inline-flex; align-items: center; gap: 5px; background: rgba(109,40,217,0.08); color: var(--primary); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; }

.section-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 800; margin: 0 0 12px; color: var(--text); }
.section-title .icon { color: var(--primary); }

.experience-item, .education-item {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid rgba(109,40,217,0.08);
}
.experience-item:last-child, .education-item:last-child { border-bottom: none; }
.experience-item .duration, .education-item .year { color: var(--text-muted); font-size: 12.5px; }
.item-form { border-top: 1px solid rgba(109,40,217,0.10); padding-top: 16px; margin-top: 8px; }
.item-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .item-form .form-row { grid-template-columns: 1fr; } }

.social-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .social-grid { grid-template-columns: 1fr; } }
.social-row { display: flex; align-items: center; gap: 8px; }
.social-row .icon { color: var(--text-muted); flex-shrink: 0; }

/* ---------------- Timeline ---------------- */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: linear-gradient(var(--primary), var(--accent)); border-radius: 2px; }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -28px; top: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2px solid var(--primary); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.timeline-dot .icon { width: 11px; height: 11px; }
.timeline-item .t-title { font-weight: 700; font-size: 14px; }
.timeline-item .t-date { color: var(--text-muted); font-size: 12px; }
.timeline-item .t-desc { font-size: 13.5px; margin-top: 2px; }

/* ---------------- Admin ---------------- */
.admin-wrapper { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; padding: 20px; min-height: 100vh;
  background: rgba(255,255,255,0.7); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-right: 1px solid var(--card-border);
}
.sidebar h3 { margin-top: 0; background: linear-gradient(120deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sidebar a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); margin-bottom: 4px; font-weight: 600; font-size: 14px; }
.sidebar a.active, .sidebar a:hover { background: rgba(109,40,217,0.10); text-decoration: none; color: var(--primary); }
.content { flex: 1; padding: 28px; max-width: 980px; }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 28px; }
.metrics-grid .card { padding: 18px 20px; }
.metrics-grid .card .num { font-size: 26px; font-weight: 800; background: linear-gradient(120deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; display: block; }
.metrics-grid .card .label { color: var(--text-muted); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }

.log-row { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(109,40,217,0.08); font-size: 13.5px; }
.log-time { color: var(--text-muted); min-width: 125px; }
.log-action { font-weight: 700; min-width: 150px; }
.log-details { color: var(--text-muted); }

.admin-table { width: 100%; border-collapse: collapse; overflow: hidden; }
.admin-table th, .admin-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid rgba(109,40,217,0.08); font-size: 13.5px; }
.admin-table th { background: rgba(109,40,217,0.06); font-weight: 700; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; margin-bottom: 18px; flex-wrap: wrap; }
.tab-link { padding: 9px 16px; border-radius: 999px; font-weight: 700; font-size: 13.5px; color: var(--text-muted); background: rgba(109,40,217,0.06); }
.tab-link.active { background: linear-gradient(120deg, var(--primary), var(--accent)); color: #fff; }
.color-swatch { width: 22px; height: 22px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-right: 6px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }

/* ---------------- Public pages ---------------- */
.public-banner {
  text-align: center; padding: 10px; font-size: 12.5px; color: var(--text-muted);
  background: rgba(109,40,217,0.06); border-radius: var(--radius-sm); margin-bottom: 16px;
}

@media (max-width: 720px) {
  .admin-wrapper { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; display: flex; gap: 6px; overflow-x: auto; white-space: nowrap; }
  .sidebar a span.label { display: none; }
}
