/* EndoMasterclass Sessions */
:root {
  --ems-ink: #0f1c2e;
  --ems-teal: #2e385c;
  --ems-teal-dark: #232a46;
  --ems-sand: #f3efe6;
  --ems-line: #d9d2c5;
  --ems-muted: #5c6675;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ems-ink);
  background: var(--ems-sand);
  line-height: 1.5;
}
a { color: var(--ems-teal); text-decoration: none; }
a:hover { color: var(--ems-teal-dark); }

.ems-container { width: min(1120px, 92%); margin: 0 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; border: 0; border-radius: 8px; padding: .7rem 1.2rem;
  font-weight: 600; font-family: inherit; cursor: pointer; transition: .15s ease;
}
.btn-primary { background: var(--ems-teal); color: #fff; }
.btn-primary:hover { background: var(--ems-teal-dark); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--ems-line); color: var(--ems-ink); }
.btn-danger { background: #a33; color: #fff; }
.btn-sm { padding: .4rem .75rem; font-size: .85rem; }
.btn-block { width: 100%; }

.form-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }
.form-control, .form-select {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--ems-line);
  border-radius: 8px; background: #fff; font: inherit; color: var(--ems-ink);
}
.form-control:focus, .form-select:focus {
  outline: 2px solid rgba(46,56,92,.35); border-color: var(--ems-teal);
}
.form-group { margin-bottom: 1rem; }
.alert {
  padding: .85rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .95rem;
}
.alert-error { background: #fde8e8; color: #8a1f1f; }
.alert-success { background: #e5f6ef; color: #0d5c3d; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: 12px; border: 1px solid var(--ems-line); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th, table.data td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--ems-line); }
table.data th { background: #faf8f3; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ems-muted); }
.badge {
  display: inline-block; padding: .2rem .55rem; border-radius: 999px; font-size: .75rem; font-weight: 700;
}
.badge-live { background: #d8f3e7; color: #0d5c3d; }
.badge-draft { background: #eee; color: #555; }
.badge-archived { background: #f5e6d8; color: #8a4b16; }

/* Admin */
.admin-body { display: flex; min-height: 100vh; background: #ece8df; }
.admin-sidebar {
  width: 240px; background: var(--ems-ink); color: #fff; padding: 1.5rem 1rem; flex-shrink: 0;
}
.admin-sidebar .brand {
  font-family: var(--font-display); font-size: 1.25rem; margin: 0 0 1.5rem; padding: 0 .5rem;
}
.admin-sidebar nav a {
  display: block; color: rgba(255,255,255,.8); padding: .65rem .75rem; border-radius: 8px; margin-bottom: .25rem;
}
.admin-sidebar nav a:hover, .admin-sidebar nav a.active {
  background: rgba(255,255,255,.1); color: #fff;
}
.admin-main { flex: 1; padding: 1.5rem 2rem; }
.admin-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.admin-top h1 { margin: 0; font-family: var(--font-display); font-size: 1.6rem; }
.card {
  background: #fff; border: 1px solid var(--ems-line); border-radius: 12px; padding: 1.25rem 1.5rem; margin-bottom: 1.25rem;
}
.card h2 { margin: 0 0 1rem; font-size: 1.15rem; font-family: var(--font-display); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat {
  background: #fff; border: 1px solid var(--ems-line); border-radius: 12px; padding: 1.1rem 1.25rem;
}
.stat .num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--ems-teal); }
.stat .lbl { color: var(--ems-muted); font-size: .85rem; }

/* Event auth — 60% / 40% */
.event-auth-page {
  min-height: 100vh; height: 100vh;
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  background: #0b1624; overflow: hidden;
}
.event-auth-visual {
  position: relative; min-width: 0; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: #0b1624; overflow: hidden;
}
.event-auth-visual img {
  width: 100%; height: 100%; object-fit: contain; object-position: center; display: block;
}
.event-auth-panel {
  min-width: 0; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem; background: var(--ems-sand);
}
.auth-box { width: min(340px, 100%); }
.auth-box .form-group { margin-bottom: .65rem; }
.auth-box .form-control, .auth-box .form-select { padding: .6rem .75rem; }
.auth-tabs { display: flex; gap: .5rem; margin: 0 0 .85rem; }
.auth-tabs button {
  flex: 1; border: 1px solid var(--ems-line); background: #fff; padding: .55rem; border-radius: 8px;
  font-weight: 600; cursor: pointer;
}
.auth-tabs button.active { background: var(--ems-teal); color: #fff; border-color: var(--ems-teal); }
.auth-pane { display: none; }
.auth-pane.active { display: block; }

/* Intermediate join page */
.join-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #0b1624;
}
.join-card {
  width: min(440px, 100%);
  background: rgba(243, 239, 230, 0.96);
  border-radius: 14px;
  padding: 1.35rem 1.4rem 1.25rem;
  text-align: center;
}
.join-poster {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: .85rem;
  background: #0b1624;
}
.join-card h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 .5rem;
  color: var(--ems-ink);
}
.join-hello { margin: 0 0 .75rem; color: var(--ems-muted); font-size: .95rem; }
.join-desc { margin: 0 0 1rem; font-size: .92rem; color: var(--ems-ink); line-height: 1.45; }
.join-meta { margin: 0 0 1.1rem; font-size: .85rem; color: var(--ems-muted); }
.join-cta { margin-top: .25rem; }
.join-logout { margin: 1rem 0 0; font-size: .85rem; }

.home-hero {
  padding: 3.5rem 0 2.5rem;
  background: linear-gradient(160deg, #0b1624, #163040 60%, #1a2a22);
  color: #f5f2ea;
}
.home-hero h1 { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 3rem); margin: 0 0 .5rem; }
.home-hero p { color: rgba(245,242,234,.75); max-width: 36rem; }
.event-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; padding: 2rem 0 3rem; }
.event-card {
  background: #fff; border-radius: 14px; overflow: hidden; border: 1px solid var(--ems-line);
  display: flex; flex-direction: column;
}
.event-card img { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: #ddd; }
.event-card .body { padding: 1rem 1.1rem 1.2rem; flex: 1; display: flex; flex-direction: column; }
.event-card h3 { margin: 0 0 .4rem; font-family: var(--font-display); font-size: 1.15rem; }
.event-card .meta { color: var(--ems-muted); font-size: .85rem; margin-bottom: .85rem; }
.event-card .body .btn { margin-top: auto; }

@media (max-width: 900px) {
  .event-auth-page {
    grid-template-columns: 1fr; height: auto; min-height: 100vh; overflow: visible;
  }
  .event-auth-panel { width: 100%; height: auto; padding: 1.25rem; }
  .auth-box { width: min(420px, 100%); }
  .event-auth-visual { min-height: 0; height: auto; width: 100%; }
  .event-auth-visual img {
    width: 100%; height: auto; max-height: none; object-fit: contain; object-position: center top;
  }
  .admin-body { flex-direction: column; }
  .admin-sidebar { width: 100%; }
}

.text-center { text-align: center; }