/* ===========================================
   Visionary Networking — Global Dark Theme
   Black base — Red primary — Gold accents
   =========================================== */

:root {
  --primary: #e53935;
  --primary-soft: #ff6b6b;
  --secondary: #ffcc33;
  --secondary-soft: #ffd766;

  --bg-very-dark: #050505;
  --bg-dark: #0d0d0e;
  --panel: rgba(255,255,255,0.03);
  --glass-border: rgba(255,255,255,0.06);

  --text: #f2f2f2;
  --muted: rgba(242,242,242,0.58);

  --radius: 12px;
  --shadow: 0 10px 40px rgba(0,0,0,0.75);

  /* FIX: missing variable, used in modal */
  --surface: #111;
}

/* Light mode */
body[data-theme="light"] {
  --bg-very-dark: #f6f7f9;
  --bg-dark: #eceff1;
  --panel: rgba(0,0,0,0.04);
  --glass-border: rgba(0,0,0,0.08);
  --text: #0c0c0c;
  --muted: rgba(0,0,0,0.55);
}

/* ========================
   Base Layout
   ======================== */

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
}

body {
  background:
    radial-gradient(900px at 10% 0%, rgba(255,204,51,0.06), transparent),
    radial-gradient(600px at 100% 90%, rgba(229,57,53,0.04), transparent),
    var(--bg-very-dark);
  color: var(--text);
  padding: 18px;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ========================
   Header
   ======================== */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.header--stacked {
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--secondary), var(--secondary-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #000;
}

.app-title {
  font-weight: 700;
  color: var(--secondary);
}

.subtext {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ========================
   Buttons & Controls
   ======================== */

.controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(90deg, var(--primary), var(--primary-soft));
  color: #fff;
  font-weight: 700;
}

/* ========================
   Category Filters
   ======================== */

.category-filters {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.01);
  cursor: pointer;
  color: var(--muted);
}

.chip.active {
  background: linear-gradient(90deg, var(--secondary), var(--secondary-soft));
  color: #000;
  border-color: transparent;
}

/* Search */
.search-wrap {
  display: flex;
  gap: 8px;
  margin-left: 12px;
}

.search {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.02);
  color: var(--text);
  width: 260px;
}

/* ========================
   Views
   ======================== */

.main-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 12px 0;
}

.view { display: none; }
.view.active { display: block; }

/* ========================
   Tinder Deck
   ======================== */

.post-deck-wrap {
  position: relative;
  min-height: 520px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 8px;
}

.post-deck {
  width: min(560px, 92%);
  height: 520px;
  position: relative;
  perspective: 1400px;
}

.deck-card {
  position: absolute;
  inset: 0;
  margin: 0 auto;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--glass-border);
  box-shadow: 0 30px 60px rgba(0,0,0,0.65);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 300ms ease, opacity 300ms ease;
  touch-action: none;
  user-select: none;
}

/* Stack offsets */
.deck-card[data-index="0"] { transform: translateY(0) scale(1); }
.deck-card[data-index="1"] { transform: translateY(10px) scale(.98); }
.deck-card[data-index="2"] { transform: translateY(18px) scale(.96); }
.deck-card[data-index="3"] { transform: translateY(26px) scale(.94); }
.deck-card[data-index="4"] { transform: translateY(34px) scale(.92); }

/* Card content */
.deck-card .card-photo {
  width: 100%;
  height: 60%;
  object-fit: cover;
  background: #000;
}

.deck-card .card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.deck-card .card-head {
  display: flex;
  gap: 10px;
  align-items: center;
}

.deck-card .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.04);
}

.deck-card .user {
  font-weight: 700;
  color: var(--secondary);
}

.deck-card .caption {
  color: var(--muted);
  font-size: 0.95rem;
  overflow: hidden;
}

/* Action badges */
.deck-badge {
  position: absolute;
  top: 18px;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  opacity: 0;
  transform: scale(.98);
  transition: opacity 120ms, transform 120ms;
  pointer-events: none;
}

.deck-badge.left {
  left: 18px;
  background: rgba(230,57,53,0.95);
  color: #fff;
}

.deck-badge.right {
  right: 18px;
  background: rgba(0,200,120,0.95);
  color: #001;
}

/* ========================
   Modal (Create Post)
   ======================== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 5000;
}

/* CRITICAL FIX: hide modal when hidden attr is applied */
.modal[hidden] {
  display: none !important;
}

.modal-content {
  background: var(--surface);
  color: var(--text);
  width: 90%;
  max-width: 420px;
  padding: 20px;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

/* Floating action button */
.fab-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
  z-index: 4000;
}

/* ========================
   Grid Feed
   ======================== */

.feed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px,1fr));
  gap: 18px;
}

.post-card {
  background: var(--panel);
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.post-photo {
  width: 100%;
  height: 420px;
  object-fit: cover;
  background: #000;
}

.post-meta {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.post-head .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.post-head .user {
  font-weight: 700;
  color: var(--secondary);
}

.post-caption {
  color: var(--muted);
  font-size: 0.95rem;
}

.post-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

/* ========================
   Profiles
   ======================== */

.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px,1fr));
  gap: 18px;
}

.profile-card {
  background: var(--panel);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  text-align: center;
}

.profile-card .photo {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: 10px;
}

.profile-card h3 {
  margin: 0;
  color: var(--secondary);
}

.role, .bio {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ========================
   Empty
   ======================== */

.empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

/* ========================
   Footer
   ======================== */

.footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.02);
}

/* ========================
   Responsiveness
   ======================== */

@media (max-width:900px) {
  .search { width: 140px; }
  .post-photo { height: 320px; }
}

@media (max-width:600px) {
  .logo { width: 40px; height: 40px; }
  .feed-grid { grid-template-columns: 1fr; }
  .profiles-grid { grid-template-columns: repeat(2, 1fr); }
  .search { width: 120px; }
}
#feedGrid {
  margin-top: 18px;
}
