/*
 * Roca Professionals: empty, loading and error states, messages, the offline bar, the launch screen.
 * One clear button per state; a skeleton repeats the shape of the block it stands for.
 * Conventions: the head of rp-base.css.
 */

/* ---- Empty state, nothing found, load error -------------------------------------------------- */

.rp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--rp-sp-4);
  padding: var(--rp-sp-10) var(--rp-sp-5);
  border-radius: var(--rp-r-lg);
  background: var(--rp-surface);
  text-align: center;
}

/* The icon stands alone, without a coloured disc; a 40 px glyph keeps the weight of the old disc. */
.rp-empty__icon {
  width: var(--rp-sp-10);
  height: var(--rp-sp-10);
  color: var(--rp-text-tertiary);
}

.rp-empty__title {
  font-size: var(--rp-fs-h4);
  font-weight: var(--rp-fw-heading);
  line-height: var(--rp-lh-snug);
  letter-spacing: var(--rp-ls-heading);
  text-wrap: balance;
}

.rp-empty__text {
  max-width: calc(var(--rp-sp-30) * 2.4);
  color: var(--rp-text-secondary);
  line-height: var(--rp-lh-body);
  text-wrap: pretty;
}

.rp-empty__action {
  margin-top: var(--rp-sp-2);
}

/* Inside a section of a page: no card, aligned left with the rest of the column. */
.rp-empty--inline {
  align-items: flex-start;
  padding: var(--rp-sp-6) 0;
  background: none;
  text-align: left;
}

/* Filters gave nothing: a quiet frame, smaller type, a text link to reset. */
.rp-empty--filtered {
  gap: var(--rp-sp-3);
  padding: var(--rp-sp-8) var(--rp-sp-5);
  background: none;
  box-shadow: inset 0 0 0 var(--rp-bw) var(--rp-line-strong);
}

.rp-empty--filtered .rp-empty__title {
  font-size: var(--rp-fs-body);
}

.rp-empty--filtered .rp-empty__text {
  font-size: var(--rp-fs-small);
}

.rp-empty--filtered .rp-empty__action {
  margin-top: 0;
}

.rp-empty--error .rp-empty__icon {
  color: var(--rp-danger);
}

/* ---- Skeletons ------------------------------------------------------------------------------- */

.rp-skeleton {
  display: block;
  width: 100%;
  height: var(--rp-sp-3);
  border-radius: var(--rp-r-xs);
  background: var(--rp-skeleton);
  background-size: 200% 100%;
  animation: rp-shimmer var(--rp-dur-shimmer) linear infinite;
}

.rp-skeleton--sm { height: var(--rp-sp-2); }
.rp-skeleton--md { height: var(--rp-sp-4); }

.rp-skeleton--lg {
  height: var(--rp-sp-10);
  border-radius: var(--rp-r-sm);
}

.rp-skeleton--bar {
  height: var(--rp-progress-h);
  border-radius: var(--rp-r-pill);
}

.rp-skeleton--avatar {
  flex: none;
  width: var(--rp-avatar);
  height: var(--rp-avatar);
  border-radius: 50%;
}

.rp-skeleton--num {
  flex: none;
  width: var(--rp-sp-8);
}

.rp-skeleton--media {
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 0;
}

.rp-skeleton--w35 { width: 35%; }
.rp-skeleton--w50 { width: 50%; }
.rp-skeleton--w70 { width: 70%; }

.rp-skeleton-card {
  overflow: hidden;
  border-radius: var(--rp-r-lg);
  background: var(--rp-surface);
}

.rp-skeleton-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--rp-sp-3);
  padding: var(--rp-sp-5);
}

.rp-skeleton-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--rp-r-lg);
  background: var(--rp-surface);
}

.rp-skeleton-list__row {
  display: flex;
  align-items: center;
  gap: var(--rp-sp-3);
  min-height: var(--rp-sp-16);
  padding: var(--rp-sp-2) var(--rp-sp-4);
  box-shadow: inset 0 calc(-1 * var(--rp-bw)) 0 var(--rp-line);
}

.rp-skeleton-list__row:last-child {
  box-shadow: none;
}

.rp-skeleton-list__text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--rp-sp-2);
  min-width: 0;
}

/* ---- Spinner --------------------------------------------------------------------------------- */

.rp-spinner {
  display: inline-block;
  flex: none;
  width: var(--rp-sp-12);
  height: var(--rp-sp-12);
  border: var(--rp-bw-strong) solid var(--rp-accent);
  border-right-color: transparent;
  border-radius: 50%;
  animation: rp-spin var(--rp-dur-spin) linear infinite;
}

.rp-spinner--sm {
  width: var(--rp-icon);
  height: var(--rp-icon);
}

.rp-spinner--inverse {
  border-color: var(--rp-text-inverse);
  border-right-color: transparent;
}

/* ---- Toasts: above the tab bar, newest in front ------------------------------------------------ */

.rp-toasts {
  position: fixed;
  z-index: 40;
  left: var(--rp-gutter-m);
  right: var(--rp-gutter-m);
  bottom: calc(var(--rp-sp-1-5) + var(--rp-tabbar-item) + max(var(--rp-sp-1), var(--rp-safe-bottom)) + var(--rp-sp-4));
  display: grid;
  max-width: var(--rp-w-aside);
  margin: 0 auto;
  pointer-events: none;
}

/* Screens without the tab bar: wizards, the computer. */
.rp-toasts--no-tabbar {
  bottom: calc(var(--rp-sp-4) + var(--rp-safe-bottom));
}

/* Component page only: in the flow. */
.rp-toasts--demo {
  position: relative;
  z-index: auto;
  inset: auto;
  margin: 0;
}

/*
 * All toasts share one grid cell, so the pile keeps one height. The newest is the first child;
 * older ones step back and shrink with transform and show only their edge above it.
 */
.rp-toast {
  grid-area: 1 / 1;
  display: flex;
  align-items: center;
  gap: var(--rp-sp-3);
  min-width: 0;
  padding: var(--rp-sp-3) var(--rp-sp-4);
  border-radius: var(--rp-r-md);
  background: var(--rp-surface-inverse);
  color: var(--rp-text-inverse);
  box-shadow: var(--rp-sh-4);
  font-size: var(--rp-fs-small);
  line-height: var(--rp-lh-snug);
  pointer-events: auto;
  transform-origin: 50% 0;
  transition: transform var(--rp-dur) var(--rp-ease), opacity var(--rp-dur) var(--rp-ease);
  animation: rp-rise-in var(--rp-dur) var(--rp-ease);
}

.rp-toast:nth-child(1) { z-index: 3; }

.rp-toast:nth-child(2) {
  z-index: 2;
  transform: translateY(calc(-1 * var(--rp-sp-2))) scale(0.95);
}

.rp-toast:nth-child(3) {
  z-index: 1;
  transform: translateY(calc(-1 * var(--rp-sp-4))) scale(0.9);
}

.rp-toast:nth-child(n + 2) > * {
  opacity: 0;
}

.rp-toast:nth-child(n + 4) {
  opacity: 0;
}

.rp-toast__text {
  flex: 1;
  min-width: 0;
}

.rp-toast__action {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-height: var(--rp-tap);
  margin: calc(-1 * var(--rp-sp-2)) calc(-1 * var(--rp-sp-2)) calc(-1 * var(--rp-sp-2)) 0;
  padding: 0 var(--rp-sp-2);
  border: 0;
  border-radius: var(--rp-r-control);
  background: transparent;
  color: var(--rp-accent-on-inverse);
  font-size: var(--rp-fs-small);
  font-weight: var(--rp-fw-medium);
  text-decoration: none;
}

.rp-toast__action:hover {
  color: var(--rp-text-inverse);
  text-decoration: underline;
}

/* ---- No connection: stays under the top bar until the network is back ------------------------ */

.rp-offline {
  display: flex;
  align-items: flex-start;
  gap: var(--rp-sp-2);
  padding: var(--rp-sp-3) var(--rp-gutter-m);
  background: var(--rp-warning-soft);
  color: var(--rp-text);
  font-size: var(--rp-fs-small);
  line-height: var(--rp-lh-snug);
  animation: rp-fade-in var(--rp-dur) var(--rp-ease);
}

.rp-offline__icon {
  color: var(--rp-warning);
}

.rp-offline__title {
  font-weight: var(--rp-fw-medium);
}

/* ---- Launch screen of the installed app ------------------------------------------------------ */

.rp-splash {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--rp-sp-4);
  padding: var(--rp-safe-top) var(--rp-gutter-m) var(--rp-safe-bottom);
  background: var(--rp-paper);
  color: var(--rp-ink);
}

.rp-splash__mark {
  display: block;
  height: calc(var(--rp-fs-h1) * 1.5);
  aspect-ratio: var(--rp-logo-ar);
  background: currentColor;
  -webkit-mask: var(--rp-logo);
  mask: var(--rp-logo);
}

.rp-splash__rule {
  width: var(--rp-sp-10);
  height: var(--rp-bw);
  background: var(--rp-line-field);
}

.rp-splash__word {
  font-size: var(--rp-fs-lead);
  font-weight: var(--rp-fw-medium);
  line-height: 1;
  letter-spacing: var(--rp-ls-wordmark);
  text-transform: uppercase;
}

.rp-splash__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--rp-safe-bottom) + var(--rp-sp-10));
  width: var(--rp-sp-20);
  height: var(--rp-progress-h-thin);
  margin: 0 auto;
  border-radius: var(--rp-r-pill);
  background: var(--rp-skeleton);
  background-size: 200% 100%;
  animation: rp-shimmer var(--rp-dur-shimmer) linear infinite;
}

/* Component page only: a phone-sized box instead of the whole screen. */
.rp-splash--demo {
  position: relative;
  z-index: auto;
  inset: auto;
  min-height: calc(var(--rp-sp-30) * 5);
  border-radius: var(--rp-r-lg);
  box-shadow: var(--rp-sh-1);
}
