/**
 * Global PC / Phone view mode — layout overrides when html[data-view-mode="phone"].
 * Overrides device width so users can preview phone layout on desktop.
 */
@import url('fdc-load-glint.css');

/* ── Toggle (matches nav-theme-toggle / lsn-theme-toggle) ── */
.fdc-view-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.fdc-view-label {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.fdc-view-label em {
  font-style: normal;
  opacity: 0.55;
  margin: 0 0.15em;
}
.fdc-view-track {
  position: relative;
  width: 38px;
  height: 20px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  transition: background 0.3s ease;
  flex-shrink: 0;
}
.fdc-view-track.phone { background: rgba(255, 255, 255, 0.45); }
.fdc-view-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  line-height: 1;
}
.fdc-view-track.phone .fdc-view-thumb { transform: translateX(18px); }
body.light-mode .fdc-view-label { color: rgba(255, 255, 255, 0.92); }

/* Disabled nav targets in Phone mode */
.nav-view-disabled,
a.nav-view-disabled,
.nav-dropdown-menu a.nav-view-disabled {
  opacity: 0.38 !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
  filter: grayscale(0.35);
}

/* ── View-mode transition loader (green bar) ── */
#fdc-view-mode-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 20, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
#fdc-view-mode-loader.active {
  opacity: 1;
  pointer-events: auto;
}
#fdc-view-mode-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}
#fdc-view-mode-loader .fdc-view-load-card {
  width: min(20rem, 88vw);
  padding: 1.35rem 1.25rem 1.1rem;
  border-radius: 14px;
  background: var(--bg-card, rgba(18, 24, 38, 0.96));
  border: 1px solid var(--border-light, rgba(148, 163, 184, 0.2));
  text-align: center;
}
#fdc-view-mode-loader .load-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary, #f1f5f9);
  margin-bottom: 0.65rem;
}
#fdc-view-mode-loader .load-bar-wrap {
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
  margin-bottom: 0.35rem;
}
#fdc-view-mode-loader .load-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3bc382, #4ade80);
  transition: width 0.12s linear;
}
#fdc-view-mode-loader .load-pct {
  font-size: 0.68rem;
  color: var(--text-muted, #94a3b8);
  font-weight: 600;
}
@media (prefers-reduced-motion: reduce) {
  #fdc-view-mode-loader { transition: none; }
  #fdc-view-mode-loader .load-bar-fill { transition: none; }
}

/* ── Phone layout overrides ── */
html[data-view-mode="phone"] {
  -webkit-text-size-adjust: 100%;
}
html[data-view-mode="phone"] body.fdc-page,
html[data-view-mode="phone"] body.fdc-app-page,
html[data-view-mode="phone"] body.fdc-page-solar,
html[data-view-mode="phone"] body.at-login {
  font-size: 15px;
}
html[data-view-mode="phone"] .fdc-page-main,
html[data-view-mode="phone"] .fdc-app-main,
html[data-view-mode="phone"] .fdc-page-inner {
  padding-left: 0.65rem !important;
  padding-right: 0.65rem !important;
}
/* Keep page hero on the same theme as PC — only stack toolbar controls */
html[data-view-mode="phone"] .page-header.ph-hero-wide.hero-with-toolbar,
html[data-view-mode="phone"] .hero-with-toolbar {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.5rem !important;
}
html[data-view-mode="phone"] .hero-toolbar-controls {
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  gap: 0.35rem !important;
}
html[data-view-mode="phone"] .sortable-cards.grid-6,
html[data-view-mode="phone"] .sortable-cards.grid-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
html[data-view-mode="phone"] .scc-grid {
  grid-template-columns: 1fr !important;
}
html[data-view-mode="phone"] .rm-kpi-strip {
  grid-template-columns: 1fr !important;
}
html[data-view-mode="phone"] .rye-split {
  grid-template-columns: 1fr !important;
}
html[data-view-mode="phone"] .btn,
html[data-view-mode="phone"] .nav-link,
html[data-view-mode="phone"] .ftab,
html[data-view-mode="phone"] .dash-seg button {
  min-height: 2.35rem;
}
html[data-view-mode="phone"] .tbl-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
html[data-view-mode="phone"] .login-card {
  width: min(400px, 94vw) !important;
  padding: 2rem 1.35rem !important;
}

/* View toggle in nav — keep PC/Phone label visible in Phone mode (compact) */
html[data-view-mode="phone"] fdc-nav .fdc-view-label {
  font-size: 0.62rem !important;
  max-width: 4.75rem;
  line-height: 1.15;
  white-space: normal;
}

html[data-view-mode="phone"] fdc-nav .fdc-view-toggle {
  gap: 4px !important;
  flex-shrink: 0;
}

/* Keep Light/Dark label visible so phone preview stays on the same nav chrome */
html[data-view-mode="phone"] fdc-nav .nav-theme-label {
  display: inline !important;
  font-size: 0.62rem !important;
}

html[data-view-mode="phone"] fdc-nav .nav-logout {
  padding: 0.25rem 0.55rem !important;
  font-size: 0.72rem !important;
}
