/* TFI BANISA — components */

/* --- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--paper);
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease), opacity 0.15s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:hover { color: var(--paper); }

.btn--primary {
  background: var(--red);
  border-color: var(--red-bright);
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.35);
}
.btn--primary:hover { background: var(--red-bright); color: #fff; }

.btn--ember {
  background: var(--ember);
  border-color: var(--ember);
  color: #1c1200;
}
.btn--ember:hover { background: #ffc24d; color: #1c1200; }

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--paper-dim);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--paper); }

.btn--danger { background: var(--red-deep); color: #fff; border-color: #c02028; }
.btn--danger:hover { background: #b8171f; color: #fff; }

.btn--block { display: flex; width: 100%; }
.btn--small { min-height: 40px; padding: 0 var(--sp-4); font-size: var(--step--1); }

.btn[disabled],
.btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* --- fields -------------------------------------------------------------- */

.field { display: block; margin-bottom: var(--sp-4); }

.field__label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--paper-dim);
}

.field__hint {
  margin-top: var(--sp-2);
  font-size: var(--step--1);
  color: var(--muted);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--paper);
  font-size: var(--step-0);
}
.textarea { min-height: 96px; padding-top: 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ember); }

.input--lg { min-height: 58px; font-size: var(--step-1); font-weight: 600; }

.input[aria-invalid='true'] { border-color: var(--wrong); }

.file-input {
  width: 100%;
  padding: var(--sp-3);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  font-size: var(--step--1);
  color: var(--paper-dim);
}
.file-input::file-selector-button {
  margin-right: var(--sp-3);
  padding: 10px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--paper);
  font-weight: 600;
  cursor: pointer;
}

/* --- autocomplete -------------------------------------------------------- */

.combo { position: relative; }

.combo__list {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
  max-height: 292px;
  overflow-y: auto;
}
.combo__list[hidden] { display: none; }

.combo__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 46px;
  padding: 8px var(--sp-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.combo__option:hover,
.combo__option[aria-selected='true'] { background: var(--surface-3); }

.combo__title { font-weight: 600; }
.combo__meta { color: var(--muted); font-size: var(--step--1); flex: none; }

.combo__empty {
  padding: 12px var(--sp-3);
  color: var(--muted);
  font-size: var(--step--1);
}

/* --- cards / tickets ----------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

.ticket {
  position: relative;
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  border-radius: var(--radius);
  padding: var(--sp-5);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}
.ticket::after {
  /* torn edge on the right */
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 12px;
  background-image: radial-gradient(circle at 12px 8px, var(--ink) 5px, transparent 5.5px);
  background-size: 12px 16px;
  background-repeat: repeat-y;
}

/* --- badges -------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  color: var(--paper-dim);
  background: var(--surface-2);
}
.badge--published { color: #7ef0ae; border-color: rgba(39, 200, 111, 0.5); background: rgba(39, 200, 111, 0.12); }
.badge--draft { color: var(--ember); border-color: rgba(255, 176, 32, 0.45); background: rgba(255, 176, 32, 0.1); }
.badge--archived { color: var(--muted); }

/* --- toast --------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: min(24rem, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px var(--sp-4);
  border-radius: var(--radius);
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--paper);
  font-size: var(--step--1);
  font-weight: 600;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  animation: toast-in 0.22s var(--ease);
}
.toast--ok { border-color: rgba(39, 200, 111, 0.55); }
.toast--error { border-color: rgba(255, 75, 82, 0.6); }
.toast__icon { font-size: 1.1rem; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* --- modal --------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: var(--sp-4);
  background: rgba(3, 2, 2, 0.78);
}
.modal[hidden] { display: none; }

.modal__box {
  width: min(28rem, 100%);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}
.modal__title { font-size: var(--step-3); margin-bottom: var(--sp-3); }
.modal__body { color: var(--paper-dim); }
.modal__actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-5); }
.modal__actions .btn { flex: 1; }

/* --- alerts -------------------------------------------------------------- */

.alert {
  padding: var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: var(--step--1);
  color: var(--paper-dim);
}
.alert--error { border-color: rgba(255, 75, 82, 0.55); background: rgba(255, 75, 82, 0.08); color: #ffc9cb; }
.alert--ok { border-color: rgba(39, 200, 111, 0.5); background: rgba(39, 200, 111, 0.08); color: #b6f2d1; }
.alert ul { margin: var(--sp-2) 0 0; padding-left: 1.1rem; }
.alert li { margin-bottom: 4px; }

/* --- media player -------------------------------------------------------- */

.player {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
}

.player__button {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  background: var(--red);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(232, 35, 42, 0.35);
}
.player__button:hover { background: var(--red-bright); }
.player__button svg { width: 26px; height: 26px; fill: currentColor; }

.player__body { flex: 1; min-width: 0; }

.player__track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  cursor: pointer;
  touch-action: none;
}
.player__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), var(--ember));
}
.player__knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 16px; height: 16px;
  margin-left: -8px;
  border-radius: 50%;
  background: var(--paper);
  transform: translateY(-50%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.player__meta {
  display: flex;
  justify-content: space-between;
  margin-top: var(--sp-2);
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.player__replay {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--paper-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.player__replay:hover { color: var(--paper); background: var(--surface-3); }
.player__replay svg { width: 20px; height: 20px; fill: currentColor; }

.player__hidden-video {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* --- skeleton ------------------------------------------------------------ */

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
