/* ====== AiSaid — Elegant Pilates Studio ====== */

:root {
  --bg: #faf6f2;
  --surface: #ffffff;
  --surface-warm: #fdf9f6;
  --text: #3d2e2e;
  --text-secondary: #8a7575;
  --accent: #c4956a;
  --accent-light: #e8cdb5;
  --accent-dark: #a87b52;
  --rose: #d4a0a0;
  --rose-light: #f0dede;
  --sage: #a8b8a0;
  --sage-light: #e2ebe0;
  --border: #ede6df;
  --shadow-sm: 0 2px 8px rgba(61, 46, 46, 0.06);
  --shadow-md: 0 8px 32px rgba(61, 46, 46, 0.08);
  --shadow-lg: 0 16px 48px rgba(61, 46, 46, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Noto Sans SC", "PingFang SC", -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

.page { animation: fadeIn 0.4s ease; }
.hidden { display: none !important; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ====== Landing ====== */
.landing { min-height: 100dvh; display: flex; align-items: center; justify-content: center; }
.landing-content { text-align: center; width: 100%; padding: 2rem 0; }

.logo-mark {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--rose));
  color: #fff; font-family: "Playfair Display", serif;
  font-size: 2.2rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.2rem;
  box-shadow: 0 8px 24px rgba(196, 149, 106, 0.3);
}

.brand { font-family: "Playfair Display", serif; font-size: 2.8rem; font-weight: 700; color: var(--text); letter-spacing: 1px; }
.tagline { color: var(--text-secondary); font-size: 0.95rem; font-weight: 300; margin-top: 0.3rem; letter-spacing: 2px; }

.landing-actions { display: flex; flex-direction: column; gap: 14px; margin-top: 2.5rem; }

.landing-btn {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 24px;
  cursor: pointer; text-align: left;
  transition: var(--transition); box-shadow: var(--shadow-sm);
}
.landing-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.landing-btn:active { transform: translateY(0); }

.landing-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.teacher-btn .landing-icon { background: linear-gradient(135deg, #f0dede, #e8cdb5); color: var(--accent-dark); }
.student-btn .landing-icon { background: linear-gradient(135deg, #e2ebe0, #d4e0d0); color: #6b7f63; }

.landing-label { display: block; font-size: 1.1rem; font-weight: 600; color: var(--text); }
.landing-sub { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; font-weight: 300; }

/* ====== Top Bar ====== */
.top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; position: sticky; top: 0; background: var(--bg); z-index: 10;
}

.back-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary); transition: var(--transition);
}
.back-btn:hover { background: var(--border); color: var(--text); }

.top-title { display: flex; align-items: center; gap: 8px; }
.top-brand { font-family: "Playfair Display", serif; font-weight: 700; font-size: 1.2rem; color: var(--text); }
.top-role { font-size: 0.75rem; font-weight: 500; color: var(--accent-dark); background: var(--accent-light); padding: 2px 10px; border-radius: 99px; }

/* ====== Tabs ====== */
.tab-nav { display: flex; gap: 4px; background: var(--surface); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 16px; border: 1px solid var(--border); }
.tab { flex: 1; border: none; background: transparent; padding: 10px 0; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); border-radius: 8px; cursor: pointer; transition: var(--transition); font-family: inherit; }
.tab.active { background: var(--text); color: #fff; box-shadow: 0 2px 8px rgba(61, 46, 46, 0.15); }
.tab-content { display: none; animation: slideUp 0.3s ease; }
.tab-content.active { display: block; }

/* ====== Cards ====== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 14px; box-shadow: var(--shadow-sm); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h3 { font-size: 1rem; font-weight: 600; color: var(--text); }
.badge { font-size: 0.75rem; font-weight: 600; background: var(--accent-light); color: var(--accent-dark); padding: 2px 10px; border-radius: 99px; min-width: 24px; text-align: center; }

/* ====== Form ====== */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.5px; }

.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 14px; height: 44px; font-size: 0.9rem; font-family: inherit;
  color: var(--text); background: var(--surface-warm); transition: var(--transition); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.12); }
.field textarea { height: auto; min-height: 100px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a7575' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.form-row { display: flex; gap: 12px; align-items: flex-start; }
.form-row .field { flex: 1; }

/* ====== Buttons ====== */
.btn-primary {
  width: 100%; height: 46px; border: none; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; font-size: 0.9rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: var(--transition); letter-spacing: 1px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(196, 149, 106, 0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-sm { width: auto; height: 44px; padding: 0 24px; white-space: nowrap; }

.btn-confirm, .btn-reject {
  border: none; padding: 8px 20px; border-radius: 8px;
  font-size: 0.82rem; font-weight: 600; font-family: inherit; cursor: pointer; transition: var(--transition);
}
.btn-confirm { background: var(--sage-light); color: #4a6340; }
.btn-confirm:hover { background: var(--sage); color: #fff; }
.btn-reject { background: var(--rose-light); color: #8a5050; }
.btn-reject:hover { background: var(--rose); color: #fff; }

.btn-secondary {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary);
  padding: 10px 24px; border-radius: 8px; font-size: 0.85rem; font-weight: 500;
  font-family: inherit; cursor: pointer; transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--accent-light); }

.btn-reject-confirm {
  border: none; background: #8a5050; color: #fff;
  padding: 10px 24px; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: var(--transition);
}
.btn-reject-confirm:hover { background: #6e3e3e; }

/* ====== Stats ====== */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 12px; text-align: center; box-shadow: var(--shadow-sm); }
.stat-value { font-family: "Playfair Display", serif; font-size: 2rem; font-weight: 700; color: var(--accent-dark); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); margin-top: 6px; font-weight: 400; }

/* ====== Progress ====== */
.progress-card { padding: 16px 20px; }
.progress-header { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 10px; font-weight: 500; }
.progress-bar { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-light), var(--accent)); border-radius: 99px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); width: 0%; }

/* ====== Lists ====== */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-empty { text-align: center; padding: 32px 16px; color: var(--text-secondary); font-size: 0.88rem; font-weight: 300; }
.list-empty svg { display: block; margin: 0 auto 12px; opacity: 0.3; }

.student-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface-warm); border: 1px solid var(--border); border-radius: var(--radius-sm); transition: var(--transition); }
.student-item:hover { border-color: var(--accent-light); }
.student-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--accent-light), var(--rose-light)); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.85rem; color: var(--accent-dark); flex-shrink: 0; }
.student-meta { flex: 1; }
.student-name { font-weight: 600; font-size: 0.92rem; color: var(--text); }
.student-stats { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.student-remaining { font-weight: 600; color: var(--accent-dark); }

/* ====== Records ====== */
.record-item { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.record-date { font-size: 0.78rem; font-weight: 600; color: var(--accent-dark); margin-bottom: 6px; letter-spacing: 0.5px; }
.record-note { font-size: 0.88rem; color: var(--text); line-height: 1.7; }
.record-note b, .record-note strong { font-weight: 600; }

/* ====== Bookings ====== */
.booking-item { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.booking-info { margin-bottom: 12px; }
.booking-student { font-weight: 600; font-size: 0.92rem; color: var(--text); }
.booking-time { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }
.booking-actions { display: flex; gap: 8px; }

/* 建议时间提示 */
.booking-suggest {
  margin-top: 8px; padding: 10px 14px;
  background: #fff8f0; border: 1px solid var(--accent-light);
  border-radius: 8px; font-size: 0.8rem; color: var(--accent-dark);
  line-height: 1.5;
}

.status-tag { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.5px; }
.status-pending { background: #fff3e0; color: #c47a00; }
.status-confirmed { background: var(--sage-light); color: #4a6340; }
.status-rejected { background: var(--rose-light); color: #8a5050; }

/* ====== Time Slots ====== */
.time-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.time-slot {
  border: 1px solid var(--border);
  background: var(--surface-warm);
  border-radius: 8px;
  padding: 10px 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.time-slot:hover { border-color: var(--accent-light); }

.time-slot.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(196, 149, 106, 0.3);
}

.time-slot.other {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ====== Template Chips ====== */
.template-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-chip {
  border: 1px solid var(--border);
  background: var(--surface-warm);
  border-radius: 99px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.template-chip:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: #fdf5ee;
}

/* ====== Rich Editor ====== */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.toolbar-btn {
  width: 32px; height: 32px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.toolbar-btn:hover { background: var(--border); }
.toolbar-btn.active { background: var(--accent-light); border-color: var(--accent); }

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.color-btn { font-weight: 900; font-size: 0.9rem; }
.color-btn.active { border: 2px solid currentColor; }

.rich-editor {
  min-height: 120px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  line-height: 1.7;
  outline: none;
  transition: var(--transition);
}

.rich-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.12); }

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-secondary);
  opacity: 0.5;
  pointer-events: none;
}

/* ====== Modal ====== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(61, 46, 46, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%; max-width: 480px;
  padding: 24px 20px;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 { font-size: 1rem; font-weight: 600; }

.modal-close {
  width: 32px; height: 32px; border: none; background: transparent;
  font-size: 1.5rem; color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.modal-desc { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 16px; }

.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions button { flex: 1; }

/* ====== Hints & Toast ====== */
.hint { font-size: 0.78rem; color: var(--text-secondary); margin-top: 12px; text-align: center; font-weight: 300; }

.toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff;
  padding: 12px 28px; border-radius: 99px;
  font-size: 0.85rem; font-weight: 500;
  z-index: 999; opacity: 0;
  transition: all 0.3s ease; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer { text-align: center; padding: 24px 0 16px; font-size: 0.75rem; color: var(--text-secondary); font-weight: 300; letter-spacing: 1px; }
.student-picker { margin-top: 0; }

@media (min-width: 600px) {
  .app { max-width: 520px; }
  .landing-actions { max-width: 400px; margin-left: auto; margin-right: auto; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1614; --surface: #252120; --surface-warm: #2a2523;
    --text: #e8ddd5; --text-secondary: #9a8e88; --border: #3a3230;
    --accent-light: #4a3d30; --rose-light: #3a2d2d; --sage-light: #2d3a2d;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2); --shadow-md: 0 8px 32px rgba(0,0,0,0.3);
  }
  .tab.active { background: var(--accent); color: #fff; }
  .time-slot.selected { background: var(--accent); }
  .booking-suggest { background: #2a2320; }
}
