/* ============================================================
   PWA Theme Test Styles
   ============================================================ */

/* === CSS Custom Properties === */
:root {
  --app-max-width: 430px;
  --header-height: 56px;
  --bottom-nav-height: 60px;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

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

/* === BASE === */
/* html bg = viewport canvas (fills entire screen, including outside app frame on desktop) */
html {
  height: 100%;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #333;
  background-color: #2196F3; /* Will be overridden by config.js */
}

/* body = app frame (centered, max-width constrained on desktop) */
body {
  height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  margin: 0 auto;
  overscroll-behavior: none;
  background-color: #2196F3; /* Will be overridden by config.js */
  box-shadow: -6px 0 20px rgba(0, 0, 0, 0.08), 6px 0 20px rgba(0, 0, 0, 0.08);
}

/* PWA standalone: use 100vh (includes safe areas with viewport-fit=cover) */
@media all and (display-mode: standalone) {
  html {
    height: 100vh;
    overscroll-behavior: none;
  }
  body {
    min-height: 100vh;
    overscroll-behavior: none;
  }
}

/* Mobile: full width */
@media (max-width: 767px) {
  html, body {
    max-width: 100%;
    width: 100%;
  }
}

/* Desktop/Tablet: constrained width (configurable via --app-max-width) */
@media (min-width: 768px) {
  html, body {
    max-width: var(--app-max-width);
    width: var(--app-max-width);
  }
}

/* === #root === */
#root {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* iPhone 17 Pro / iOS 26 fix */
@media all and (display-mode: standalone) and (max-width: 767px) {
  #root {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }
}

/* === HEADER === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 12px;
  z-index: 100;
  transition: background-color 0.3s ease;
}

.header__hamburger {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  color: inherit;
}

.header__title {
  margin-left: 8px;
  font-size: 17px;
  font-weight: 600;
}

.header__actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.header__btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  color: inherit;
}

/* === SIDE MENU (Drawer) === */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.side-menu {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #fff;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.side-menu.open {
  transform: translateX(0);
}

.side-menu__header {
  padding: 20px 16px 12px;
  font-size: 15px;
  font-weight: 700;
  color: #333;
}

.side-menu__divider {
  height: 1px;
  background: #e0e0e0;
  margin: 8px 0;
}

.side-menu__item {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  font-size: 14px;
}

.side-menu__item:hover {
  background: #f5f5f5;
}

/* === CONTENT === */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-top: calc(var(--header-height) + 16px);
  padding-bottom: calc(var(--bottom-nav-height) + 16px);
  -webkit-overflow-scrolling: touch;
}

/* === BOTTOM NAVIGATION === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  transition: background-color 0.3s ease;
}

/* Safe area in standalone mode */
@media all and (display-mode: standalone) {
  .bottom-nav {
    padding-bottom: calc(8px + var(--safe-area-bottom));
    min-height: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
  }
}

.bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  font-size: 11px;
  color: #666;
  transition: color 0.2s;
}

.bottom-nav__item.active {
  color: #1976d2;
}

.bottom-nav__icon {
  font-size: 20px;
}

/* === Safe Area Support (Notch/Dynamic Island) === */
@supports (padding-top: env(safe-area-inset-top)) {
  .header {
    padding-top: var(--safe-area-top);
    height: calc(var(--header-height) + var(--safe-area-top));
  }
  .content {
    padding-top: calc(var(--header-height) + var(--safe-area-top) + 16px);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 16px);
  }
}

/* === Desktop: constrain fixed elements to app frame === */
@media (min-width: 768px) {
  .header,
  .bottom-nav {
    max-width: var(--app-max-width);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: var(--app-max-width);
  }
}

/* === SCENARIO CARD === */
.scenario-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  color: white;
}

.scenario-card__name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.scenario-card__desc {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.4;
}

/* === PLATFORM PANEL === */
.platform-panel {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.platform-panel__title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.platform-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.platform-row:last-child {
  border-bottom: none;
}

.platform-icon {
  font-size: 20px;
  min-width: 28px;
  text-align: center;
}

.platform-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.platform-detail {
  font-size: 11px;
  color: #666;
  line-height: 1.4;
}

/* === STATUS PANEL === */
.status-panel {
  background: #e8f5e9;
  border: 1px solid #4caf50;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.status-panel__title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  gap: 8px;
}

.status-row .label {
  color: #555;
  white-space: nowrap;
}

.status-row .value {
  font-family: 'SF Mono', Monaco, monospace;
  font-weight: 600;
  text-align: right;
}

/* === STRUCTURE PANEL === */
.structure-panel {
  background: #e3f2fd;
  border: 1px solid #1976d2;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.structure-panel__title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
}

.structure-panel pre {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
}

/* === INFO PANEL === */
.info-panel {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  font-size: 12px;
  line-height: 1.6;
}

.info-panel__title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
}

.info-panel p {
  margin-bottom: 6px;
}

/* === FILLER CARDS === */
.filler-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.filler-card__title {
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 14px;
}

.filler-card__text {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
}
