/* Fullscreen web app styles */

/* Ensure app takes full viewport */
html {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Safe area support for notched devices */
body {
  padding-top: max(0px, env(safe-area-inset-top));
  padding-bottom: max(0px, env(safe-area-inset-bottom));
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
}

/* Prevent pinch zoom on iOS */
html {
  touch-action: manipulation;
}

/* Keep all interface text selectable and copyable. */
body {
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  user-select: text;
}

/* Allow text selection in input fields and contenteditable */
input,
textarea,
[contenteditable],
select {
  -webkit-user-select: text;
  user-select: text;
}

/* Prevent rubber band scroll on iOS */
body {
  overscroll-behavior-y: contain;
}

/* Ensure proper display mode detection */
@supports (display: standalone) {
  body {
    /* Styles applied when app is in standalone mode */
  }
}

/* Status bar color configuration for Android */
@media (prefers-color-scheme: dark) {
  meta[name="theme-color"] {
    content: "#1a0b3a";
  }
}

@media (prefers-color-scheme: light) {
  meta[name="theme-color"] {
    content: "#f5f3ff";
  }
}

/* Fullscreen viewport adjustments for mobile */
@media (max-width: 768px) {
  body {
    /* Adjust for status bar on mobile */
    padding-top: calc(max(0px, env(safe-area-inset-top)) + 2px);
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) {
  body {
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* Text selection is an interface-wide guarantee, including mobile callouts. */
*,
*::before,
*::after {
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  user-select: text;
}

/* Table data cells (and contents) stay selectable for copy */
table td,
table td * {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

button,
a,
input,
textarea,
[role="button"],
.decision-card,
.decision-value,
.decision-label,
.decision-explanation,
.dashboard-notes,
.recommendation-pill,
.tip-check-card,
.tip-error {
  -webkit-user-select: text;
  user-select: text;
}

/*
 * Page-level styles historically disabled selection on sortable headings,
 * navigation labels, and draggable rows. Override those rules so every piece
 * of visible interface text can be copied. Resize handles contain no text and
 * remain non-selectable to preserve column resizing.
 */
body *:not(.col-resize-handle),
body *:not(.col-resize-handle)::before,
body *:not(.col-resize-handle)::after {
  -webkit-user-select: text !important;
  -webkit-touch-callout: default !important;
  user-select: text !important;
}

.col-resize-handle {
  -webkit-user-select: none !important;
  user-select: none !important;
}
