/*
 * Shared UI primitives — bottom sheet + option buttons + toast.
 * Linked by index.html (web), map.html, and the mobile index.html so the same
 * components render identically on every page. The JS side lives in
 * src/utils/sheet.js and src/utils/toast.js.
 * Requires styles/tokens.css (loaded before this file).
 */

/* --- Bottom sheet (confirmations, choices) --- */

.delete-sheet-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0);
  z-index: var(--z-sheet, 9000);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transition: background 0.3s ease;
}

.delete-sheet-overlay--visible {
  background: rgba(0, 0, 0, 0.5);
}

.delete-sheet {
  width: 100%;
  max-width: 440px;
  background: var(--surface-raised, #1e1e1e);
  border-radius: var(--r-sheet, 16px) var(--r-sheet, 16px) 0 0;
  padding: 24px 24px calc(32px + var(--nav-bar-h, env(safe-area-inset-bottom, 0px)));
  color: #ffffff;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.delete-sheet--visible {
  transform: translateY(0);
}

.delete-sheet-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
}

/* Single-line item name (ellipsised) */
.delete-sheet-name {
  font-size: 14px;
  color: var(--text-faint, rgba(255, 255, 255, 0.6));
  text-align: center;
  margin-bottom: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Multi-line body copy (wraps) */
.delete-sheet-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-faint, rgba(255, 255, 255, 0.6));
  text-align: center;
  margin-bottom: 24px;
}

.delete-sheet-buttons {
  display: flex;
  gap: 12px;
}

.delete-sheet-btn {
  flex: 1;
  padding: 14px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.delete-sheet-btn--cancel {
  background: rgba(255, 255, 255, 0.08);
  color: #b0bec5;
}

.delete-sheet-btn--cancel:active {
  background: rgba(255, 255, 255, 0.15);
}

.delete-sheet-btn--delete,
.delete-sheet-btn--danger {
  background: var(--danger, #ef5350);
  color: #ffffff;
}

.delete-sheet-btn--delete:active,
.delete-sheet-btn--danger:active {
  background: var(--danger-deep, #c62828);
}

.delete-sheet-btn--confirm {
  background: var(--brand-bright, #4caf50);
  color: #ffffff;
}

.delete-sheet-btn--confirm:active {
  background: var(--brand, #2d7d24);
}

.delete-sheet-btn:disabled {
  opacity: 0.5;
}

/* --- Option cards inside a sheet (icon + two-line label) --- */

.export-sheet-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px;
  margin-bottom: 8px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary, #e0e0e0);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.export-sheet-option:active {
  background: rgba(255, 255, 255, 0.12);
}

.export-sheet-option svg {
  flex-shrink: 0;
  color: var(--accent-export, #00e5ff);
}

.export-sheet-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.export-sheet-option-sub {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-secondary, #9e9e9e);
}

/* --- Toast (src/utils/toast.js) --- */

.ts-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  top: calc(env(safe-area-inset-top, 0px) + 60px);
  max-width: min(88vw, 420px);
  background: var(--surface-overlay, rgba(26, 26, 26, 0.92));
  color: var(--text-primary, #e0e0e0);
  padding: 10px 16px;
  border-radius: var(--r-card, 8px);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  z-index: var(--z-toast, 11000);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.ts-toast--bottom {
  top: auto;
  bottom: calc(var(--nav-bar-h, env(safe-area-inset-bottom, 0px)) + 96px);
  transform: translateX(-50%) translateY(8px);
}

.ts-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ts-toast--success { border-left: 3px solid var(--brand-bright, #4caf50); }
.ts-toast--warn    { border-left: 3px solid var(--warn, #ffd54f); color: var(--warn, #ffd54f); }
.ts-toast--error   { border-left: 3px solid var(--danger, #ef5350); }
