/* NPN Solar Mobile Mode v1 */

:root {
  --npn-mobile-safe-top: env(safe-area-inset-top, 0px);
  --npn-mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
}

#npn-solar-mobile-bar,
#npn-solar-mobile-top {
  display: none;
}

@media (max-width: 920px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  body {
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
  }

  body.npn-solar-mobile-mode {
    padding-bottom: calc(74px + var(--npn-mobile-safe-bottom)) !important;
  }

  body.npn-solar-mobile-mode * {
    box-sizing: border-box;
  }

  #npn-solar-mobile-top {
    position: sticky;
    top: 0;
    z-index: 2147481800;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: calc(54px + var(--npn-mobile-safe-top));
    padding: calc(8px + var(--npn-mobile-safe-top)) 12px 8px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    background:
      radial-gradient(circle at 10% 0%, rgba(255,201,74,.14), transparent 12rem),
      rgba(4, 11, 19, .94);
    color: #f4f8ff;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0,0,0,.28);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  #npn-solar-mobile-top .npn-solar-mobile-title {
    min-width: 0;
  }

  #npn-solar-mobile-top b {
    display: block;
    font-size: 14px;
    line-height: 1.05;
    font-weight: 950;
    letter-spacing: -.02em;
  }

  #npn-solar-mobile-top span {
    display: block;
    margin-top: 2px;
    color: rgba(244,248,255,.62);
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #npn-solar-mobile-top button,
  #npn-solar-mobile-bar button {
    appearance: none;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    color: #f4f8ff;
    min-height: 36px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
  }

  #npn-solar-mobile-bar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + var(--npn-mobile-safe-bottom));
    z-index: 2147481800;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 22px;
    background: rgba(4, 11, 19, .93);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 45px rgba(0,0,0,.40);
  }

  #npn-solar-mobile-bar button {
    min-width: 0;
    min-height: 42px;
    padding: 0 6px;
    border-radius: 16px;
    font-size: 11px;
    line-height: 1.05;
  }

  #npn-solar-mobile-bar button.npn-solar-mobile-active {
    border-color: rgba(255,201,74,.55);
    background: rgba(255,201,74,.16);
    color: #fff;
  }

  main,
  .main,
  #main,
  .page,
  .page-shell,
  .dashboard,
  .dashboard-shell,
  .solar-dashboard,
  .solar-shell,
  .content,
  .container,
  .wrap,
  .wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  main,
  .main,
  #main,
  .page,
  .page-shell,
  .dashboard,
  .dashboard-shell,
  .solar-dashboard,
  .solar-shell,
  .content,
  .container {
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  .grid,
  .cards,
  .card-grid,
  .dashboard-grid,
  .solar-grid,
  .stats-grid,
  .metric-grid,
  .ops-grid,
  .forecast-grid,
  .source-grid,
  .helioviewer-grid,
  .sw-grid,
  .kp-grid,
  .npn-grid,
  [class*="grid"] {
    grid-template-columns: 1fr !important;
    max-width: 100% !important;
  }

  .card,
  .panel,
  .tile,
  .widget,
  .metric,
  .source-card,
  .forecast-card,
  .solar-card,
  .ops-card,
  .npn-card,
  [class*="card"],
  [class*="panel"],
  [class*="tile"] {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .row,
  .toolbar,
  .actions,
  .button-row,
  .hero,
  .header,
  .page-header,
  .dashboard-header,
  .solar-header,
  .panel-header,
  .card-header,
  [class*="header"],
  [class*="toolbar"],
  [class*="actions"] {
    flex-wrap: wrap !important;
    max-width: 100% !important;
  }

  table {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    white-space: nowrap;
  }

  pre,
  code {
    max-width: 100% !important;
    overflow-x: auto !important;
    white-space: pre-wrap;
    word-break: break-word;
  }

  iframe,
  canvas,
  svg,
  img,
  video {
    max-width: 100% !important;
  }

  .helioviewer,
  .helioviewer-wrap,
  .solar-image,
  .solar-map,
  .sun-map,
  [class*="helioviewer"],
  [class*="solar-image"],
  [class*="sun-map"] {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 260px;
  }

  h1 {
    font-size: clamp(22px, 7vw, 34px) !important;
    line-height: 1.05 !important;
  }

  h2 {
    font-size: clamp(18px, 5.6vw, 26px) !important;
    line-height: 1.1 !important;
  }

  h3 {
    font-size: clamp(15px, 4.6vw, 21px) !important;
  }

  p,
  li,
  td,
  th {
    font-size: 14px;
  }

  button,
  a.button,
  .button,
  input,
  select {
    min-height: 38px;
  }
}

@media (max-width: 520px) {
  #npn-solar-mobile-bar {
    left: 8px;
    right: 8px;
    gap: 5px;
    padding: 7px;
  }

  #npn-solar-mobile-bar button {
    font-size: 10px;
    min-height: 40px;
    padding: 0 4px;
  }

  main,
  .main,
  #main,
  .page,
  .page-shell,
  .dashboard,
  .dashboard-shell,
  .solar-dashboard,
  .solar-shell,
  .content,
  .container {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .card,
  .panel,
  .tile,
  .widget,
  .metric,
  .source-card,
  .forecast-card,
  .solar-card,
  .ops-card,
  .npn-card,
  [class*="card"],
  [class*="panel"],
  [class*="tile"] {
    border-radius: 16px !important;
  }
}
