/*
 * Touch Therapies CMS — Tropical Botanical admin theme.
 * Palette, type and shadows track the front-end design system in
 * frontend/src/index.css; the names here mirror the Tailwind tokens there so
 * the two stay recognisably one product. Keep them in step.
 */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,600;1,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --palm-400: #74a892;
  --palm-500: #2d6a4f;
  --palm-600: #245741;
  --forest-700: #1b4332;
  --forest-900: #0f2a1f;
  --terra-400: #d97b5f;
  --terra-500: #c96a4e;
  --cream: #faf6ee;
  --sand: #f1e8d8;
  --ink: #22372f;
  --muted: #6b7f74;

  --font-display: 'Playfair Display', Georgia, serif;
  --shadow-soft: 0 20px 50px -22px rgb(27 67 50 / 0.28);
  --shadow-card: 0 12px 34px -18px rgb(27 67 50 / 0.25);

  --radius: 14px;
  --radius-lg: 24px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font: 15px/1.6 'Inter', system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.18; font-weight: 600; }
a { color: var(--palm-500); text-decoration: none; }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--forest-900);
  color: #d7e6dc;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand { color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; }
.brand em { color: var(--palm-400); font-style: italic; }
.brand span {
  display: block; font-size: 0.65rem; letter-spacing: 0.3em;
  text-transform: uppercase; color: #8fae9c; margin-top: 2px; font-family: 'Inter', sans-serif;
}
.sidebar nav { display: grid; gap: 2px; flex: 1; }
.sidebar nav a {
  color: #d7e6dc; padding: 9px 12px; border-radius: 10px; font-size: 0.9rem;
  transition: background 0.2s;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar nav a.on { background: var(--palm-500); color: #fff; }
.logout { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.82rem; }
.logout button {
  background: none; border: 1px solid rgba(255, 255, 255, 0.3); color: #d7e6dc;
  border-radius: 8px; padding: 5px 10px; cursor: pointer;
}
.logout button:hover { background: var(--terra-500); border-color: var(--terra-500); }

.content { padding: 32px 36px; max-width: 1200px; }

.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 1.75rem; color: var(--forest-700); }
.page-head p { color: var(--muted); font-size: 0.9rem; }
.page-head.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }

/* The front end's section kicker, reused for form section headings. */
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--terra-400);
}
.eyebrow::before {
  content: ''; height: 2px; width: 32px; border-radius: 2px; background: var(--terra-400);
}

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 0.9rem; font-weight: 500; }
.flash.ok { background: #d9f2ee; color: #0c5c50; }
.flash.err { background: #fde5e1; color: #a2372a; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat {
  background: #fff; border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-card); transition: transform 0.15s;
}
.stat:hover { transform: translateY(-3px); }
.stat strong { display: block; font-family: var(--font-display); font-size: 1.7rem; color: var(--palm-500); }
.stat span { font-size: 0.8rem; color: var(--muted); }

.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel {
  background: #fff; border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-card); margin-bottom: 16px;
}
.panel h2 { font-size: 1.02rem; color: var(--forest-700); margin-bottom: 12px; }
.mini-list { list-style: none; display: grid; gap: 10px; }
.mini-list li { display: grid; gap: 1px; border-bottom: 1px solid var(--sand); padding-bottom: 8px; font-size: 0.86rem; }
.mini-list li:last-child { border: 0; }
.mini-list em { color: var(--muted); font-style: normal; font-size: 0.75rem; }
.empty { color: var(--muted); font-size: 0.88rem; padding: 12px 0; text-align: center; }

.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--muted); font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 2px solid var(--sand);
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--sand); vertical-align: middle; }
.table .actions { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.table td.wrap-text { max-width: 340px; }
.thumb { width: 54px; height: 40px; object-fit: cover; border-radius: 6px; display: block; }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--sand); color: var(--muted); font-size: 0.72rem; font-weight: 600;
}
.badge.ok { background: #d9f2ee; color: #0c5c50; }

.btn {
  display: inline-block; background: var(--palm-500); color: #fff; border: 0;
  padding: 9px 18px; border-radius: 999px; font-weight: 600; font-size: 0.85rem;
  cursor: pointer; transition: background 0.2s, transform 0.15s;
}
.btn:hover { background: var(--palm-600); transform: translateY(-1px); }
.btn.sm { padding: 5px 12px; font-size: 0.78rem; }
.btn.danger { background: #fde5e1; color: #a2372a; }
.btn.danger:hover { background: var(--terra-500); color: #fff; }
/* Matches .btn-primary on the site: terracotta, with its lifted shadow. */
.btn.primary {
  padding: 11px 26px; background: var(--terra-400);
  box-shadow: 0 16px 32px -12px rgb(217 123 95 / 0.55);
}
.btn.primary:hover { background: var(--terra-500); }

.form { display: grid; gap: 18px; max-width: 760px; }
.field { display: grid; gap: 6px; }
.field[hidden] { display: none; } /* beats .field's own display:grid */
.field label { font-weight: 600; font-size: 0.86rem; }
.field small { color: var(--muted); font-size: 0.78rem; }
.field input[type='text'], .field input[type='email'], .field input[type='password'],
.field input[type='number'], .field input[type='date'], .field input[type='time'],
.field input[type='datetime-local'], .field textarea, .field select {
  width: 100%; padding: 10px 13px; border: 1.5px solid #d8e2d8; border-radius: 10px;
  font: inherit; background: #fff; transition: border-color 0.2s;
}
.field :is(input, textarea, select):focus { outline: none; border-color: var(--palm-500); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 0.82rem; }
.switch { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; }
.image-field { display: flex; gap: 8px; }
.image-field input { flex: 1; }
.upload-btn { align-self: center; }
.preview { max-width: 220px; border-radius: 10px; margin-top: 6px; }

/* Form sections mirror the blocks a visitor scrolls through on the page. */
.form-sec { display: grid; gap: 18px; padding: 26px; border-radius: var(--radius-lg); }
.form-sec-head { display: grid; gap: 6px; }
.form-sec-head p { color: var(--muted); font-size: 0.84rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row[hidden] { display: none; }

/* Collapsed by default: slugs and SEO, which the client rarely touches. */
.form-adv { border-radius: var(--radius-lg); padding: 0; }
.form-adv summary {
  cursor: pointer; padding: 18px 26px; font-weight: 600; font-size: 0.86rem;
  color: var(--muted); list-style: none; display: flex; align-items: center; gap: 8px;
}
.form-adv summary::-webkit-details-marker { display: none; }
.form-adv summary::before {
  content: '▸'; transition: transform 0.2s; font-size: 0.7rem; color: var(--palm-400);
}
.form-adv[open] summary::before { transform: rotate(90deg); }
.form-adv summary:hover { color: var(--forest-700); }
.form-adv-body { display: grid; gap: 18px; padding: 0 26px 26px; }

/* Save never scrolls away: a floating pill at the foot of the form column. */
.save-bar {
  position: sticky; bottom: 16px; z-index: 5;
  display: flex; align-items: center; justify-content: flex-end; gap: 20px;
  padding: 14px 22px; border-radius: 999px;
  background: rgb(255 255 255 / 0.85); backdrop-filter: blur(10px);
  border: 1px solid var(--sand); box-shadow: var(--shadow-card);
}
.save-bar .field { gap: 0; }

/* TinyMCE frame: match the other inputs' border and radius. */
.tox.tox-tinymce {
  border: 1.5px solid #d8e2d8 !important;
  border-radius: 10px !important;
}
.tox .tox-editor-header { box-shadow: none !important; border-bottom: 1px solid var(--sand) !important; }

/* Login */
.login-page {
  display: grid; place-items: center; min-height: 100vh;
  background: linear-gradient(135deg, var(--forest-900), var(--palm-500));
}
.login-card {
  background: #fff; border-radius: 20px; padding: 40px;
  width: min(400px, 92%); display: grid; gap: 14px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.4);
}
.login-card h1 { font-size: 1.5rem; color: var(--forest-700); text-align: center; }
.login-card h1 em { color: var(--palm-500); }
.login-card .sub {
  text-align: center; font-size: 0.72rem; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--muted); margin-top: -8px;
}
.login-card label { display: grid; gap: 5px; font-weight: 600; font-size: 0.86rem; }
.login-card input {
  padding: 11px 14px; border: 1.5px solid #d8e2d8; border-radius: 10px; font: inherit;
}
.login-card input:focus { outline: none; border-color: var(--palm-500); }
.login-card button {
  background: var(--palm-500); color: #fff; border: 0; padding: 12px;
  border-radius: 999px; font-weight: 700; font-size: 0.95rem; cursor: pointer;
}
.login-card button:hover { background: var(--palm-600); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .panel-grid { grid-template-columns: 1fr; }
  .content { padding: 20px; }
  .field-row { grid-template-columns: 1fr; }
  .save-bar { margin: 0 -20px -20px; padding: 14px 20px; }
}

/* Structured JSON editor (json fields get a friendly form; raw is a toggle away) */
.je { display: grid; gap: 12px; }
.je-field { display: grid; gap: 4px; }
.je-field > label { font-weight: 500; font-size: 0.8rem; color: var(--muted); }
.je-legend {
  font-weight: 700; font-size: 0.74rem; color: var(--forest-700);
  text-transform: uppercase; letter-spacing: 0.07em;
}
.je-group {
  border: 1.5px solid var(--sand); border-radius: 10px; padding: 14px;
  display: grid; gap: 10px; background: var(--cream);
}
.je-list { display: grid; gap: 10px; }
.je-item {
  border: 1.5px dashed var(--sand); background: #fff; border-radius: 10px;
  padding: 12px; display: grid; gap: 8px;
}
.je-item .je-remove { justify-self: end; }
.je-add { justify-self: start; }
.je-toggle {
  justify-self: start; background: none; border: 0; padding: 0;
  color: var(--muted); font-size: 0.76rem; cursor: pointer; text-decoration: underline;
}
.je-toggle:hover { color: var(--palm-500); }
.je .preview { max-width: 160px; }
