/* .card, .field, .actionbar, .tile, .result-card, saved rows, toast, placeholder */

/* ============ CARDS / SHARED UI ============ */
.card {
  /* Explicit: .card is applied to the <af-result-card> custom element, which
     (like all custom elements) defaults to display:inline — without this it
     shrink-wraps to its content and hugs the left instead of filling the
     container the way the mockup's block <div class="card"> did. */
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card.about {
  font-size: 0.8rem;
}
.card h4 {
  font-variant: small-caps;
  letter-spacing: 1px;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
}
.weather-card {
  display: flex;
  align-items: top;
  gap: 0.9rem;
}
.weather-icon {
  font-size: 2.1rem;
}
.weather-temp {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}
.weather-status {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.1rem;
}
.weather-desc {
  font-size: 0.75rem;
  margin-top: 0.4rem;
}
.intro p {
  line-height: 1.4;
  font-size: 0.92rem;
  color: var(--text);
}

.section-label {
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.1rem 0.1rem 0.5rem 0.1rem;
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 0.4rem;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: var(--text);
}
.tile:active {
  transform: scale(0.97);
}
.tile svg {
  display: block;
  margin: 0 auto 0.4rem auto;
  width: 26px;
  height: 26px;
}
.tile span {
  display: block;
  font-size: 0.78rem;
}

.more-link {
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.7rem;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--accent-2);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

/* ============ FORM ============ */
.field {
  margin-bottom: 0.9rem;
}
.field label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.field select,
.field input {
  width: 100%;
  min-height: 46px;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

.actionbar {
  flex: none;
  display: flex;
  gap: 0.6rem;
  padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px)) 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.btn-primary {
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0.85rem;
  border-radius: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-primary.pending {
  opacity: 0.6;
  cursor: progress;
}
.btn-primary.btn-block {
  width: 100%;
}
.actionbar .btn-primary {
  flex: 1;
}
.btn-secondary {
  flex: none;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-secondary:active {
  background: var(--surface-2);
}
.btn-secondary-blue {
  border-color: var(--accent-2);
  color: var(--accent-2);
}
.btn-danger {
  border: none;
  background: var(--danger);
  color: white;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  cursor: pointer;
}
.btn-danger:active {
  transform: scale(0.98);
}
.actionbar-row {
  display: flex;
  gap: 0.6rem;
  flex: 1;
}
.flex-equal {
  flex: 1;
}
.detail-name-input {
  width: 100%;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--accent-2);
  background: var(--surface);
  color: var(--text);
  margin-bottom: 0.2rem;
}

/* The rarity/condition accent only applies where those concepts exist —
   currently just Items. Other result cards fall back to the plain .card
   border on all sides. */
.result-card.rarity-accent {
  border-left: 4px solid var(--highlight);
}
/* Accent colour by rarity tier: common → blue, uncommon → yellow, rare → red. */
.result-card.rarity-accent.rarity-common {
  border-left-color: var(--blue);
}
.result-card.rarity-accent.rarity-uncommon {
  border-left-color: var(--yellow);
}
.result-card.rarity-accent.rarity-rare {
  border-left-color: var(--red);
}
/* Line spacing lives on the TOP of every line except the first. The first
   line (name) always exists; later lines (stat, desc) may be hidden when
   empty. Top-margin-between-siblings + hiding empty lines guarantees spacing
   only BETWEEN present lines — never above the first or below the last. */
.result-card > * {
  margin: 0;
}
.result-card > *:not(.hidden) ~ *:not(.hidden) {
  margin-top: 0.35rem;
}
.result-card .title {
  font-family: "Fredericka the Great";
  color: var(--accent);
  font-size: 1.1rem;
}
.result-card .stat-line {
  color: var(--text-muted);
  font-size: 0.8rem;
}
.result-card p {
  margin: 0.6rem 0 0 0;
  font-size: 0.88rem;
  line-height: 1.4;
}
.result-card ul {
  padding-left: 1rem;
}
.hidden {
  display: none !important;
}

.placeholder-wrap {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.placeholder-wrap .badge {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 1.3rem;
  margin: 0 auto 1rem auto;
}
.placeholder-wrap h3 {
  color: var(--text);
  margin-bottom: 0.4rem;
}
.badge {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  background: var(--accent-2);
}

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 0.5rem 1rem 0 1rem;
}

/* ============ ACCOUNT / SIGN-IN ============
   .account-row itself (the drawer slot this content sits in) lives in
   shell.css alongside the rest of the drawer's structural rules. */
.account-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
}
.account-btn:active {
  background: var(--border);
}
.google-g {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font-weight: 800;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}
.account-signedin {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.account-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 0.75rem;
}
.account-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.account-signout {
  border: none;
  background: transparent;
  padding: 0;
  margin-top: 0.1rem;
  color: var(--accent-2);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
}
.lock-icon {
  margin-left: auto;
  font-size: 0.75rem;
}

/* ============ SAVED CONTENT ============ */
.saved-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.saved-row {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow);
}
.saved-row-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text);
}
.saved-row-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-row-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}
.saved-row-menu-btn {
  flex: none;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}
.saved-row-menu-btn:active,
.saved-row.menu-open .saved-row-menu-btn {
  background: var(--surface-2);
  color: var(--text);
}
.saved-row-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 5;
  display: none;
  min-width: 120px;
}
.saved-row.menu-open .saved-row-dropdown {
  display: block;
}
.saved-row-dropdown button {
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.saved-row-dropdown button:active {
  background: var(--surface-2);
}
.saved-row-dropdown button.accent-blue {
  color: var(--accent-2);
}
.saved-row-dropdown button.danger {
  color: var(--danger);
}
.saved-row-rename-input {
  flex: 1;
  min-width: 0;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--accent-2);
  background: var(--surface);
  color: var(--text);
}
.saved-row-confirm {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text);
}
.saved-row-confirm span {
  flex: 1;
}
.saved-row-confirm button {
  flex: none;
  padding: 0.35rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text);
}
.saved-row-confirm button.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.saved-detail-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  margin-top: 0.5rem;
}

/* ============ TOAST ============ */
.toast {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 12px);
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 25;
  max-width: 85%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
