/**
 * 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?v=20260721radar1');

/* ── 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;
}

/* Phone nav: icon-only view + theme toggles (labels waste scarce width) */
html[data-view-mode="phone"] fdc-nav .fdc-view-label,
html[data-view-mode="phone"] fdc-nav .nav-theme-label,
html[data-view-mode="phone"] #login-site-nav .fdc-view-label,
html[data-view-mode="phone"] #login-site-nav .lsn-theme-label,
html[data-view-mode="phone"] #fdc-public-view-mount .fdc-view-label,
html[data-view-mode="phone"] #fdc-lsn-view-mount .fdc-view-label {
  display: none !important;
}

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

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

/* Access / Admin|Viewer: compact segment, not a padded card */
html[data-view-mode="phone"] .dash-role,
html[data-view-mode="phone"] .sh-role,
html[data-view-mode="phone"] .iam-role-bar {
  gap: 4px !important;
  padding: 2px 4px !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  flex-wrap: nowrap !important;
}
html[data-view-mode="phone"] .dash-role .hero-ctl-label,
html[data-view-mode="phone"] .sh-role .hero-ctl-label,
html[data-view-mode="phone"] .fdc-role-toggle-wrap .hero-ctl-label {
  display: none !important;
}
html[data-view-mode="phone"] .fdc-access-badge {
  min-width: 0 !important;
  padding: 2px 6px !important;
  font-size: 0.58rem !important;
}
html[data-view-mode="phone"] .fdc-role-seg button,
html[data-view-mode="phone"] .dash-seg.fdc-role-seg button {
  min-width: 0 !important;
  min-height: 1.7rem !important;
  padding: 2px 7px !important;
  font-size: 0.58rem !important;
}

/* Dashboard / grids: force single column in phone mode (media queries miss desktop phone-preview) */
html[data-view-mode="phone"] .grid-sidebar,
html[data-view-mode="phone"] .grid-sidebar.grid-sidebar-split {
  grid-template-columns: 1fr !important;
  grid-template-rows: none !important;
}
html[data-view-mode="phone"] .grid-sidebar-split [data-card-id="dash-news"],
html[data-view-mode="phone"] .grid-sidebar-split [data-card-id="dash-goals"],
html[data-view-mode="phone"] .grid-sidebar-split [data-card-id="dash-growth"],
html[data-view-mode="phone"] .grid-sidebar-split [data-card-id="dash-temp-viewers"],
html[data-view-mode="phone"] .grid-sidebar-split .dash-slot-narrow,
html[data-view-mode="phone"] .grid-sidebar .card.dash-slot-wide,
html[data-view-mode="phone"] .grid-sidebar .card.dash-slot-narrow {
  grid-column: 1 / -1 !important;
  grid-row: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}
html[data-view-mode="phone"] .sortable-cards.grid-6,
html[data-view-mode="phone"] .sortable-cards.grid-5,
html[data-view-mode="phone"] .sortable-cards.grid-4,
html[data-view-mode="phone"] .sortable-cards.grid-3,
html[data-view-mode="phone"] .grid-6,
html[data-view-mode="phone"] .grid-5,
html[data-view-mode="phone"] .grid-4,
html[data-view-mode="phone"] .grid-3,
html[data-view-mode="phone"] .grid-2 {
  grid-template-columns: 1fr !important;
}
html[data-view-mode="phone"] .dash-item,
html[data-view-mode="phone"] .goal-item,
html[data-view-mode="phone"] .news-item {
  flex-wrap: wrap !important;
  min-width: 0 !important;
}
html[data-view-mode="phone"] .dash-item .title,
html[data-view-mode="phone"] .goal-item .title,
html[data-view-mode="phone"] #dash-goals-list .goal-title {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}
html[data-view-mode="phone"] table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Research / yield / AI compute */
html[data-view-mode="phone"] .rm-section-combined-grid,
html[data-view-mode="phone"] .rm-pair-grid,
html[data-view-mode="phone"] .rm-earn-table-wrap,
html[data-view-mode="phone"] .ai-pair-grid {
  grid-template-columns: 1fr !important;
}
html[data-view-mode="phone"] .rm-earn-table,
html[data-view-mode="phone"] .tbl-wrap,
html[data-view-mode="phone"] .table-wrapper {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Site monitoring weather */
html[data-view-mode="phone"] .sm-weather-split,
html[data-view-mode="phone"] #monitoring-card-grid [data-card-id="card-fleet-weather"] .sm-weather-split {
  grid-template-columns: 1fr !important;
}
html[data-view-mode="phone"] .sm-wx-pred-slots {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  overflow: visible !important;
  min-height: 0 !important;
}
html[data-view-mode="phone"] .sm-wx-pred-slots > * {
  position: relative !important;
  min-height: auto !important;
  overflow: visible !important;
}

/* Equinox / PDU */
html[data-view-mode="phone"] #eq-card-grid,
html[data-view-mode="phone"] .eq-solar-split,
html[data-view-mode="phone"] .pdu-outlet-grid {
  grid-template-columns: 1fr !important;
}
html[data-view-mode="phone"] .pdu-outlet,
html[data-view-mode="phone"] .pdu-outlet .name,
html[data-view-mode="phone"] .pdu-outlet .meta {
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  white-space: normal !important;
}
html[data-view-mode="phone"] .eq-chart-stage {
  min-height: 220px;
  overflow: hidden;
}
