/* ═══════════════════════════════════════════════════
   CNSIIA 2026 — Main Stylesheet
   Mobile-first · 360px base · TECNM blue scheme
   ═══════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  --blue-900: #003366;
  --blue-700: #0055a5;
  --blue-500: #1a7bd4;
  --blue-100: #ddeeff;
  --blue-50: #f0f7ff;

  --gray-900: #1a1a2e;
  --gray-700: #4a4a6a;
  --gray-400: #9999bb;
  --gray-200: #e8e8f0;
  --gray-50: #f8f8fc;

  --white: #ffffff;
  --danger: #c0392b;
  --success: #1e8449;
  --warning: #b7770d;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 3px rgba(0, 51, 102, .10);
  --shadow-md: 0 4px 16px rgba(0, 51, 102, .12);

  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;

  --nav-h: 56px;
  --bottom-h: 64px;
}

.dark{
  --blue-900: #003366;
  --blue-700: #0055a5;
  --blue-500: #1a7bd4;
  --blue-100: #ddeeff;
  --blue-50: #f0f7ff;

  --gray-900: #1a1a2e;
  --gray-700: #4a4a6a;
  --gray-400: #9999bb;
  --gray-200: #e8e8f0;
  --gray-50: #f8f8fc;

  --white: #ffffff;
  --danger: #c0392b;
  --success: #1e8449;
  --warning: #b7770d;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 3px rgba(0, 51, 102, .10);
  --shadow-md: 0 4px 16px rgba(0, 51, 102, .12);

  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;

  --nav-h: 56px;
  --bottom-h: 64px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-900);
  min-height: 100dvh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* ── Top Nav ─────────────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--blue-900);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow-md);
}

.nav__logo {
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav__logo img {
  width: 28px;
  height: 28px;
}

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

.nav__lang-btn {
  background: rgba(255, 255, 255, .12);
  border: none;
  color: var(--white);
  font-size: .75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  transition: background .15s;
}

.nav__lang-btn:hover {
  background: rgba(255, 255, 255, .22);
}

.nav__icon-btn {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background .15s;
}

.nav__icon-btn:hover {
  background: rgba(255, 255, 255, .15);
}

/* ── Page shell ──────────────────────────────────────────────────────── */
.page {
  padding-top: calc(var(--nav-h) + 16px);
  padding-bottom: calc(var(--bottom-h) + 16px);
  padding-left: 16px;
  padding-right: 16px;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Bottom Tab Bar ──────────────────────────────────────────────────── */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--bottom-h);
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  box-shadow: 0 -2px 12px rgba(0, 51, 102, .07);
}

.tabbar__item {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--gray-400);
  transition: color .15s;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tabbar__item .icon svg {
  width: 1.50rem;
  height: 1.50rem;
  stroke: currentColor;
  fill: none;
  vertical-align: middle;
}

.tabbar__item.active {
  color: var(--blue-700);
}

.tabbar__item:active {
  background: var(--blue-50);
}

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  margin-bottom: 12px;
}

.card--event {
  border-left: 4px solid var(--blue-500);
}

.card--event.estado-pasado {
  border-left-color: var(--gray-400);
  opacity: .75;
}

.card--event.estado-en_curso {
  border-left-color: var(--success);
}

.card--event.estado-registro_abierto {
  border-left-color: var(--warning);
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.card__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.card__subtitle {
  font-size: .8rem;
  color: var(--gray-700);
  margin-top: 2px;
}

.card__meta {
  font-size: .78rem;
  color: var(--gray-700);
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card__meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.badge--blue {
  background: var(--blue-100);
  color: var(--blue-900);
}

.badge--green {
  background: #d4efdf;
  color: var(--success);
}

.badge--gray {
  background: var(--gray-200);
  color: var(--gray-700);
}

.badge--yellow {
  background: #fdebd0;
  color: var(--warning);
}

.badge--red {
  background: #fadbd8;
  color: var(--danger);
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  padding: 12px 20px;
  width: 100%;
  transition: filter .15s, opacity .15s;
}

.btn:active {
  filter: brightness(.9);
}

.btn:disabled {
  opacity: .5;
  pointer-events: none;
}

.btn--primary {
  background: var(--blue-700);
  color: var(--white);
}

.btn--secondary {
  background: var(--blue-50);
  color: var(--blue-700);
  border: 1.5px solid var(--blue-200, #b3d4f5);
}

.btn--danger {
  background: #fadbd8;
  color: var(--danger);
}

.btn--success {
  background: #d4efdf;
  color: var(--success);
}

.btn--sm {
  font-size: .78rem;
  padding: 7px 14px;
  width: auto;
}

.btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
}

/* ── Forms ───────────────────────────────────────────────────────────── */
.field {
  margin-bottom: 16px;
}

.field__label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.field__input,
.field__select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: inherit;
  background: var(--white);
  color: var(--gray-900);
  transition: border-color .15s;
}

.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--blue-500);
}

.field__input.error {
  border-color: var(--danger);
}

/* ── Login page ──────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(0,85,165,0.38) 0%, transparent 70%),
        radial-gradient(ellipse 40% 40% at 85% 85%, rgba(14,165,233,0.12) 0%, transparent 60%),
        linear-gradient(180deg, #0f1623 0%, #090e18 100%);
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
}

.login-card__logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-card__logo h1 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--blue-900);
  margin-top: 10px;
}

.login-card__logo p {
  font-size: .8rem;
  color: var(--gray-700);
  margin-top: 2px;
}

.login-lang {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}

.login-lang__btn {
  background: white;
  border: 1.5px solid var(--gray-200);
  font-size: .75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  color: var(--gray-700);
  transition: all .15s;
}

.login-lang__btn.active {
  background: var(--blue-700);
  border-color: var(--blue-700);
  color: var(--white);
}

/* ── Toast / Alert ───────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--nav-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(90vw, 400px);
  pointer-events: none;
}

.toast {
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  font-size: .88rem;
  font-weight: 600;
  border-left: 4px solid var(--blue-700);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in .2s ease;
  pointer-events: all;
  width: 100%;
}

.toast--success {
  border-color: var(--success);
}

.toast--error {
  border-color: var(--danger);
}

.toast--warning {
  border-color: var(--warning);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Section headers ─────────────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-header h2 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--blue-900);
}

/* ── Tabs ────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 16px;
}

.tabs__btn {
  flex: 1;
  background: none;
  border: none;
  font-size: .85rem;
  font-weight: 600;
  padding: 10px 0;
  color: var(--gray-400);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .15s;
}

.tabs__btn.active {
  color: var(--blue-700);
  border-bottom-color: var(--blue-700);
}

/* ── Search bar ──────────────────────────────────────────────────────── */
.search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.search-row .field__input {
  margin: 0;
}

/* ── Credential card ─────────────────────────────────────────────────── */
/* Credential card */
.credential {
  background: linear-gradient(
  135deg,
  var(--blue-900) 0%,
  var(--blue-700) 70%,
  var(--blue-700) 100%
);
  border-radius: var(--radius-lg);
  padding: 0 40px 24px 40px; /* top padding 0, sides 40px, bottom 24px */
  color: var(--white);
  text-align: center;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
}

/* White header spanning full card width */
.credential__header {
  width: calc(100% + 80px); /* cancel left + right padding */
  height: 40px;
  background: white;
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-left: -40px; /* shift header to start at card edge */
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

/* Logos inside header */
.credential__header img {
  height: 68%;
  width: auto;
  display: block;
}

.credential__school {
  font-size: .72rem;
  letter-spacing: .08em;
  opacity: .75;
  margin-bottom: 0px;
  margin-top: 20px;
}

.credential__campus {
  font-size: .78rem;
  opacity: .75;
  margin-bottom: 10px;
}

.credential__congress {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0px;
}

.credential__congress-image {
  margin-bottom: 0px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.credential__congress-image img {
  height: 100px;
  width: auto;
}

.credential__sm-congress {
  font-size: .88rem;
  opacity: .85;
  margin-bottom: 12px;
}

.credential__name {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
}

.credential__nc {
  font-size: .88rem;
  opacity: .85;
  margin-top: 4px;
  font-family: monospace;
}

.credential__info {
  font-size: .78rem;
  opacity: .75;
  margin-top: 6px;
}

.credential__separator {
  border: none;
  height: 1px;
  background-color: white;
  margin: 10px 0;
}

.credential__qr-wrap {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 12px;
  margin: 16px auto 0;
  width: fit-content;
}

.credential__qr-wrap img {
  width: 160px;
  height: 160px;
}

/* ── Scanner ─────────────────────────────────────────────────────────── */
.scanner-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

#qr-reader {
  width: 100% !important;
}

#qr-reader video {
  border-radius: var(--radius-md);
}

.scan-result {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.scan-result__icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.scan-result__name {
  font-size: 1.1rem;
  font-weight: 800;
}

.scan-result__nc {
  font-size: .85rem;
  color: var(--gray-700);
  margin-top: 2px;
  font-family: monospace;
}

/* ── Roster table ─────────────────────────────────────────────────────── */
.roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-200);
  gap: 10px;
}

.roster-item:last-child {
  border-bottom: none;
}

.roster-item__info {
  flex: 1;
  min-width: 0;
}

.roster-item__name {
  font-size: .9rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-item__nc {
  font-size: .75rem;
  color: var(--gray-700);
  font-family: monospace;
}

.roster-item__meta {
  font-size: .72rem;
  color: var(--gray-400);
  margin-top: 2px;
}

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-400);
}

.empty__icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.empty__text {
  font-size: .9rem;
  font-weight: 600;
}

/* ── Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue-700);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 32px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Responsive: wider screens ───────────────────────────────────────── */
@media (min-width: 520px) {
  .tabbar {
    max-width: 520px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
}

/* ── Event type pill filters ─────────────────────────────── */
.type-pill {
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-700);
  font-size: .78rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}

.type-pill:hover {
  border-color: var(--blue-500);
  color: var(--blue-700);
}

.type-pill.active {
  background: var(--blue-700);
  border-color: var(--blue-700);
  color: var(--white);
}

/* ── Back to dashboard link ──────────────────────────────── */
.back-to-dash {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--blue-700);
  margin-bottom: 14px;
  transition: opacity .15s;
}

.back-to-dash:hover {
  opacity: .7;
}