/* ---------- Cynthia Styles — rose/blush theme ---------- */

:root {
  --blush-50:  #FDF6F3;
  --blush-100: #FBEEE9;
  --blush-200: #F6DCD3;
  --blush-300: #EDBBAE;
  --rose-400:  #D88B82;
  --rose-500:  #C66E64;
  --rose-600:  #A6534B;
  --rose-700:  #7D3934;
  --gold:      #B89370;
  --gold-soft: #D9BFA1;
  --ink:       #3D2A2A;
  --ink-soft:  #6B5454;
  --muted:     #A89696;
  --line:      #EBD9D2;
  --bg:        #FBF6F2;
  --card:      #FFFFFF;
  --shadow:    0 1px 3px rgba(125, 57, 52, 0.06), 0 8px 24px rgba(125, 57, 52, 0.06);
  --radius:    14px;
  --radius-sm: 8px;

  --ok:    #4F8A6E;
  --warn:  #C28A2E;
  --bad:   #B14545;
  --info:  #6E8AB8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Lato', system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--rose-600); text-decoration: none; }
a:hover { color: var(--rose-700); text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 .5em 0;
  letter-spacing: 0.2px;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

/* ---------- Layout ---------- */

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

.sidebar {
  background: linear-gradient(180deg, #fff 0%, var(--blush-100) 100%);
  border-right: 1px solid var(--line);
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.brand {
  text-align: center;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.brand .brand-mark {
  font-family: 'Playfair Display', serif;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--rose-600);
  line-height: 1;
}
.brand .brand-tagline {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  color: var(--gold);
  margin-top: 4px;
  letter-spacing: 0.5px;
}
.brand .brand-tagline em { font-style: italic; font-weight: 500; }
.brand .brand-sub {
  font-size: 0.72rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--blush-200); color: var(--rose-700); text-decoration: none; }
.nav a.active {
  background: var(--rose-500);
  color: white;
  box-shadow: 0 2px 8px rgba(198, 110, 100, 0.3);
}
.nav-icon { font-size: 1rem; width: 18px; text-align: center; }

.sidebar .signout {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.main {
  padding: 32px 40px 60px;
  max-width: 1200px;
  width: 100%;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head .lede { color: var(--ink-soft); font-size: 0.95rem; margin-top: -8px; }
.page-head .actions { display: flex; gap: 8px; }

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

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  border: 1px solid var(--line);
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.card-head h2, .card-head h3 { margin: 0; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--rose-500);
  color: white;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  text-decoration: none;
}
.btn:hover { background: var(--rose-600); text-decoration: none; color: white; }
.btn:active { transform: translateY(1px); }

.btn-secondary {
  background: white;
  color: var(--rose-600);
  border: 1px solid var(--rose-400);
}
.btn-secondary:hover { background: var(--blush-100); color: var(--rose-700); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--blush-100); color: var(--ink); }

.btn-danger {
  background: white;
  color: var(--bad);
  border: 1px solid var(--bad);
}
.btn-danger:hover { background: var(--bad); color: white; }

.btn-sm { padding: 5px 11px; font-size: 0.82rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ---------- Forms ---------- */

.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
input[type=text], input[type=email], input[type=tel],
input[type=password], input[type=date], input[type=time],
input[type=datetime-local], input[type=number], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--rose-400);
  box-shadow: 0 0 0 3px rgba(216, 139, 130, 0.18);
}
textarea { min-height: 80px; resize: vertical; }

.checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 16px; }
.check {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
}
.check:hover { background: var(--blush-50); }
.check input { width: auto; }
.check .price { margin-left: auto; color: var(--gold); font-weight: 600; font-size: 0.85rem; }

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.76rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 10px 8px;
  border-bottom: 2px solid var(--line);
}
table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table tr:hover td { background: var(--blush-50); }
table .num { text-align: right; font-variant-numeric: tabular-nums; }
table .actions { white-space: nowrap; }

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Stat tiles ---------- */

.stat {
  background: white;
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--rose-400), var(--gold));
}
.stat .label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat .value {
  font-family: 'Playfair Display', serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--ink);
}
.stat .hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 4px; }

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-scheduled { background: rgba(110, 138, 184, 0.15); color: var(--info); }
.badge-completed { background: rgba(79, 138, 110, 0.15); color: var(--ok); }
.badge-cancelled { background: rgba(177, 69, 69, 0.12); color: var(--bad); }
.badge-no_show   { background: rgba(194, 138, 46, 0.15); color: var(--warn); }
.badge-internal  { background: rgba(61, 42, 42, 0.1); color: var(--ink-soft); }

/* ---------- Flash ---------- */

.flash {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-weight: 500;
  border-left: 4px solid;
}
.flash-success { background: #EBF4EE; color: #295A40; border-color: var(--ok); }
.flash-error   { background: #F8E8E8; color: #6B2323; border-color: var(--bad); }
.flash-info    { background: var(--blush-100); color: var(--rose-700); border-color: var(--rose-400); }

/* ---------- Login ---------- */

.login-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 30%, rgba(237, 187, 174, 0.5), transparent 60%),
    radial-gradient(circle at 80% 70%, rgba(217, 191, 161, 0.4), transparent 55%),
    var(--blush-50);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 18px;
  padding: 44px 38px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 10px 40px rgba(125, 57, 52, 0.15), 0 2px 6px rgba(125, 57, 52, 0.06);
  text-align: center;
}
.login-card .brand-mark { font-family: 'Playfair Display', serif; font-size: 2.6rem; color: var(--rose-600); line-height: 1; }
.login-card .brand-tagline { font-family: 'Playfair Display', serif; font-size: 1.05rem; color: var(--gold); margin: 4px 0 24px; }
.login-card .brand-tagline em { font-style: italic; }
.login-card .brand-sub { font-size: 0.7rem; letter-spacing: 4px; text-transform: uppercase; color: var(--muted); margin: 2px 0 24px; }
.login-card .form-row label { text-align: left; }
.login-card .form-row { text-align: left; }

/* ---------- Calendar ---------- */

#calendar { background: white; border-radius: var(--radius); padding: 14px; }
.fc {
  font-family: inherit !important;
}
.fc .fc-toolbar-title { font-family: 'Playfair Display', serif !important; color: var(--ink); }
.fc .fc-button {
  background: white !important;
  color: var(--rose-600) !important;
  border: 1px solid var(--rose-400) !important;
  text-transform: capitalize !important;
  font-weight: 600 !important;
}
.fc .fc-button:hover { background: var(--blush-100) !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--rose-500) !important;
  color: white !important;
  border-color: var(--rose-500) !important;
}
.fc-event {
  cursor: pointer;
  padding: 2px 5px;
  font-size: 0.78rem;
  background: var(--blush-300) !important;
  border-color: var(--rose-400) !important;
  color: var(--ink) !important;
}
.fc-event .fc-event-title,
.fc-event .fc-event-time,
.fc-event a { color: inherit !important; }

/* Internal blocks are visually distinct via the diagonal stripe pattern
   (see status-internal below), so appointments don't need different
   colors per status -- they all read as 'appointments'. Cancelled/no-show
   get text-decoration cues instead of new background colors. */
.fc-event.status-cancelled {
  background: var(--blush-200) !important;
  border-color: var(--muted) !important;
  color: var(--muted) !important;
  text-decoration: line-through;
}
.fc-event.status-no_show {
  background: var(--blush-200) !important;
  border-color: var(--warn) !important;
  color: var(--warn) !important;
}
.fc-event.status-internal  {
  background: repeating-linear-gradient(
    45deg, var(--blush-200), var(--blush-200) 6px,
    var(--blush-100) 6px, var(--blush-100) 12px
  ) !important;
  color: var(--ink-soft) !important;
  border-color: var(--blush-300) !important;
  cursor: default;
  font-style: italic;
}

/* ---------- Misc ---------- */

.divider { height: 1px; background: var(--line); margin: 18px 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-tabs a {
  padding: 6px 14px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}
.pill-tabs a:hover { text-decoration: none; background: var(--blush-100); }
.pill-tabs a.active { background: var(--rose-500); color: white; border-color: var(--rose-500); }

.inline-form { display: inline; }
.inline { display: inline-flex; align-items: center; gap: 6px; }

.kv { display: grid; grid-template-columns: 140px 1fr; row-gap: 8px; }
.kv dt { color: var(--ink-soft); font-size: 0.85rem; }
.kv dd { margin: 0; color: var(--ink); }

.search-bar {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.search-bar input { flex: 1; }

/* ---------- Mobile (iPhone/iPad) ---------- */

/* Prevent iOS auto-zoom on input focus (any input <16px triggers zoom) */
input, select, textarea {
  font-size: 16px;
}

/* Hamburger toggle — hidden on desktop */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  width: 44px;
  height: 44px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 20px;
  color: var(--rose-600);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Tablet/iPad portrait and below: collapse sidebar to top, single-col grids */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
    padding: 18px;
  }
  .sidebar .brand { padding-bottom: 14px; margin-bottom: 12px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .nav a { padding: 12px 14px; min-height: 44px; }
  .sidebar .signout { border-top: none; margin-top: 8px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }
  .main { padding: 20px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .page-head .actions { width: 100%; flex-wrap: wrap; }
}

/* Phone: hide sidebar by default behind a hamburger */
@media (max-width: 640px) {
  .mobile-nav-toggle { display: inline-flex; }
  .sidebar {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 78%;
    max-width: 320px;
    height: 100vh;
    z-index: 90;
    overflow-y: auto;
    box-shadow: 4px 0 24px rgba(125,57,52,0.18);
    padding: 64px 18px 18px;
  }
  body.nav-open .sidebar { display: flex; flex-direction: column; }
  body.nav-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(61,42,42,0.4);
    z-index: 80;
  }
  .nav { flex-direction: column; }
  .nav a { width: 100%; }
  .main { padding: 60px 16px 80px; }
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.2rem; }

  /* Horizontal scroll for wide tables on phones */
  .card table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .card table th, .card table td { white-space: nowrap; }

  /* Bigger tap targets */
  .btn { min-height: 44px; padding: 10px 18px; }
  .btn-sm { min-height: 36px; padding: 7px 12px; }
  .pill-tabs a { padding: 9px 14px; min-height: 36px; }
  .check { min-height: 44px; }

  /* Forms */
  .grid[style*="grid-template-columns:repeat(5"] { grid-template-columns: 1fr 1fr !important; }

  /* Stat tile values stay readable */
  .stat .value { font-size: 1.4rem; }
}

/* Print */
@media print {
  .sidebar, .actions, .btn, .mobile-nav-toggle { display: none !important; }
  .main { padding: 0; }
}
