/**
 * fg_app.css
 * Loaded only when app mode is active (fg_app_init injects this file).
 * Uses .fg-app-mode body class (added by fg_app_preprocess_html) for
 * specificity so these rules never affect normal site rendering.
 *
 * Companion responsive rules for the normal site belong in
 * footheme/css/footheme.css, not here.
 */

/* =========================================================
 * App shell layout
 * ========================================================= */

body.fg-app-mode {
  background: #1a1008;         /* Dark parchment — festival feel */
  margin: 0;
  padding: 0;
}

/* Remove Corolla's default page padding in app mode. */
body.fg-app-mode #page,
body.fg-app-mode #main,
body.fg-app-mode #content {
  padding: 0;
  margin: 0;
  max-width: 100%;
}

/* Push content below the fixed app bar. */
body.fg-app-mode #page {
  padding-top: 48px;
}

/* =========================================================
 * App bar
 * ========================================================= */

.fg-app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  z-index: 1000;
  background: #2c1a0e;         /* Dark brown, matches festival palette */
  border-bottom: 2px solid #8b6914;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  box-sizing: border-box;
}

.fg-app-bar-title {
  color: #f5e6c0;
  font-size: 0.95em;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

.fg-app-bar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fg-app-bar-link,
.fg-app-bar-exit {
  color: #f5e6c0;
  text-decoration: none;
  font-size: 0.85em;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  min-height: 36px;            /* Touch target */
  display: flex;
  align-items: center;
}

.fg-app-bar-link:hover,
.fg-app-bar-link:focus {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.fg-app-bar-exit {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(245,230,192,0.3);
  font-size: 0.75em;
  color: rgba(245,230,192,0.7);
}

.fg-app-bar-exit:hover,
.fg-app-bar-exit:focus {
  background: rgba(255,255,255,0.15);
  color: #f5e6c0;
}

/* =========================================================
 * App mode status block (optional, placed in highlighted region)
 * ========================================================= */

.fg-app-status {
  background: #2c1a0e;
  color: #f5e6c0;
  font-size: 0.8em;
  padding: 4px 12px;
  text-align: center;
}

.fg-app-status a {
  color: #f5e6c0;
  text-decoration: underline;
}

/* =========================================================
 * Content area in app mode
 * ========================================================= */

body.fg-app-mode #content,
body.fg-app-mode .region-content {
  padding: 8px 12px;
}

/* Make node titles tighter in app mode. */
body.fg-app-mode h1.page-header,
body.fg-app-mode h1.node-title {
  font-size: 1.4em;
  margin-top: 8px;
  margin-bottom: 8px;
}

/* =========================================================
 * Touch-friendly buttons in app mode
 * ========================================================= */

body.fg-app-mode a.button,
body.fg-app-mode input[type="submit"],
body.fg-app-mode button {
  min-height: 44px;            /* iOS HIG minimum touch target */
  padding: 10px 16px;
  font-size: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* =========================================================
 * Map viewport in app mode
 * Overrides fg_vendor_map.css / fg_patron_map.css map height
 * to fill available screen minus app bar.
 * ========================================================= */

body.fg-app-mode .fg-patron-map-wrap,
body.fg-app-mode .fg-vendor-map-wrap {
  padding: 0;
}

body.fg-app-mode .fg-map-viewport,
body.fg-app-mode #fg-map-viewport {
  height: calc(100vh - 48px);  /* Full screen minus app bar */
  overflow: hidden;
}

/* Hide the vendor map sidebar in app mode — patron map only. */
body.fg-app-mode .fg-vendor-map-sidebar {
  display: none;
}

body.fg-app-mode .fg-vendor-map-stage {
  width: 100%;
}

/* =========================================================
 * Forms in app mode — prevent iOS zoom on focus
 * (font-size >= 16px stops iOS auto-zoom)
 * ========================================================= */

body.fg-app-mode input[type="text"],
body.fg-app-mode input[type="email"],
body.fg-app-mode input[type="password"],
body.fg-app-mode input[type="number"],
body.fg-app-mode input[type="tel"],
body.fg-app-mode select,
body.fg-app-mode textarea {
  font-size: 16px;
}

/* =========================================================
 * Breadcrumb — hidden in app mode (saves vertical space)
 * ========================================================= */

body.fg-app-mode .breadcrumb {
  display: none;
}

/* =========================================================
 * Messages (status/error/warning) — compact in app mode
 * ========================================================= */

body.fg-app-mode .messages {
  margin: 4px 0;
  padding: 8px 12px;
  font-size: 0.9em;
}

/* =========================================================
 * /app/* PATH PAGES (body.section-app / body.page-app)
 * These apply on the /app/* URL paths even before the cookie
 * is set — i.e. on the very first QR scan.
 * ========================================================= */

/* Kill stacked gutters on all /app/* pages */
body.section-app #main-content,
body.section-app #fg-content-margin,
body.section-app #fg-content-style,
body.section-app #content,
body.section-app .region.region-content,
body.section-app #block-system-main,
body.section-app article.node,
body.section-app .node-inner,
body.section-app .node-content,
body.section-app .field,
body.section-app .field-items,
body.section-app .field-item {
  margin-left: 0 !important;
  margin-right: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  max-width: none !important;
  width: 100% !important;
  box-sizing: border-box;
}

/* AT wrappers are a major source of mystery padding */
body.section-app .content-margin,
body.section-app .content-style,
body.section-app .content-inner {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}

body.section-app .container,
body.section-app .container-inner,
body.section-app #content-wrapper .container {
  margin: 0 !important;
  max-width: none !important;
  width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Restore padding only on explicit app components */
body.section-app .app-map,
body.section-app .app-launcher,
body.section-app .app-section {
  padding-left: 12px;
  padding-right: 12px;
}

/* Edge-to-edge exceptions */
body.section-app .app-map-image,
body.section-app .festival-map-wrap,
body.section-app .festival-map-img {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* =========================================================
 * APP LAUNCHER PAGE (body.page-app)
 * ========================================================= */

body.page-app .app-launcher {
  padding: 20px 16px;
  text-align: center;
}

.app-status h2 { margin: 0; font-size: 1.4em; }

.app-status p {
  margin: 4px 0 20px;
  font-size: 0.9em;
  opacity: 0.8;
}

/* Button grid */
.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.app-button {
  display: block;
  padding: 18px 10px;
  background: #f4ecd8;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
  font-size: 1.1em;
  transition: transform 0.1s ease;
}

.app-button span {
  display: block;
  font-size: 1.8em;
  margin-bottom: 6px;
}

.app-button:active { transform: scale(0.97); }

body.page-app .region-tertiary-content {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #e8dcc3;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.15);
  padding: 10px 0;
}

.app-bottom-nav {
  display: flex;
  justify-content: space-around;
}

.app-bottom-nav a { text-decoration: none; font-size: 0.9em; }

body.page-app #page { padding-bottom: 60px; }

/* =========================================================
 * APP MAP (fast static version) — body.page-app .app-map
 * ========================================================= */

.app-map { padding: 18px 16px; }

.app-map-top h2 { margin: 0 0 10px; font-size: 1.5em; }

.app-map-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.app-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 14px 10px;
  border-radius: 12px;
  background: #f4ecd8;
  box-shadow: 0 3px 6px rgba(0,0,0,0.12);
  font-weight: 800;
}

.app-btn.primary { background: #e8dcc3; }

.app-hint { margin: 6px 0 0; font-size: 0.95em; opacity: 0.85; }

.app-map-quick { margin-top: 18px; }

.app-map-image {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.app-map-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(244,236,216,0.95);
  box-shadow: 0 2px 5px rgba(0,0,0,0.10);
  font-weight: 800;
  font-size: 0.95em;
}

.app-note { margin: 10px 0 0; font-size: 0.9em; opacity: 0.8; }

.area {
  margin-top: 14px;
  padding: 14px 12px;
  background: rgba(244,236,216,0.75);
  border-radius: 12px;
}
.area h4 { margin: 0 0 6px; }
.area p  { margin: 0 0 6px; }

/* =========================================================
 * APP MAP LIVE (interactive) — .app-map-live
 * ========================================================= */

body.page-app .app-map-live { padding: 0; }

.fg-map-topbar {
  position: sticky;
  top: 0;
  z-index: 9999;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #e8dcc3;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.fg-back { text-decoration: none; font-weight: 900; }

.fg-map-actions { display: flex; gap: 8px; align-items: center; }

.fg-zoom {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f4ecd8;
  font-weight: 900;
  cursor: pointer;
}

.fg-filter-panel {
  padding: 12px;
  background: rgba(244,236,216,0.95);
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.fg-own-row { display: inline-block; margin-right: 12px; }
.fg-filter-quicklinks a { text-decoration: none; font-weight: 900; }