/* ================= Font ================= */
@font-face {
  font-family: 'LINESeedTW';
  src: url('fonts/LINESeedTW_TTF_Rg.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

/* ================= 全域變數 ================= */
:root {
  --ivory: #FAF9F6;
  --dusty-blue: #7C98AB;
  --warm-gold: #C5A059;
  --text-main: #333333;
  --text-light: #777777;
  --shadow: 0 8px 20px rgba(124, 152, 171, 0.1);
}

/* ================= 基礎重置 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--ivory);
  color: var(--text-main);
  font-family: 'LINESeedTW', 'Helvetica Neue', Arial, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  line-height: 1.6;
}
.serif { font-family: 'Playfair Display', 'Noto Serif TC', serif; }
h1, h2, h3, .serif-text { font-family: 'Playfair Display', 'Noto Serif TC', serif; }

/* ================= Modal Overlay ================= */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(30,40,50,0.42); z-index: 900;
  align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: #fff; border-radius: 16px; padding: 36px 40px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.18);
  animation: slideUp 0.28s ease; position: relative;
}
@keyframes slideUp {
  from { transform: translateY(28px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.modal-title { font-family: 'Playfair Display','Noto Serif TC',serif; font-size: 1.3rem; color: var(--dusty-blue); }
.modal-close {
  background: none; border: none; font-size: 1.3rem; color: #ccc;
  cursor: pointer; line-height: 1; transition: color 0.2s; padding: 2px 6px;
}
.modal-close:hover { color: var(--text-main); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ================= Modal Section Title / Divider ================= */
.modal-section-title,
.section-divider {
  font-size: 0.73rem; color: var(--dusty-blue);
  text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600;
  padding: 14px 0 6px;
  border-bottom: 1px solid rgba(124,152,171,0.2);
  margin-bottom: 14px;
}

/* ================= Form ================= */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 0.78rem; color: var(--text-light);
  margin-bottom: 6px; letter-spacing: 0.5px; text-transform: uppercase;
}
.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid #e8e8e8; border-radius: 8px;
  font-size: 0.92rem; color: var(--text-main);
  background: var(--ivory); outline: none; font-family: inherit;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--dusty-blue);
  box-shadow: 0 0 0 3px rgba(124,152,171,0.12);
}
.form-group textarea { resize: vertical; min-height: 78px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

/* Star rating */
.star-input { display: flex; gap: 6px; cursor: pointer; }
.star-input span {
  font-size: 1.5rem; color: #ddd;
  transition: color 0.15s, transform 0.15s; user-select: none;
}
.star-input span.active { color: var(--warm-gold); }
.star-input span:hover  { color: var(--warm-gold); transform: scale(1.15); }

/* ================= Buttons ================= */
.btn-cancel {
  background: transparent; border: 1px solid #e0e0e0; color: var(--text-light);
  padding: 9px 22px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; transition: all 0.2s;
}
.btn-cancel:hover { border-color: #aaa; color: var(--text-main); }
.btn-save {
  background: var(--dusty-blue); color: #fff; border: none;
  padding: 9px 28px; border-radius: 8px; cursor: pointer;
  font-size: 0.9rem; font-family: 'Playfair Display','Noto Serif TC',serif;
  letter-spacing: 0.5px; transition: background 0.25s, transform 0.2s;
}
.btn-save:hover { background: #6a859a; transform: translateY(-1px); }

/* ================= Confirm Modal ================= */
.confirm-modal-card,
.confirm-card { max-width: 360px; text-align: center; padding: 40px 32px; }
.confirm-icon { font-size: 2.6rem; margin-bottom: 14px; }
.confirm-name { font-family: 'Playfair Display','Noto Serif TC',serif; font-size: 1.05rem; color: var(--text-main); margin-bottom: 8px; }
.confirm-sub  { font-size: 0.87rem; color: var(--text-light); }
.btn-delete-confirm {
  background: #e74c3c; color: #fff; border: none;
  padding: 9px 22px; border-radius: 8px; cursor: pointer;
  font-size: 0.9rem; transition: background 0.25s;
}
.btn-delete-confirm:hover { background: #c0392b; }

/* ================= Toast ================= */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: #333; color: #fff;
  padding: 11px 20px; border-radius: 10px;
  font-size: 0.88rem; max-width: 320px;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #2e7d32; }
.toast.error   { background: #c0392b; }

/* ================= Image Upload Area ================= */
.img-upload-area {
  border: 1.5px dashed #ddd; border-radius: 8px;
  padding: 12px; transition: border-color 0.2s;
}
.img-upload-area:hover { border-color: var(--dusty-blue); }
.img-placeholder {
  text-align: center; padding: 18px;
  color: var(--text-light); font-size: 0.88rem; cursor: pointer;
}
.img-upload-controls {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; flex-wrap: wrap;
}
.btn-upload {
  background: var(--dusty-blue); color: #fff; border: none;
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  font-size: 0.82rem; white-space: nowrap; flex-shrink: 0;
  transition: background 0.2s;
}
.btn-upload:hover { background: #6a859a; }
.img-url-or { color: #ccc; font-size: 0.8rem; white-space: nowrap; flex-shrink: 0; }
.img-upload-controls input[type="text"] {
  flex: 1; min-width: 100px; padding: 6px 12px;
  border: 1.5px solid #e8e8e8; border-radius: 6px;
  font-size: 0.88rem; color: var(--text-main);
  background: var(--ivory); outline: none; font-family: inherit;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.img-upload-controls input[type="text"]:focus {
  border-color: var(--dusty-blue); box-shadow: 0 0 0 3px rgba(124,152,171,0.12);
}
.img-remove {
  background: none; border: none; color: #ccc; cursor: pointer;
  font-size: 0.8rem; padding: 2px 6px; border-radius: 4px; transition: color 0.2s;
}
.img-remove:hover { color: #e74c3c; }

/* ================= Detail Page Shared ================= */
.top-bar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,249,246,0.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(124,152,171,0.18);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.btn-back {
  display: flex; align-items: center; gap: 7px;
  background: none; border: none; cursor: pointer;
  color: var(--dusty-blue); font-size: 0.95rem;
  text-decoration: none; transition: color 0.2s;
}
.btn-back:hover { color: #5a7a8a; }
.btn-back .arrow { font-size: 1.1rem; }
.top-bar-title {
  font-family: 'Playfair Display','Noto Serif TC',serif;
  color: var(--text-light); font-size: 0.9rem;
  position: absolute; left: 50%; transform: translateX(-50%);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%;
}
.top-actions { display: flex; gap: 8px; }
.btn-action {
  background: transparent; border: 1px solid #e0e0e0;
  border-radius: 8px; padding: 5px 16px; cursor: pointer;
  font-size: 0.85rem; color: var(--text-light); transition: all 0.2s;
}
.btn-action.edit:hover   { border-color: var(--dusty-blue); color: var(--dusty-blue); }
.btn-action.delete:hover { border-color: #e74c3c; color: #e74c3c; }

.detail-wrap {
  max-width: 760px; margin: 0 auto;
  padding: 36px 24px 80px;
}
.detail-title {
  font-size: 2.1rem; font-family: 'Playfair Display','Noto Serif TC',serif;
  color: var(--text-main); line-height: 1.3; margin-bottom: 32px;
}
.meta-card {
  background: #fff; border-radius: 14px;
  padding: 8px 24px; box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.meta-row {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 13px 0; border-bottom: 1px solid #f5f5f5;
}
.meta-row:last-child { border-bottom: none; }
.meta-icon  { font-size: 1.1rem; width: 26px; flex-shrink: 0; }
.meta-label { width: 80px; flex-shrink: 0; font-size: 0.8rem; color: var(--text-light); padding-top: 2px; }
.meta-value { font-size: 0.93rem; color: var(--text-main); word-break: break-all; }
.meta-value a { color: var(--dusty-blue); text-decoration: none; }
.meta-value a:hover { text-decoration: underline; }
.meta-empty { color: #ccc; font-style: italic; font-size: 0.85rem; }

.section-block { margin-bottom: 28px; }
.section-label {
  font-size: 0.76rem; color: var(--text-light);
  text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 10px;
}
.notes-box {
  background: #fff; border-radius: 14px;
  padding: 20px 24px; box-shadow: var(--shadow);
  font-size: 0.93rem; line-height: 1.85;
  white-space: pre-wrap; word-break: break-word;
  min-height: 64px; color: var(--text-main);
}
.notes-box.empty-notes { color: #ccc; font-style: italic; }

.detail-footer {
  display: flex; gap: 24px; flex-wrap: wrap;
  font-size: 0.76rem; color: #bbb;
  padding-top: 20px;
  border-top: 1px solid rgba(124,152,171,0.15);
}

.state-msg { text-align: center; padding: 100px 20px; color: var(--text-light); }
.state-msg .icon { font-size: 3rem; margin-bottom: 16px; }

/* ================= Load More ================= */
.load-more-wrap {
  text-align: center;
  padding: 32px 0 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  grid-column: 1 / -1;
}
.btn-load-more {
  background: rgba(124,152,171,0.08);
  border: 1.5px solid rgba(124,152,171,0.28);
  color: var(--dusty-blue);
  padding: 10px 36px; border-radius: 24px;
  font-size: 0.88rem; cursor: pointer;
  font-family: 'Playfair Display','Noto Serif TC',serif;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
}
.btn-load-more:hover {
  background: var(--dusty-blue); color: #fff;
  border-color: var(--dusty-blue);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(124,152,171,0.28);
}
.btn-load-more:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(124,152,171,0.18);
}
.load-more-count {
  font-size: 0.75rem; color: #bbb;
  letter-spacing: 0.3px;
}
.load-more-count span {
  color: var(--dusty-blue); font-weight: 600;
}

/* ================= Linked Toeats (detail view) ================= */
.linked-toeats { margin-top: 6px; }
.linked-toeat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; margin-top: 10px;
}
.linked-toeat-card {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  text-decoration: none; color: var(--text-main);
  transition: transform 0.2s, box-shadow 0.2s; cursor: pointer;
}
.linked-toeat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(124,152,171,0.18);
}
.linked-toeat-card img {
  width: 52px; height: 52px; border-radius: 8px;
  object-fit: cover; flex-shrink: 0;
}
.linked-toeat-info { min-width: 0; }
.linked-toeat-info .lt-name {
  font-weight: 600; font-size: 0.92rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.linked-toeat-info .lt-meta {
  font-size: 0.78rem; color: var(--text-light); margin-top: 2px;
}

/* ================= Toeat Picker (modal) ================= */
.toeat-picker { position: relative; }
.toeat-picker input[type="text"] {
  width: 100%; padding: 9px 13px; border: 1.5px solid #e8e8e8;
  border-radius: 9px; font-size: 0.9rem; outline: none;
  transition: border-color 0.25s;
}
.toeat-picker input[type="text"]:focus { border-color: var(--dusty-blue); }
.toeat-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
  background: #fff; border: 1px solid #e0e0e0; border-radius: 8px;
  max-height: 200px; overflow-y: auto; display: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}
.toeat-dropdown.show { display: block; }
.toeat-dropdown-item {
  padding: 8px 14px; cursor: pointer; font-size: 0.88rem;
  display: flex; align-items: center; gap: 10px;
  transition: background 0.15s;
}
.toeat-dropdown-item:hover { background: #f5f8fa; }
.toeat-dropdown-item img {
  width: 32px; height: 32px; border-radius: 6px; object-fit: cover;
}
.toeat-dropdown-item .dd-name { font-weight: 500; }
.toeat-dropdown-item .dd-meta { font-size: 0.76rem; color: var(--text-light); }
.toeat-dropdown-empty {
  padding: 12px 14px; font-size: 0.85rem; color: var(--text-light); text-align: center;
}
.toeat-selected-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.toeat-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(124,152,171,0.10); color: var(--dusty-blue);
  padding: 4px 12px; border-radius: 16px; font-size: 0.82rem;
}
.toeat-tag .tag-remove {
  cursor: pointer; font-size: 0.9rem; opacity: 0.6;
  transition: opacity 0.2s;
}
.toeat-tag .tag-remove:hover { opacity: 1; }

/* ================= Cuisine Chip Picker ================= */
.cuisine-picker {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px 0;
}
.cuisine-chip {
  padding: 5px 13px; border: 1.5px solid #e0e0e0; border-radius: 16px;
  background: #fff; cursor: pointer; font-size: 0.82rem;
  color: var(--text-main);
  transition: all 0.2s; user-select: none;
}
.cuisine-chip:hover {
  border-color: var(--dusty-blue); color: var(--dusty-blue);
}
.cuisine-chip.selected {
  background: var(--dusty-blue); border-color: var(--dusty-blue);
  color: #fff;
}

/* Cuisine inline tags (for display in cards/list/detail) */
.cuisine-tag {
  display: inline-block;
  padding: 2px 9px; margin: 0 4px 2px 0;
  border-radius: 10px; font-size: 0.74rem;
  background: rgba(124,152,171,0.10); color: var(--dusty-blue);
  letter-spacing: 0.2px;
}

/* ================= Shared Responsive ================= */
@media (max-width: 600px) {
  .detail-title { font-size: 1.6rem; }
  .form-row { flex-direction: column; gap: 0; }
  .modal-card { padding: 26px 18px; margin: 0 12px; }
  .top-bar-title { display: none; }
}
