/* ==========================================================================
   components.css — header/nav, footer, buttons, cards, alerts, badges
   ========================================================================== */

/* Header ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(241, 238, 231, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
  padding-block: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand:hover {
  color: var(--ink);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--ink);
}

.brand__mark svg {
  width: 20px;
  height: 20px;
}

/* Navigation -------------------------------------------------------------- */

.nav {
  display: flex;
  align-items: center;
}

.nav__list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.25rem;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}

.nav__link:hover {
  color: var(--ink);
  background: var(--surface);
}

.nav__link svg {
  width: 17px;
  height: 17px;
  opacity: 0.85;
}

.nav__form {
  margin: 0;
}

.nav__logout {
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.18s var(--ease), background-color 0.18s var(--ease);
}

.nav__logout:hover {
  color: var(--ink);
  background: var(--surface);
}

.nav__toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.nav__toggle svg {
  width: 22px;
  height: 22px;
}

/* Mobile navigation */
@media (max-width: 960px) {
  .nav__toggle {
    display: inline-flex;
  }

  .nav {
    flex-basis: auto;
  }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding-bottom: 0.75rem;
  }

  /* When JS is available, the menu is collapsed until opened. */
  .js .nav__list {
    display: none;
  }

  .js .nav.is-open {
    flex-basis: 100%;
  }

  .js .nav.is-open .nav__list {
    display: flex;
  }

  .nav__link,
  .nav__logout {
    width: 100%;
    justify-content: flex-start;
    padding: 0.7rem 0.6rem;
  }

  .nav__form {
    width: 100%;
    margin-top: 0.25rem;
  }

  /* Without JS the menu stays visible as a stacked list. */
  .no-js .nav {
    flex-basis: 100%;
  }
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 2rem 3rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.site-footer__legal a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
}

.site-footer__legal a:hover {
  color: var(--ink);
}

/* Buttons ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.8rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease), transform 0.18s var(--ease);
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.btn--primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--ink);
}

.btn--secondary {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

.btn--secondary:hover {
  background: var(--ink);
  color: var(--bg);
}

.btn--ghost {
  background: var(--surface);
  border-color: transparent;
  color: var(--ink);
}

.btn--ghost:hover {
  background: var(--surface-raised);
}

.btn--lg {
  padding: 1rem 1.7rem;
  font-size: 1.05rem;
}

.btn--block {
  width: 100%;
}

/* Cards ------------------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: clamp(1.4rem, 2.2vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.card__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 1.1rem;
  border-radius: 14px;
  background: var(--bg);
  color: var(--accent-strong);
}

.card__icon svg {
  width: 26px;
  height: 26px;
}

.card__title {
  margin-bottom: 0.6rem;
}

.card__text {
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.card__footer {
  margin-top: auto;
}

/* Alerts / messages ------------------------------------------------------- */

.alert {
  margin-bottom: 1rem;
  padding: 0.9rem 1.15rem;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
}

.alert:last-child {
  margin-bottom: 0;
}

.alert--success {
  border-left-color: #2f7d4f;
}

.alert--error {
  border-left-color: #b4342b;
}

.alert--warning {
  border-left-color: var(--accent-strong);
}

.alert--info,
.alert--debug {
  border-left-color: var(--muted);
}

.messages {
  margin-bottom: 1.5rem;
}

/* Badge ------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Forms ------------------------------------------------------------------- */

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.field {
  display: flex;
  flex-direction: column;
}

.form-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.form-control,
.form-select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.form-control:focus,
.form-control:focus-visible,
.form-select:focus,
.form-select:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245, 149, 39, 0.25);
}

textarea.form-control {
  min-height: 140px;
  resize: vertical;
}

input[type="file"].form-control {
  padding: 0.6rem;
  cursor: pointer;
}

input[type="file"].form-control:hover {
  border-color: var(--accent);
}

.form-text {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.form-text ul {
  margin: 0.4rem 0 0;
  padding-left: 1.1rem;
  list-style: disc;
}

.form-text li {
  margin: 0.15rem 0;
}

.field-error {
  margin-top: 0.4rem;
  color: #b4342b;
  font-size: 0.9rem;
}

.form-consent {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.form-consent a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.form-actions .btn {
  flex: 1 1 auto;
}

.alert__note {
  display: block;
  margin-top: 0.5rem;
}

.text-danger {
  color: #b4342b;
}

.is-compressing {
  opacity: 0.6;
  pointer-events: none;
}

.photo-progress {
  margin-top: 0.75rem;
}

.photo-progress__bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.photo-progress__fill {
  width: 0;
  height: 100%;
  background: var(--accent);
  color: transparent;
  font-size: 0;
  transition: width 0.2s var(--ease);
}

/* Button variants (cabinet) ------------------------------------------------ */

.btn--sm {
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
}

.btn--danger {
  background: #b4342b;
  border-color: #b4342b;
  color: #fff;
}

.btn--danger:hover {
  background: #97291f;
  border-color: #97291f;
  color: #fff;
}

.btn--danger-ghost {
  background: transparent;
  border-color: #b4342b;
  color: #b4342b;
}

.btn--danger-ghost:hover {
  background: #b4342b;
  border-color: #b4342b;
  color: #fff;
}

.btn--success {
  background: #2f7d4f;
  border-color: #2f7d4f;
  color: #fff;
}

.btn--success:hover {
  background: #266641;
  border-color: #266641;
  color: #fff;
}

/* Checkbox ---------------------------------------------------------------- */

.form-check {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.form-check-input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.form-check-label {
  font-weight: 600;
}

/* Badge variants ---------------------------------------------------------- */

.badge--success {
  background: rgba(47, 125, 79, 0.14);
  color: #2f7d4f;
}

.badge--warning {
  background: rgba(224, 131, 15, 0.16);
  color: #a05f0a;
}

.badge--danger {
  background: rgba(180, 52, 43, 0.14);
  color: #b4342b;
}

.badge--muted {
  background: var(--bg);
  color: var(--muted);
}

/* Empty state ------------------------------------------------------------- */

.empty-state {
  padding: clamp(2rem, 5vw, 3rem) 1rem;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  margin: 0 0 0.75rem;
}

/* Table card -------------------------------------------------------------- */

.table-card {
  padding: 0;
  overflow: hidden;
}

/* Small utilities --------------------------------------------------------- */

.text-end {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--muted);
}
