/* These styles make the body full-height */
html,
body,
#root {
  height: 100%;
}

/* These styles disable body scrolling if you are using <ScrollView> */
body {
  overflow: hidden;
  background-color: #121212;
  margin: 0;
  padding: 0;
}

/* These styles make the root element full-height */
#root {
  max-height: 100vh;
  display: flex;
  flex: 1;
  flex-direction: column;
}

/* Handle safe area in PWA standalone mode */
@supports (padding-top: env(safe-area-inset-top)) {
  html,
  body,
  #root {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* Reset safe area padding for web app */
@media (display-mode: standalone) {
  html,
  body,
  #root {
    padding: 0;
    margin: 0;
  }
}

/* Fix for PWA viewport height issues */
@media (display-mode: standalone), (display-mode: fullscreen) {
  html,
  body {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
    height: 100vh !important;
    height: -webkit-fill-available !important;
    overflow: hidden !important;
  }

  #root {
    height: 100vh !important;
    height: -webkit-fill-available !important;
    max-height: 100vh !important;
    max-height: -webkit-fill-available !important;
    overflow: hidden !important;
  }
}

/* Fix for iOS Safari 100vh issue */
@supports (-webkit-touch-callout: none) {
  html,
  body,
  #root {
    height: -webkit-fill-available;
  }
}

/**
 * Extend the react-native-web reset:
 * https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/StyleSheet/initialRules.js
 */
html,
body,
#root {
  width: 100%;
  /* To smooth any scrolling behavior */
  -webkit-overflow-scrolling: touch;
  margin: 0px;
  padding: 0px;
  /* Allows content to fill the viewport and go beyond the bottom */
  min-height: 100%;
}

#root {
  flex-shrink: 0;
  flex-basis: auto;
  flex-grow: 1;
  display: flex;
  flex: 1;
}

html {
  scroll-behavior: smooth;
  /* Prevent text size change on orientation change https://gist.github.com/tfausak/2222823#file-ios-8-web-app-html-L138 */
  -webkit-text-size-adjust: 100%;
  height: calc(100% + env(safe-area-inset-top));
}

body {
  display: flex;
  /* Allows you to scroll below the viewport; default value is visible */
  overflow-y: auto;
  overscroll-behavior-y: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -ms-overflow-style: scrollbar;
}

/* Enable for apps that support dark-theme */
@media (prefers-color-scheme: dark) {
  body {
    background-color: black;
  }
}

/* Global scrollbar styling - super thin, visible only during scrolling */
::-webkit-scrollbar {
  width: 2px;
  height: 2px;
}

::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 1px;
}

::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 1px;
  transition:
    background 0.15s ease,
    opacity 0.15s ease;
  opacity: 0;
}

/* Show scrollbar only during actual scrolling - use surfaceVariant color like GoalCard */
*:hover::-webkit-scrollbar-thumb,
*:active::-webkit-scrollbar-thumb {
  background: #49454f;
  opacity: 0.6;
}

*:hover::-webkit-scrollbar-thumb:hover {
  background: #49454f;
  opacity: 0.8;
}

/* Dark theme uses surfaceVariant color */
@media (prefers-color-scheme: dark) {
  *:hover::-webkit-scrollbar-thumb,
  *:active::-webkit-scrollbar-thumb {
    background: #49454f;
    opacity: 0.4;
  }

  *:hover::-webkit-scrollbar-thumb:hover {
    background: #49454f;
    opacity: 0.6;
  }
}

/* Firefox support - super thin */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}

*:hover,
*:active {
  scrollbar-color: #49454f transparent;
}

@media (prefers-color-scheme: dark) {
  *:hover,
  *:active {
    scrollbar-color: #49454f transparent;
  }
}

#splash-screen {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: #121212;
  background-image: url('./splash.png');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.3s ease;
}

#splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

#notice-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10000;
  background-color: rgba(0, 0, 0, 0.8);
  padding: 20px;
  border-radius: 10px;
  display: none;
}

#notice-container p {
  color: white;
  font-size: 24px;
  margin-bottom: 10px;
  font-family: sans-serif;
}

#reload-button {
  background-color: transparent;
  color: white;
  padding: 20px;
  font-size: 24px;
  border: none;
  cursor: pointer;
}

#reload-button img {
  width: 100px;
  height: 100px;
  vertical-align: middle;
}
