/* =========================================================
   Moka Sales 咖啡厅 — shared styles
   Design notes:
     - Header: clean white with the Moka-style purple gradient wordmark
     - Cards: NotebookLM pastel tiles, emoji icon, hover lift
     - Fully responsive via CSS grid auto-fill
   ========================================================= */

:root {
  --brand-1: #6949ff;   /* Moka-ish violet */
  --brand-2: #8a5bff;
  --brand-3: #b07bff;
  --ink: #1d1d1f;
  --ink-soft: #4a4a52;
  --ink-muted: #8a8a95;
  --line: #ececf1;
  --bg: #fafafa;
  --white: #ffffff;
  --danger: #e5484d;
  --danger-bg: #ffecec;
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, 0.06);
  --shadow-md: 0 6px 18px rgba(16, 16, 24, 0.08);
  --shadow-lg: 0 14px 40px rgba(16, 16, 24, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
}

/* Pastel card backgrounds (matching the NotebookLM feel) */
.card.c-cream    { background: #f7f3e8; }
.card.c-mint     { background: #e8f5ec; }
.card.c-peach    { background: #fde8df; }
.card.c-lavender { background: #ece4fb; }
.card.c-sky      { background: #dff0ff; }
.card.c-pink     { background: #fde4ec; }
.card.c-sand     { background: #f2ece1; }
.card.c-sage     { background: #e6efe3; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

.brand-name .accent {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.top-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  background: #fff;
}
.icon-btn svg { width: 18px; height: 18px; }

.ghost-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-weight: 500;
  transition: background .15s ease, box-shadow .15s ease;
}
.ghost-btn:hover { background: #f5f5f7; box-shadow: var(--shadow-sm); }

.primary-btn {
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(105, 73, 255, 0.28);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.primary-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.danger-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #f3c6c8;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 500;
  font-size: 13px;
}
.danger-btn:hover { background: #ffdede; }

/* ---------- Hero / page title ---------- */

.hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 28px 12px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(30px, 4.2vw, 46px);
  letter-spacing: -0.5px;
  font-weight: 800;
}
.hero h1 .grad {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  color: var(--ink-soft);
  font-size: 16px;
  max-width: 680px;
  margin: 0;
}

.section-title {
  max-width: 1240px;
  margin: 36px auto 0;
  padding: 0 28px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

/* ---------- Card grid ---------- */

.grid {
  max-width: 1240px;
  margin: 18px auto 80px;
  padding: 0 28px;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.card {
  position: relative;
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.card-icon {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 8px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin: 6px 0 6px;
  /* clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  color: var(--ink-soft);
  font-size: 13.5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 14px;
}

.card-meta {
  color: var(--ink-muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-meta .badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink-soft);
  font-size: 11.5px;
}

.card-link {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* "New" tile — only shown on admin homepage preview (not used here) */
.card.card-empty {
  background: transparent;
  border: 2px dashed #dcdce3;
  color: var(--ink-muted);
  align-items: center;
  justify-content: center;
  min-height: 200px;
  display: flex;
}

/* ---------- Empty state on homepage ---------- */

.empty-state {
  max-width: 640px;
  margin: 40px auto 80px;
  padding: 36px;
  text-align: center;
  color: var(--ink-soft);
  border: 1px dashed #dcdce3;
  border-radius: var(--radius);
  background: #fff;
}
.empty-state h3 { margin: 0 0 8px; color: var(--ink); }

/* ---------- Forms (login + admin) ---------- */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px;
}

.form-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.form-card.narrow {
  max-width: 420px;
  margin: 8vh auto 0;
}

.form-title {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
}
.form-sub {
  color: var(--ink-muted);
  margin: 0 0 18px;
  font-size: 14px;
}

.field {
  display: block;
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 500;
}
.field input[type="text"],
.field input[type="url"],
.field input[type="password"],
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 4px rgba(138, 91, 255, 0.12);
}
.field textarea { min-height: 90px; resize: vertical; }

.field .hint {
  color: var(--ink-muted);
  font-size: 12px;
  margin-top: 6px;
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 560px) {
  .row-2 { grid-template-columns: 1fr; }
}

.alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 14px;
}
.alert.error { background: var(--danger-bg); color: var(--danger); }
.alert.ok { background: #e8f5ec; color: #177245; }

/* ---------- Admin table ---------- */

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }

.entries-list {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.entries-list header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.entries-list header .count {
  color: var(--ink-muted);
  font-weight: 400;
  font-size: 13px;
}

.entry-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.entry-row:last-child { border-bottom: 0; }
.entry-row .ico { font-size: 22px; }
.entry-row .title { font-weight: 600; }
.entry-row .desc {
  color: var(--ink-soft);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.entry-row .url {
  color: var(--ink-muted);
  font-size: 12px;
  word-break: break-all;
}
.entry-row .kind {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef1ff;
  color: var(--brand-1);
  font-size: 11.5px;
  font-weight: 600;
  vertical-align: 1px;
}

.color-picker, .icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.color-picker label, .icon-picker label {
  cursor: pointer;
  border-radius: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
}
.color-picker input, .icon-picker input { display: none; }
.color-picker input:checked + span,
.icon-picker input:checked + span { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.color-swatch {
  display: inline-block;
  width: 18px; height: 18px; border-radius: 6px;
  vertical-align: -4px; margin-right: 6px;
  border: 1px solid rgba(0,0,0,0.06);
}
.sw-cream { background: #f7f3e8; }
.sw-mint { background: #e8f5ec; }
.sw-peach { background: #fde8df; }
.sw-lavender { background: #ece4fb; }
.sw-sky { background: #dff0ff; }
.sw-pink { background: #fde4ec; }
.sw-sand { background: #f2ece1; }
.sw-sage { background: #e6efe3; }

.footer {
  text-align: center;
  color: var(--ink-muted);
  font-size: 12.5px;
  padding: 16px 0 40px;
}

/* ---------- Small-screen tweaks ---------- */

@media (max-width: 640px) {
  .topbar-inner { padding: 12px 16px; }
  .hero { padding: 36px 16px 8px; }
  .grid { padding: 0 16px; gap: 14px; }
  .section-title { padding: 0 16px; }
  .page { padding: 20px 16px; }
}
