:root {
  --luna-primary: #16324f;
  --luna-accent: #8ecae6;
}

html, body {
  height: 100%;
}

body {
  background: #eef2f7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1 0 auto;
}

.app-footer {
  flex-shrink: 0;
}

.app-navbar {
  background: linear-gradient(90deg, var(--luna-primary), #2f6690);
}

.app-navbar .btn-outline-light:hover,
.app-navbar .btn-outline-light:focus,
.app-navbar .btn-outline-light:active,
.app-navbar .btn-outline-light.show {
  background-color: #2f6690;
  border-color: #2f6690;
  color: #fff;
}

.btn-luna-primary {
  background-color: #2f6690;
  border-color: #2f6690;
  color: #fff;
}

.btn-luna-primary:hover,
.btn-luna-primary:active,
.btn-luna-primary:focus {
  background-color: var(--luna-primary);
  border-color: var(--luna-primary);
  color: #fff;
}

.danger-zone {
  background-color: #fff5f5;
  border: 1px solid #dc3545;
}

.btn-outline-luna-primary {
  background-color: #fff;
  border-color: #2f6690;
  color: #2f6690;
}

.btn-outline-luna-primary:hover,
.btn-outline-luna-primary:active,
.btn-outline-luna-primary:focus {
  background-color: #2f6690;
  border-color: #2f6690;
  color: #fff;
}

.uid-card-visibility:focus {
  border-color: #97b3c8;
  box-shadow: 0 0 0 0.25rem rgba(47, 102, 144, 0.25);
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2397b3c8'/%3e%3c/svg%3e");
}

.uid-card-visibility:checked {
  background-color: #2f6690;
  border-color: #2f6690;
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e");
}

.card-item img {
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #ffffff;
  padding: 0.5rem;
}

.card-item.status-offered {
  border-color: #198754;
  border-width: 2px;
}

.card-item.status-wanted {
  border-color: #dc3545;
  border-width: 2px;
}

.status-toggle .btn {
  font-size: 0.7rem;
  padding: 0.2rem 0.3rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-footer {
  color: #6c757d;
  border-top: 1px solid #dee2e6;
}

.footer-social-link {
  color: #6c757d;
  display: inline-flex;
  align-items: center;
}

.footer-social-link:hover,
.footer-social-link:focus-visible {
  color: var(--luna-primary);
}

.exchange-card-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

@media (max-width: 767.98px) {
  .exchange-card-picker {
    max-height: 240px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    background: #ffffff;
  }
}

.site-tagline {
  margin-bottom: 0.75rem;
  color: #6c757d;
  font-size: 0.9rem;
  text-align: center;
}

.exchange-login-hint {
  padding: 10px 14px;
  border: 1px solid #b9d3e8;
  border-radius: 8px;
  background: #e6f0f8;
  color: var(--luna-primary);
  font-size: 0.9rem;
}

.card-tile {
  position: relative;
}

.card-tile-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.card-tile-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 10px 4px;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  background: linear-gradient(160deg, #ffffff, #f3f5f9);
  font-size: 0.875rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.card-tile-label:hover {
  border-color: #9aa9bd;
}

.card-tile-img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.card-tile-input:focus-visible + .card-tile-label {
  outline: 2px solid #2f6690;
  outline-offset: 2px;
}

.card-tile-input:checked + .card-tile-label {
  border-color: #2f6690;
  background: #e6f0f8;
  box-shadow: 0 0 0 2px #2f6690;
  font-weight: 600;
}

.lang-dropdown-toggle {
  white-space: nowrap;
}

.admin-row-action,
.admin-row-promote {
  white-space: nowrap;
}

/* 首頁交換結果卡片 */
.exchange-result-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.exchange-result-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 0.75rem;
}

.exchange-result-uid {
  font-weight: 700;
  font-size: 1rem;
  color: #16324f;
}

.uid-card-uid {
  cursor: pointer;
}

.uid-card-uid,
.quick-match-uid-label {
  display: inline-flex;
  align-items: center;
  gap: 0.1em;
}

.uid-arrow-icon {
  font-size: 1.4em;
  line-height: 1;
}

.uid-card-uid:hover .uid-card-uid-text,
.uid-card-uid:focus-visible .uid-card-uid-text {
  text-decoration: underline;
}

.uid-card .exchange-card-chip {
  cursor: default;
}

.uid-card .exchange-card-chip:hover,
.uid-card .exchange-card-chip:focus-visible {
  background: transparent;
}

.exchange-result-user {
  font-size: 0.75rem;
  color: #6c757d;
}

.exchange-result-group {
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.6rem;
}

.exchange-result-group-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.exchange-result-group-offered {
  background: #f0fdf4;
}

.exchange-result-group-offered .exchange-result-group-title {
  color: #15803d;
}

.exchange-result-group-wanted {
  background: #fff1f2;
}

.exchange-result-group-wanted .exchange-result-group-title {
  color: #be123c;
}

.exchange-card-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: center;
  gap: 2px;
  min-height: 57px;
  max-height: 57px;
  overflow-y: auto;
}

.exchange-card-list.is-empty {
  align-content: center;
  padding-left: 10px;
}

.exchange-card-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 56px;
  padding: 2px;
  background: transparent;
  border-radius: 6px;
  font-size: 0.7rem;
  text-align: center;
  line-height: 1.1;
  cursor: pointer;
}

.exchange-card-chip:hover,
.exchange-card-chip:focus-visible {
  background: rgba(0, 0, 0, 0.05);
  outline: none;
}

.exchange-card-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.card-preview-img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 0.75rem;
}

.exchange-card-thumb {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #f8f9fa;
  border-radius: 6px;
  padding: 3px;
}

.exchange-result-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 0.75rem;
  margin-top: 0.5rem;
  border-top: 1px solid #eee;
  font-size: 0.75rem;
  color: #6c757d;
}

.exchange-result-footer-label {
  font-size: 0.9rem;
}

.exchange-contact-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.exchange-contact-badge.has-contact {
  background: #eef1ff;
  color: #4c51bf;
}

.exchange-contact-badge.no-contact {
  background: #f3f4f6;
  color: #6b7280;
}
