/*
MIT License

Copyright (c) 2026 jmfrohs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

:root {
  --color-bg: #f2f2f7;
  --color-bg-gradient: linear-gradient(135deg, #f2f2f7 0%, #ffffff 100%);
  --color-card: #ffffff;
  --color-text: #1c1c1e;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-shadow: rgba(0, 0, 0, 0.1);
  --color-primary-faded: rgba(0, 122, 255, 0.1);
}

.dark {
  --color-bg: #121214;
  --color-bg-gradient: linear-gradient(135deg, #121214 0%, #1c1c1e 100%);
  --color-card: #1c1c1e;
  --color-text: #f8fafc;
  --color-border: rgba(148, 163, 184, 0.15);
  --color-shadow: rgba(0, 0, 0, 0.3);
  --color-primary-faded: rgba(0, 122, 255, 0.2);
  color-scheme: dark;
}

.dark select option {
  background-color: #1c1c1e !important;
  color: #f8fafc !important;
}

html,
body {
  overflow: hidden;
  overscroll-behavior: none;
  height: 100%;
  width: 100%;
}

body {
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
  color: var(--color-text);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
  display: flex;
  justify-content: center;

  align-items: flex-start;
  background: url('../../assets/images/background-image.jpg') center/cover
    no-repeat fixed;
}

#app-container {
  box-sizing: border-box;

  overflow: hidden;
}

body.desktop-mode #app-container.login-shell {
  width: min(100%, 800px) !important;
  max-width: 800px !important;
  height: min(820px, calc(100vh - 72px)) !important;
  margin: 0 auto !important;
}

#app-container .status-bar {
  padding-top: env(safe-area-inset-top, 0px);
}

#app-container > header:first-child,
#desktop-main-content > header:first-child {
  padding-top: max(env(safe-area-inset-top, 0px), 1rem);
}

body:not(.desktop-mode) #app-container {
  max-height: var(--app-height, 100vh);
  max-height: min(var(--app-height, 100vh), 100dvh);
}

#desktop-main-content,
#app-container main,
#app-container header,
#app-container .status-bar {
  min-height: 0;
}

#desktop-main-content {
  overflow: hidden;
}

#bottom-nav {
  flex-shrink: 0;
  z-index: 40;
  padding-top: 0.5rem;
  padding-bottom: max(0.1rem, env(safe-area-inset-bottom, 0.1rem));
}

.mobile-fab {
  position: absolute;
  right: 1.5rem;
  bottom: calc(6.75rem + env(safe-area-inset-bottom, 0px));
  width: 4rem;
  height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: #007aff;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.35);
  z-index: 30;
  transition: transform 0.2s ease;
}

.mobile-fab:active {
  transform: scale(0.9);
}

.ios-blur {
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.glow-blue {
  box-shadow: 0 8px 24px rgba(0, 122, 255, 0.3);
}

.bg-image-credit {
  position: fixed;
  right: 8px;
  bottom: 6px;
  z-index: 1;
  font-size: 10px;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  pointer-events: auto;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.touch-target {
  min-height: 44px;
  min-width: 44px;
}

input,
textarea,
select {
  background-image: none !important;
  appearance: none !important;
  transition:
    border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

select {
  padding-right: 2.5rem !important;
}

input,
textarea,
select {
  color-scheme: light;
  background-color: rgba(0, 0, 0, 0.03) !important;
  color: #1c1c1e !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #007aff !important;
  background-color: rgba(0, 0, 0, 0.01) !important;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15) !important;
  outline: none !important;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
textarea:-webkit-autofill:active,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
select:-webkit-autofill:active {
  -webkit-text-fill-color: #1c1c1e !important;
  -webkit-box-shadow: 0 0 0 50px #f2f2f7 inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.dark input,
.dark textarea,
.dark select {
  color-scheme: dark !important;
  background-color: rgba(255, 255, 255, 0.05) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.dark input:focus,
.dark textarea:focus,
.dark select:focus {
  border-color: #007aff !important;
  background-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.25) !important;
  outline: none !important;
}

.dark select {
  padding-right: 2.5rem !important;
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: rgba(139, 186, 224, 0.4) !important;
}

.dark input:-webkit-autofill,
.dark input:-webkit-autofill:hover,
.dark input:-webkit-autofill:focus,
.dark input:-webkit-autofill:active,
.dark textarea:-webkit-autofill,
.dark textarea:-webkit-autofill:hover,
.dark textarea:-webkit-autofill:focus,
.dark textarea:-webkit-autofill:active,
.dark select:-webkit-autofill,
.dark select:-webkit-autofill:hover,
.dark select:-webkit-autofill:focus,
.dark select:-webkit-autofill:active {
  -webkit-text-fill-color: #f8fafc !important;
  -webkit-box-shadow: 0 0 0 50px #1c1c1e inset !important;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-4px);
  }
  40%,
  80% {
    transform: translateX(4px);
  }
}

.animate-shake {
  animation: shake 0.4s ease-in-out;
}
