/* ============================================================
   Components — Top bar, Tab bar, Cards, Buttons, Chips, Forms
   ============================================================ */

/* ── Top bar ─────────────────────────────────────────────── */
.top-bar {
  height: var(--top-bar-h);
  padding: 0 var(--s-4);
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}

.top-bar.is-navy {
  background: var(--navy);
  color: var(--white);
  border-bottom-color: transparent;
}
.top-bar.is-navy .top-bar__title,
.top-bar.is-navy .top-bar__btn { color: var(--white); }

.top-bar__btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill);
  color: var(--navy);
  transition: background var(--dur) var(--ease);
}
.top-bar__btn:hover { background: rgba(37, 40, 118, 0.08); }
.top-bar__btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.top-bar__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
  flex: 1;
  text-align: center;
}

.top-bar__brand {
  display: flex; align-items: center; gap: var(--s-2);
}
.top-bar__brand img { width: 32px; height: 32px; object-fit: contain; }
.top-bar__brand-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 16px;
  color: var(--navy);
  letter-spacing: -0.01em;
  line-height: 1;
}
.top-bar__brand-sub {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.top-bar__badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: var(--r-pill);
  border: 2px solid var(--cream);
}

/* ── Bottom tab bar ──────────────────────────────────────── */
.tab-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--tab-bar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--white);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  z-index: 60;
  box-shadow: 0 -4px 20px rgba(26, 29, 61, 0.06);
}

.tab-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color var(--dur-fast) var(--ease);
  position: relative;
}

.tab-bar__item svg {
  width: 22px; height: 22px;
  fill: none; stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  transition: transform var(--dur) var(--ease);
}

.tab-bar__item.is-active {
  color: var(--navy);
}
.tab-bar__item.is-active svg {
  fill: var(--navy);
  stroke: var(--navy);
  transform: translateY(-1px);
}
.tab-bar__item.is-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 3px;
  background: var(--navy);
  border-radius: 0 0 4px 4px;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--r);
  padding: var(--s-5);
  box-shadow: var(--shadow-sm);
}
.card.is-ghost {
  background: transparent;
  box-shadow: none;
  border: 1px solid var(--line);
}
.card.is-navy {
  background: var(--navy);
  color: var(--white);
}
.card.is-navy h1,
.card.is-navy h2,
.card.is-navy h3,
.card.is-navy p { color: var(--white); }

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
}
.card__title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--ink);
}

.card-link {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--navy);
  display: inline-flex; align-items: center; gap: 4px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 13px var(--s-6);
  border-radius: var(--r);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-body);
  letter-spacing: 0.01em;
  min-height: 48px;
  transition: all var(--dur) var(--ease);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow-navy);
}
.btn-primary:hover { background: var(--navy-deep); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--cream-dark);
  color: var(--navy);
}
.btn-secondary:hover { background: var(--cream); }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: rgba(37, 40, 118, 0.05); border-color: var(--navy); }

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

.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 8px var(--s-4); font-size: var(--fs-sm); }

.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Floating Action Button */
.fab {
  position: absolute;
  right: var(--s-5);
  bottom: calc(var(--tab-bar-h) + var(--safe-bottom) + 16px);
  width: 56px; height: 56px;
  border-radius: var(--r-pill);
  background: var(--navy);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-navy);
  z-index: 70;
  transition: transform var(--dur) var(--ease);
}
.fab:hover { transform: scale(1.05); background: var(--navy-deep); }
.fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.25; }

/* ── Chips / Tags ────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--cream-dark);
  color: var(--navy);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.chip.is-active {
  background: var(--navy);
  color: var(--white);
}
.chip.is-outline {
  background: transparent;
  border: 1px solid var(--line-strong);
}
.chip.is-gold {
  background: var(--gold-soft);
  color: #8A7140;
  border: 1px solid rgba(201, 169, 110, 0.35);
}
.chip svg { width: 12px; height: 12px; }

.chip-row {
  display: flex;
  gap: var(--s-2);
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row > .chip { flex-shrink: 0; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-plyd {
  background: var(--gold-soft);
  color: #7A6132;
  border: 1px solid rgba(201, 169, 110, 0.5);
  gap: 5px;
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.badge-plyd svg { width: 11px; height: 11px; fill: var(--gold); }
/* Compact variant — used in dense lists (shows only star) */
.badge-plyd.is-icon {
  padding: 3px;
  width: 18px; height: 18px;
  border-radius: var(--r-pill);
  justify-content: center;
}
.badge-plyd.is-icon svg { width: 10px; height: 10px; }
.badge-plyd.is-icon .badge__label { display: none; }
/* Large variant — profile hero */
.badge-plyd.is-lg {
  padding: 6px 14px;
  font-size: 12px;
  letter-spacing: 0.08em;
}
.badge-plyd.is-lg svg { width: 14px; height: 14px; }

.badge-new {
  background: var(--success-soft);
  color: var(--success);
}
.badge-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: var(--r-pill);
  background: var(--danger);
}

/* ── Avatar ──────────────────────────────────────────────── */
.avatar {
  width: 44px; height: 44px;
  border-radius: var(--r-pill);
  background: var(--cream-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  font-size: 15px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.is-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.is-lg { width: 72px; height: 72px; font-size: 24px; }
.avatar.is-xl { width: 96px; height: 96px; font-size: 32px; }
.avatar.is-plyd {
  box-shadow: 0 0 0 2px var(--cream), 0 0 0 4px var(--gold);
}

.avatar-stack {
  display: inline-flex;
}
.avatar-stack .avatar {
  border: 2px solid var(--white);
  margin-left: -10px;
}
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ── List items ──────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) 0;
}
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-item__body { flex: 1; min-width: 0; }
.list-item__title {
  font-weight: 600;
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 6px;
}
.list-item__meta {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item__action { flex-shrink: 0; }

/* ── Search bar ──────────────────────────────────────────── */
.search {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 10px 16px;
  transition: border-color var(--dur) var(--ease);
}
.search:focus-within { border-color: var(--navy); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex-shrink: 0; }
.search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px; /* iOS zoom prevention */
  color: var(--ink);
}
.search input::placeholder { color: var(--muted); }

/* ── Form controls ───────────────────────────────────────── */
.field { display: block; }
.field + .field { margin-top: var(--s-4); }
.field__label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.field__hint {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 4px;
}
.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  font-size: 16px; /* iOS zoom prevention */
  color: var(--ink);
  outline: none;
  transition: border-color var(--dur) var(--ease);
  font-family: inherit;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(37, 40, 118, 0.1);
}
.textarea { resize: vertical; min-height: 96px; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  cursor: pointer;
}
.toggle input { display: none; }
.toggle__switch {
  width: 42px; height: 24px;
  background: var(--line-strong);
  border-radius: var(--r-pill);
  position: relative;
  transition: background var(--dur) var(--ease);
  flex-shrink: 0;
}
.toggle__switch::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: var(--white);
  border-radius: var(--r-pill);
  transition: transform var(--dur) var(--ease);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle__switch { background: var(--navy); }
.toggle input:checked + .toggle__switch::after { transform: translateX(18px); }
.toggle__label { font-weight: 500; font-size: var(--fs-body); }

/* ── Progress bar ────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 8px;
  background: var(--cream-dark);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--r-pill);
  transition: width var(--dur-slow) var(--ease);
}

/* ── Section header ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin: var(--s-6) 0 var(--s-4);
}
.section-header__title {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.section-header__sub {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 2px;
}
.section-header a {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--navy);
}

/* ── Horizontal carousel ─────────────────────────────────── */
.carousel {
  display: flex;
  gap: var(--s-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 2px var(--s-5) 2px;
  margin: 0 calc(var(--s-5) * -1);
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel > * {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* ── Mezun card (compact) ─────────────────────────────────── */
.alumnus-card {
  min-width: 180px;
  max-width: 200px;
  background: var(--white);
  border-radius: var(--r);
  padding: var(--s-4);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.alumnus-card__name {
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}
.alumnus-card__meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
}
.alumnus-card .btn { width: 100%; margin-top: var(--s-2); }

/* ── Event card ──────────────────────────────────────────── */
.event-card {
  background: var(--white);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.event-card__cover {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: var(--s-4);
  color: var(--white);
}
.event-card__cover.is-pattern {
  background:
    linear-gradient(135deg, var(--navy) 0%, var(--navy-deep) 100%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.04) 0 2px, transparent 2px 12px);
  background-blend-mode: overlay;
}
.event-card__date {
  background: var(--white);
  color: var(--navy);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-display);
}
.event-card__body { padding: var(--s-4); }
.event-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-h3);
  color: var(--ink);
  margin-bottom: 4px;
}
.event-card__meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.event-card__meta svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ── Empty state ─────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: var(--s-8) var(--s-5);
  color: var(--muted);
}
.empty__icon {
  width: 56px; height: 56px;
  margin: 0 auto var(--s-4);
  border-radius: var(--r-pill);
  background: var(--cream-dark);
  display: flex; align-items: center; justify-content: center;
}
.empty__icon svg { width: 28px; height: 28px; stroke: var(--muted); fill: none; stroke-width: 1.75; }

/* ── Drawer (mobile hamburger menu) ──────────────────────── */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 29, 61, 0);
  transition: background var(--dur) var(--ease);
}
.drawer__panel {
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 82%;
  max-width: 320px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--dur-slow) cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 10px 0 40px rgba(26, 29, 61, 0.15);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}
.drawer.is-open {
  pointer-events: auto;
}
.drawer.is-open .drawer__backdrop {
  background: rgba(26, 29, 61, 0.5);
}
.drawer.is-open .drawer__panel {
  transform: translateX(0);
}

.drawer__header {
  padding: var(--s-5) var(--s-5) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  border-bottom: 1px solid var(--line);
}
.drawer__logo {
  width: 44px; height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}
.drawer__brand {
  flex: 1;
  line-height: 1.2;
}
.drawer__brand strong {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 18px;
  color: var(--navy);
  letter-spacing: -0.01em;
  display: block;
}
.drawer__brand span {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}
.drawer__close {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  color: var(--muted);
}
.drawer__close:hover { background: var(--cream); color: var(--navy); }
.drawer__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.25; }

.drawer__nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--s-3) var(--s-3);
}
.drawer__nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  border-radius: var(--r-sm);
  color: var(--body);
  font-size: 15px;
  font-weight: 500;
  min-height: 48px;
}
.drawer__nav-item svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 2;
  flex-shrink: 0;
}
.drawer__nav-item:hover {
  background: var(--cream);
  color: var(--navy);
}
.drawer__nav-item.is-active {
  background: var(--navy);
  color: var(--white);
}

.drawer__section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: var(--s-4) 14px var(--s-2);
}

.drawer__footer {
  border-top: 1px solid var(--line);
  padding: var(--s-4) var(--s-5);
  font-size: var(--fs-xs);
  color: var(--muted);
  text-align: center;
}

/* Hamburger button — animated to X when open */
.hamburger {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  color: var(--navy);
  transition: background var(--dur) var(--ease);
  flex-shrink: 0;
}
.hamburger:hover { background: rgba(37, 40, 118, 0.08); }
.hamburger svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linecap: round; }
.top-bar.is-navy .hamburger { color: var(--white); }
.top-bar.is-navy .hamburger:hover { background: rgba(255, 255, 255, 0.12); }

/* Prevent body scroll when drawer is open */
body.drawer-open {
  overflow: hidden;
}

/* ── Segmented control ───────────────────────────────────── */
.segmented {
  display: flex;
  background: var(--cream-dark);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 2px;
}
.segmented__item {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  transition: all var(--dur) var(--ease);
  cursor: pointer;
}
.segmented__item.is-active {
  background: var(--white);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}
