:root {
  --bg: #0b1220;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-strong: rgba(255, 255, 255, 0.10);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.70);
  --muted-2: rgba(255, 255, 255, 0.55);
  --shadow: 0 14px 50px rgba(0, 0, 0, 0.35);

  --brand: #7c3aed;
  --brand-2: #22c55e;
  --accent: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --container: 1120px;
  --transition-speed: 0.22s;

  /* Backward-compat vars used in existing pages */
  --primary-color: var(--brand);
  --secondary-color: #5b21b6;
  --accent-color: var(--accent);
  --background-color: var(--bg);
  --text-color: var(--text);
  --card-background: rgba(255, 255, 255, 0.06);
  --card-bg: var(--card-background);
  --bg-color: rgba(255, 255, 255, 0.04);
  --primary-dark: #5b21b6;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background:
    radial-gradient(900px 420px at 20% 10%, rgba(124, 58, 237, 0.30), transparent 55%),
    radial-gradient(900px 420px at 85% 15%, rgba(34, 197, 94, 0.22), transparent 55%),
    radial-gradient(900px 520px at 50% 95%, rgba(245, 158, 11, 0.10), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---- Site header + nav (new look, old markup compatible) ---- */
header {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: rgba(11, 18, 32, 0.70);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

header h1 {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem 1rem 0.5rem;
  font-size: 1.15rem;
  letter-spacing: 0.3px;
  font-weight: 800;
  color: var(--text);
}

nav {
  background: transparent;
  position: sticky;
  top: 52px;
  z-index: 1050;
  border-bottom: 1px solid var(--border);
}

nav ul {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
  flex-wrap: wrap;
  padding: 0.75rem 1rem;
}

nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 999px;
  transition: background-color var(--transition-speed), border-color var(--transition-speed), color var(--transition-speed), transform var(--transition-speed);
  background: rgba(255, 255, 255, 0.02);
}

nav a:hover {
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(124, 58, 237, 0.30);
  color: var(--text);
  transform: translateY(-1px);
}

main {
  max-width: var(--container);
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}

/* ---- Cards / posts ---- */
.post {
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition-speed), border-color var(--transition-speed), background-color var(--transition-speed);
  overflow: hidden;
}

.post:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.post h2 {
  color: var(--text);
  margin-bottom: 0.65rem;
  font-size: 1.15rem;
  letter-spacing: 0.2px;
}

.post h2 a {
  text-decoration: none;
}

.post h2 a:hover {
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
}

.post img {
  width: 100%;
  border-radius: var(--radius-md);
  margin-bottom: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.post-content p {
  color: var(--muted);
}

.post-date {
  color: var(--muted-2);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.95), rgba(34, 197, 94, 0.85));
  color: white;
  text-decoration: none;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.2px;
  transition: transform var(--transition-speed), filter var(--transition-speed);
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn:active {
  transform: translateY(0);
}

/* ---- Layout helpers (used by multiple pages) ---- */
.page-hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 1.25rem;
  align-items: center;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-top: 0.5rem;
}

.page-hero h1 {
  font-size: 2.2rem;
  line-height: 1.15;
  margin-bottom: 0.65rem;
}

.page-hero p {
  color: var(--muted);
}

.page-hero .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 650;
  letter-spacing: 0.15px;
  font-size: 0.9rem;
  text-decoration: none;
  transition: transform var(--transition-speed), background-color var(--transition-speed), border-color var(--transition-speed), color var(--transition-speed);
}

.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.14);
  color: var(--text);
}

.section {
  margin-top: 1.25rem;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.25rem 0 0.75rem;
}

.section-title h2 {
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: 0.2px;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition-speed), border-color var(--transition-speed);
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.18);
}

.card .card-media {
  height: 160px;
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.card .card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

.card .card-body {
  padding: 1rem;
}

.card .card-body h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.card .card-body p {
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.card .card-actions {
  padding: 0 1rem 1rem;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

/* ---- Post details modal / actions ---- */
.post-meta {
  color: var(--muted-2);
  font-size: 0.9rem;
  margin-bottom: 0.85rem;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.16);
  color: rgba(255, 255, 255, 0.95);
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition-speed), background-color var(--transition-speed), border-color var(--transition-speed);
}

.delete-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.22);
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0.75rem;
  color: var(--muted);
  text-decoration: none;
}

.back-btn:hover {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.25);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 420px);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11, 18, 32, 0.92), rgba(11, 18, 32, 0.82));
  box-shadow: var(--shadow);
  text-align: left;
}

.modal-title {
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.modal-btn {
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--transition-speed), background-color var(--transition-speed), border-color var(--transition-speed);
}

.modal-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.10);
}

.modal-btn.confirm-btn {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.16);
}

.modal-btn.confirm-btn:hover {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.22);
}

/* ---- Forms ---- */
.form-container {
  max-width: 820px;
  margin: 1.75rem auto;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface-strong), var(--surface));
  box-shadow: var(--shadow);
}

.form-header {
  text-align: left;
  margin-bottom: 1rem;
}

.form-header h1 {
  font-size: 1.6rem;
  margin-bottom: 0.25rem;
}

.form-header p {
  color: var(--muted);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition-speed), background-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.form-group textarea {
  min-height: 180px;
  resize: vertical;
}

.image-preview {
  display: none;
  margin-top: 0.75rem;
  max-width: 100%;
  max-height: 320px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.button-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 1rem;
}

.btn.btn-secondary,
.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
}

.btn.btn-secondary:hover,
.btn-secondary:hover {
  filter: none;
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.10);
}

.btn.btn-primary,
.btn-primary {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.95), rgba(124, 58, 237, 0.65));
  border-color: rgba(124, 58, 237, 0.35);
}

.success-message,
.error-message {
  display: none;
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.success-message {
  background: rgba(34, 197, 94, 0.14);
}

.error-message {
  background: rgba(239, 68, 68, 0.14);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.75rem 0 0.5rem;
}

.checkbox-group label {
  color: var(--muted);
  font-weight: 600;
}

.agreement-link {
  color: rgba(255, 255, 255, 0.90);
  text-decoration-color: rgba(255, 255, 255, 0.22);
}

.agreement-link:hover {
  text-decoration: underline;
}

.error {
  display: none;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.error.visible {
  display: block;
}

/* ---- Footer ---- */
footer {
  margin-top: 2rem;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

footer p {
  max-width: var(--container);
  margin: 0 auto;
}

/* ---- Responsive ---- */
@media (max-width: 980px) {
  .grid.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  header h1 {
    padding-top: 0.9rem;
  }

  nav {
    top: 48px;
  }

  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .post-grid {
    grid-template-columns: 1fr;
  }
}