/* 本文件负责书店系统的视觉样式，供 index.html 中的各功能面板使用。 */
:root {
  --ink: #21342f;
  --muted: #6d7b70;
  --paper: #f6f0df;
  --paper-strong: #fffaf0;
  --leaf: #345449;
  --leaf-soft: #d9ead8;
  --orange: #c7763e;
  --gold: #f0c15c;
  --line: rgba(33, 52, 47, 0.14);
  --shadow: 0 24px 80px rgba(28, 48, 41, 0.16);
  --radius: 28px;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(240, 193, 92, 0.28), transparent 32%),
    radial-gradient(circle at 86% 16%, rgba(52, 84, 73, 0.2), transparent 28%),
    linear-gradient(135deg, #f7edda 0%, #edf5ea 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 320px);
  gap: 24px;
  align-items: stretch;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 36px;
  background: rgba(255, 250, 240, 0.82);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -120px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: repeating-linear-gradient(45deg, rgba(199, 118, 62, 0.16) 0 10px, transparent 10px 20px);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--orange);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.08;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 5.2rem);
}

h2 {
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.hero-copy {
  max-width: 720px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.status-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 24px;
  border-radius: 28px;
  background: var(--leaf);
  color: white;
  z-index: 1;
}

.status-card small {
  color: rgba(255, 255, 255, 0.76);
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 8px rgba(240, 193, 92, 0.2);
}

.auth-panel,
.quick-nav,
.panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 240, 0.9);
  box-shadow: 0 18px 50px rgba(28, 48, 41, 0.1);
}

.auth-panel {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 430px);
  gap: 18px;
  align-items: end;
  padding: 22px;
}

.auth-panel p,
.export-panel p,
.hint {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-form,
.isbn-row,
.action-row,
.export-actions {
  display: flex;
  gap: 12px;
}

.quick-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px;
}

.nav-button,
.mode-button {
  border: 0;
  border-radius: 20px;
  padding: 14px 16px;
  color: var(--ink);
  background: transparent;
}

.nav-button.active,
.mode-button.active {
  color: white;
  background: var(--leaf);
}

.view {
  display: none;
  margin-top: 18px;
}

.view.active {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 24px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.scan-panel {
  background:
    linear-gradient(110deg, rgba(255, 250, 240, 0.96), rgba(217, 234, 216, 0.86)),
    var(--paper-strong);
}

.mode-switch {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 18px;
  border-radius: 24px;
  background: rgba(52, 84, 73, 0.1);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(52, 84, 73, 0.56);
  box-shadow: 0 0 0 4px rgba(52, 84, 73, 0.12);
}

.isbn-row input {
  font-size: 1.22rem;
  letter-spacing: 0.04em;
}

.primary-button,
.ghost-button,
.isbn-row button,
.login-form button {
  border: 0;
  border-radius: 18px;
  padding: 13px 18px;
  white-space: nowrap;
}

.primary-button,
.isbn-row button,
.login-form button {
  color: white;
  background: var(--leaf);
}

.ghost-button {
  color: var(--leaf);
  background: rgba(52, 84, 73, 0.1);
}

.book-form {
  animation: rise-in 0.45s ease both;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

label,
.wide-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

label input,
label textarea {
  color: var(--ink);
}

.wide-label {
  margin-top: 14px;
}

.action-row {
  justify-content: flex-end;
  margin-top: 18px;
}

.badge {
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--leaf);
  background: var(--leaf-soft);
}

.search-input {
  max-width: 360px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.stock-low {
  color: #a84726;
  font-weight: 700;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.metric-card {
  min-height: 126px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(52, 84, 73, 0.12), rgba(240, 193, 92, 0.18));
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.4rem, 2vw, 2.1rem);
}

.compact table {
  min-width: 680px;
}

.export-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100% - 40px));
  padding: 14px 18px;
  border-radius: 18px;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

dialog {
  width: min(720px, calc(100% - 28px));
  border: 0;
  border-radius: 26px;
  padding: 18px;
  background: var(--paper-strong);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(20, 35, 30, 0.45);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.dialog-head button {
  border: 0;
  border-radius: 14px;
  padding: 10px 14px;
}

#scannerVideo {
  width: 100%;
  min-height: 320px;
  border-radius: 20px;
  object-fit: cover;
  background: #14231e;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 18px, 760px);
    padding-top: 10px;
  }

  .hero,
  .auth-panel,
  .export-panel {
    grid-template-columns: 1fr;
  }

  .quick-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid,
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-head,
  .export-panel {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .hero,
  .panel,
  .auth-panel {
    padding: 18px;
    border-radius: 24px;
  }

  .quick-nav,
  .form-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .login-form,
  .isbn-row,
  .action-row,
  .export-actions {
    flex-direction: column;
  }
}
