/**
 * Booking Flow — Error States
 * Figma node: 1376-59468 — Error states section
 * 1. Inline timeout error banner
 * 2. Full-page error layouts (client, server, generic fallback)
 * All sizes use exact Figma pixel values. Token vars for colors only.
 */

/* ============================================
   DESKTOP INLINE ERROR BANNER
   Figma node: 1376-60211 — Desktop timeout
   In-flow banner below progress, above map.
   Hidden on tablet/mobile (snackbar used there).
   ============================================ */

/* Wrapper — same horizontal padding as bf-content */
.bf-error-banner-wrapper {
  padding: 0 120px;
  box-sizing: border-box;
  max-width: 1440px;
  margin: 24px auto 0;
  width: 100%;
}

/* Banner card */
.bf-error-banner {
  display: none;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background-color: var(--red-100);
  border: 2px solid var(--red-50);
  border-radius: 12px;
  max-width: 856px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.bf-error-banner--visible {
  display: flex;
}

/* Icon */
.bf-error-banner__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--red-50);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bf-error-banner__icon svg {
  width: 24px;
  height: 24px;
}

/* Body: title + description stacked */
.bf-error-banner__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.bf-error-banner__title {
  font-family: var(--font-family-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  color: var(--red-50);
  margin: 0;
}

.bf-error-banner__text {
  font-family: var(--font-family-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--red-50);
  margin: 0;
}

/* Actions: retry + close */
.bf-error-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.bf-error-banner__retry {
  font-family: var(--font-family-body);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  color: var(--red-50);
  background: none;
  border: none;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.bf-error-banner__retry:hover {
  color: var(--red-40);
}

.bf-error-banner__close {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--red-50);
  transition: color 0.15s ease;
}

.bf-error-banner__close:hover {
  color: var(--red-40);
}

.bf-error-banner__close svg {
  width: 20px;
  height: 20px;
}

/* ============================================
   TIMEOUT ERROR SNACKBAR
   Figma node: 1395-65526
   Fixed toast — top-right on desktop,
   full-width bottom on mobile
   ============================================ */
.bf-timeout-snackbar {
  position: fixed;
  top: 80px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background-color: var(--grey-100);
  border: var(--border-m, 1.5px) solid var(--red-50);
  border-radius: var(--radius-s, 8px);
  overflow: hidden;
  z-index: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);

  /* Hidden by default */
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.bf-timeout-snackbar--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Content row: icon + text + close */
.bf-timeout-snackbar__content {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
}

/* Icon */
.bf-timeout-snackbar__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--red-50);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bf-timeout-snackbar__icon svg {
  width: 24px;
  height: 24px;
}

/* Text block */
.bf-timeout-snackbar__text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.bf-timeout-snackbar__title {
  font-family: var(--font-family-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  color: var(--red-50);
  margin: 0;
}

.bf-timeout-snackbar__description {
  font-family: var(--font-family-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  color: var(--black);
  margin: 0;
}

/* Close button */
.bf-timeout-snackbar__close {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

.bf-timeout-snackbar__close:hover {
  color: var(--text-primary);
}

.bf-timeout-snackbar__close svg {
  width: 20px;
  height: 20px;
}

/* Auto-dismiss progress bar */
.bf-timeout-snackbar__progressbar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: var(--grey-80, #e0e0e0);
}

.bf-timeout-snackbar__progressbar-fill {
  height: 100%;
  width: 100%;
  background-color: var(--red-50);
  border-radius: 0 0 var(--radius-s, 8px) var(--radius-s, 8px);
  transition: width 0.1s linear;
}

/* ============================================
   FULL-PAGE ERROR LAYOUT
   Figma node: 1376-59536 — Client-side error, desktop
   ============================================ */

/* Overlay: covers entire viewport, sits above page content */
.bf-error-page {
  display: none;
  position: fixed;
  inset: 0;
  background-color: var(--surface-page);
  z-index: 900;
  overflow-y: auto;
}

.bf-error-page--visible {
  display: flex;
  flex-direction: column;
}

/* Inner container: centered, max 1440px, with navbar-like top padding */
.bf-error-page__container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 100px 120px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  text-align: center;
}

/* ── Icon + text block ── */
.bf-error-page__message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  max-width: 560px;
  width: 100%;
}

/* Large dark circle with white icon inside */
.bf-error-page__icon-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bf-error-page__icon-circle svg {
  width: 40px;
  height: 40px;
  color: var(--surface-page);
}

/* Text block */
.bf-error-page__text {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bf-error-page__heading {
  font-family: var(--font-family-heading);
  font-size: 40px;
  font-weight: 800;
  line-height: 48px;
  color: var(--text-primary);
  margin: 0;
}

.bf-error-page__description {
  font-family: var(--font-family-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 28px;
  color: var(--text-primary);
  margin: 0;
}

/* ── Buttons group ── */
.bf-error-page__buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 272px;
}

.bf-error-page__btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 24px;
  background-color: var(--sea-green-50);
  border: none;
  border-radius: 12px;
  font-family: var(--font-family-body);
  font-size: 18px;
  font-weight: 600;
  line-height: 28px;
  color: var(--sea-green-100);
  cursor: pointer;
  transition: background-color 0.15s ease;
  min-height: 56px;
  box-sizing: border-box;
}

.bf-error-page__btn-primary:hover {
  background-color: var(--golden-50);
  color: var(--text-inverse);
}

.bf-error-page__btn-primary:active {
  background-color: var(--sea-green-40);
}

.bf-error-page__btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
  background: transparent;
  border: none;
  font-family: var(--font-family-body);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s ease;
}

.bf-error-page__btn-secondary:hover {
  color: var(--sea-green-50);
}

/* ============================================
   SHOW/HIDE: desktop banner vs snackbar
   Desktop (>1024px): inline banner shown, snackbar hidden
   Tablet/mobile (≤1024px): inline banner hidden, snackbar used
   ============================================ */

/* Hide snackbar on desktop */
@media (min-width: 1025px) {
  .bf-timeout-snackbar {
    display: none !important;
  }
}

/* Hide inline banner on tablet/mobile */
@media (max-width: 1024px) {
  .bf-error-banner-wrapper {
    display: none;
  }
}

/* ============================================
   ERROR PAGE — TABLET
   ============================================ */
@media (max-width: 1024px) {
  .bf-error-page__container {
    padding: 80px 32px;
    gap: 40px;
  }

  .bf-error-page__heading {
    font-size: 32px;
    line-height: 40px;
  }

  .bf-error-page__description {
    font-size: 16px;
    line-height: 24px;
  }
}

/* ============================================
   ERROR PAGE — MOBILE
   ============================================ */
@media (max-width: 767px) {
  .bf-error-page__container {
    padding: 60px 24px;
    gap: 32px;
    justify-content: center;
  }

  .bf-error-page__message {
    gap: 24px;
  }

  .bf-error-page__icon-circle {
    width: 64px;
    height: 64px;
  }

  .bf-error-page__icon-circle svg {
    width: 32px;
    height: 32px;
  }

  .bf-error-page__heading {
    font-size: 28px;
    line-height: 36px;
  }

  .bf-error-page__description {
    font-size: 15px;
    line-height: 22px;
  }

  .bf-error-page__buttons {
    width: 100%;
  }

  .bf-error-page__btn-primary {
    font-size: 16px;
    line-height: 24px;
    min-height: 52px;
  }
}

/* ============================================
   TIMEOUT SNACKBAR — TABLET (769px–1024px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
  .bf-timeout-snackbar {
    top: 80px;
    right: 24px;
    left: auto;
    width: 360px;
    transform: translateY(-12px);
  }

  .bf-timeout-snackbar--visible {
    transform: translateY(0);
  }
}

/* ============================================
   TIMEOUT SNACKBAR — MOBILE (≤768px)
   ============================================ */
@media (max-width: 767px) {
  .bf-timeout-snackbar {
    top: auto;
    bottom: 88px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: 100%;
    transform: translateY(12px);
  }

  .bf-timeout-snackbar--visible {
    transform: translateY(0);
  }
}
