/* ============================================
   MyDay — Caregiver Demo Styles
   Supplements app.css for /demo route only.
   All touch targets: 60px min.
   ============================================ */

/* ---- Demo header: two-line layout ("Caregiver" + subtitle) ---- */

/*
  Reduce header height for demo — two lines of text fit in 80px.
  Override the 100px from app.css so view-container sits 20px higher.
*/
body.demo-mode #eternal-header {
  min-height: 80px;
  height: 80px;
}

body.demo-mode #view-container {
  top: calc(env(safe-area-inset-top, 0px) + 80px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Shrink main greeting text slightly so both lines fit */
body.demo-mode #eternal-header .greeting {
  font-size: 18pt;
  line-height: 1.1;
}

/* Subtitle line below the greeting */
.demo-header-subtitle {
  font-size: 12pt;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.2;
  letter-spacing: 0.01em;
}

/* Afternoon: dark text needed for readability on yellow */
#eternal-header.block-afternoon .demo-header-subtitle {
  color: rgba(0, 0, 0, 0.65);
}

/* ---- Header left: Back arrow (every page) ---- */
.demo-back-btn {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 110;
  color: rgba(255, 255, 255, 0.95);
}

.demo-back-btn:active {
  opacity: 0.8;
  transform: translateY(-50%) scale(0.95);
}

.demo-back-arrow {
  width: 28px;
  height: 28px;
}

/* Afternoon header: dark arrow */
#eternal-header.block-afternoon .demo-back-btn {
  color: rgba(0, 0, 0, 0.9);
}

body.block-evening .demo-back-btn,
body.block-night .demo-back-btn {
  color: rgba(255, 255, 255, 0.95);
}

/* ---- Demo slide (intro / section / day-theme transition) ---- */

.demo-slide {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
  flex: 1;
  min-height: 0;
  padding: 0 24px;
}

.demo-slide-icon {
  font-size: 64pt;
  line-height: 1;
}

.demo-slide-heading {
  font-size: 26pt;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.3;
}

.demo-slide-body {
  font-size: 20pt;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.demo-slide-btn {
  min-width: 220px;
  min-height: 60px;
  font-size: 20pt;
  font-weight: 600;
  padding: 14px 32px;
  border-radius: var(--radius);
  background: var(--color-action);
  color: #fff;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin-top: 8px;
}

.demo-slide-btn:active {
  opacity: 0.85;
}

/* Evening/night: lighten text on dark background */
body.block-evening .demo-slide-heading,
body.block-night .demo-slide-heading {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

body.block-evening .demo-slide-body,
body.block-night .demo-slide-body {
  color: rgba(255, 255, 255, 0.8);
}

/* ---- Control Center (full-screen navigation hub) ---- */

.demo-control-center {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: min-content;
  padding: 8px 16px;
}

.demo-control-center.view-active .demo-control-btn {
  animation: demo-control-btn-enter 0.35s ease backwards;
}

.demo-control-center.view-active .demo-control-btn:nth-child(1) { animation-delay: 0.02s; }
.demo-control-center.view-active .demo-control-btn:nth-child(2) { animation-delay: 0.04s; }
.demo-control-center.view-active .demo-control-btn:nth-child(3) { animation-delay: 0.06s; }
.demo-control-center.view-active .demo-control-btn:nth-child(4) { animation-delay: 0.08s; }
.demo-control-center.view-active .demo-control-btn:nth-child(5) { animation-delay: 0.10s; }
.demo-control-center.view-active .demo-control-btn:nth-child(6) { animation-delay: 0.12s; }
.demo-control-center.view-active .demo-control-btn:nth-child(7) { animation-delay: 0.14s; }
.demo-control-center.view-active .demo-control-btn:nth-child(8) { animation-delay: 0.16s; }

@keyframes demo-control-btn-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.demo-control-heading {
  font-size: 20pt;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  line-height: 1.3;
  flex-shrink: 0;
}

body.block-evening .demo-control-heading,
body.block-night .demo-control-heading {
  color: #ffffff;
}

.demo-control-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  flex: 1 1 auto;
  min-height: min-content;
}

/* Top-level: 2 large cards, stacked for room for 2-sentence summaries */
.demo-control-grid-top {
  grid-template-columns: 1fr;
  gap: 12px;
}

.demo-control-grid-top .demo-control-btn {
  min-height: 72px;
  padding: 12px 16px;
}

.demo-control-grid-top .demo-control-btn-sub {
  font-size: 13pt;
  line-height: 1.35;
  margin-top: 2px;
}

/* Top-level cards: larger icons for warmth and prominence */
.demo-control-grid-top .demo-control-btn-icon {
  width: 40px;
  height: 40px;
}

.demo-control-grid-top .demo-control-btn-icon .demo-control-icon {
  width: 32px;
  height: 32px;
}

/* Sub-page: full-width buttons, back arrow in header */
.demo-control-subpage {
  position: relative;
}

.demo-control-subpage .demo-control-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (max-width: 380px) {
  .demo-control-grid {
    grid-template-columns: 1fr;
  }
}

/* Glassmorphism: frosted glass over gradient — modern, premium */
.demo-control-btn {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  font-family: var(--font-stack);
  text-align: left;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.demo-control-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.demo-control-btn:active {
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.demo-control-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  color: var(--color-action);
}

.demo-control-btn-icon .demo-control-icon {
  width: 28px;
  height: 28px;
}

.demo-control-btn-label {
  font-size: 16pt;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
}

.demo-control-btn-sub {
  font-size: 12pt;
  color: var(--color-text-muted);
  line-height: 1.2;
  margin-top: 1px;
}

/* Evening/night: glass over dark gradient */
body.block-evening .demo-control-btn,
body.block-night .demo-control-btn {
  background: rgba(255, 255, 255, 0.12);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-color: rgba(255, 255, 255, 0.25);
}

body.block-evening .demo-control-btn:hover,
body.block-night .demo-control-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

body.block-evening .demo-control-btn-icon,
body.block-night .demo-control-btn-icon {
  color: rgba(255, 255, 255, 0.9);
}

body.block-evening .demo-control-btn-label,
body.block-night .demo-control-btn-label {
  color: #ffffff;
}

body.block-evening .demo-control-btn-sub,
body.block-night .demo-control-btn-sub {
  color: rgba(255, 255, 255, 0.7);
}

/* ---- Celebration screen: note above contact bar ---- */

.demo-celebration-note {
  font-size: 12pt;
  color: var(--color-text-muted);
  text-align: center;
  line-height: 1.3;
  margin: 4px 0 0;
  padding: 0 8px;
  flex-shrink: 0;
}

body.block-evening .demo-celebration-note,
body.block-night .demo-celebration-note {
  color: rgba(255, 255, 255, 0.65);
}

/* Contact icon (SVG) inside the demo emergency bar button — matches main app */
.demo-contact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.demo-contact-icon .emergency-bar-icon-svg {
  width: 28px;
  height: 28px;
}

/* ---- Takeover labels (subtle caregiver context badge) ---- */

/*
  Shown on: #success-overlay, .activity-takeover, .celebration-reward.
  A small pill at the top so caregivers know which feature they're seeing.
*/
.demo-takeover-label {
  display: none; /* shown by adding .visible */
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13pt;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  letter-spacing: 0.02em;
}

.demo-takeover-label.visible {
  display: block;
}

/* Success overlay must stay position:fixed to cover full viewport.
   .demo-takeover-label positions relative to it; fixed creates containing block. */

/* ---- Demo rest bar (fake people, no links) ---- */

/*
  Shown during celebration screen instead of the real emergency bar.
  Flush to bottom of viewport; demo-specific padding matches bar height.
*/
#demo-rest-bar {
  display: none; /* shown by adding .visible */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 2px solid #e0e0e0;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Demo bar is shorter than real bar; use matching padding so no gap */
body.demo-mode #view-container.rest-state-with-banner {
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

#demo-rest-bar.visible {
  display: flex;
}

#demo-rest-bar-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 60px;
  width: 100%;
}

.demo-rest-bar-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #e0e0e0;
}

.demo-rest-bar-name {
  font-size: 18pt;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}


/* Evening/night: invert rest bar for dark backgrounds */
body.block-evening #demo-rest-bar,
body.block-night #demo-rest-bar {
  background: #1a1240;
  border-color: rgba(255, 255, 255, 0.15);
}

body.block-evening .demo-rest-bar-name,
body.block-night .demo-rest-bar-name {
  color: #ffffff;
}

body.block-evening .demo-rest-bar-avatar,
body.block-night .demo-rest-bar-avatar {
  border-color: rgba(255, 255, 255, 0.3);
}

/* ---- Control center footer (mailto link) ---- */

.demo-control-footer {
  width: 100%;
  text-align: center;
  padding: 8px 0 4px;
  flex-shrink: 0;
}

.demo-control-footer-link {
  font-size: 13pt;
  color: #c98b3c;
  text-decoration: none;
  font-weight: 500;
  line-height: 1.4;
  padding: 8px 12px;
  display: inline-block;
  min-height: 60px;
  -webkit-tap-highlight-color: transparent;
}

.demo-control-footer-link:active {
  opacity: 0.7;
}

/* Reduce control center heading size so 8 buttons + footer fit */
.demo-control-heading {
  font-size: 16pt !important;
}

.demo-control-grid {
  gap: 8px !important;
}

.demo-control-btn {
  min-height: 54px !important;
  padding: 8px 12px !important;
}
