/**
 * XPS Skiftplan - Web-specific Styles
 * Additional styles for improved web experience
 */

/* Full-screen layout adjustments */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: auto;
  background-color: #0f172a;
}

#root {
  width: 100% !important;
  min-height: 100%;
  max-width: none !important;
  display: flex;
  flex-direction: column;
  background: #0f172a;
}

/* Force fullscreen on all React Native Web containers */
#root > div,
#root > div > div {
  width: 100% !important;
  max-width: none !important;
}

/* Fullscreen on all screen sizes */
@media (min-width: 1px) {
  #root {
    max-width: none !important;
    width: 100% !important;
  }
  
  #root > div {
    max-width: none !important;
    width: 100% !important;
  }
}

/* Scrollbar styling for WebKit browsers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #1e1e2e;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #3a3a4a;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #4a4a5a;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #3a3a4a #1e1e2e;
}

/* Better touch targets for web */
button,
a,
[role="button"] {
  min-height: 44px;
  min-width: 44px;
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Hide native elements that don't work well on web */
input[type="file"] {
  cursor: pointer;
}

/* Loading states */
.loading,
[data-loading="true"] {
  pointer-events: none;
  opacity: 0.6;
  cursor: wait;
}

/* Modal backdrop blur (for modern browsers) */
/* NOTE: backdrop-filter commented out - may cause screenshot issues on mobile Chrome */
[data-modal-backdrop] {
  /* backdrop-filter: blur(8px); */
  /* -webkit-backdrop-filter: blur(8px); */
  background-color: rgba(0, 0, 0, 0.7);
}

/* Print styles */
@media print {
  /* Hide navigation and non-essential elements when printing */
  nav,
  [role="navigation"],
  .tab-bar,
  button:not(.print-button) {
    display: none !important;
  }

  /* Ensure content is visible */
  body {
    background: white;
    color: black;
  }

  /* Page breaks */
  .page-break {
    page-break-after: always;
  }
}

/* Accessibility: Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  * {
    border-width: 2px !important;
  }

  button,
  a {
    text-decoration: underline;
  }
}

/* Dark mode (system preference) */
@media (prefers-color-scheme: dark) {
  /* The app handles its own theming, but this ensures
     browser UI elements respect dark mode */
  :root {
    color-scheme: dark;
  }
}

/* Better image rendering */
img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Fix for React Native Web text selection issues */
[data-focusable="true"] {
  -webkit-user-select: text;
  user-select: text;
}

/* Ensure proper stacking context for modals */
[role="dialog"],
[role="alertdialog"] {
  z-index: 1000;
}

/* Loading skeleton animations */
@keyframes skeleton-loading {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #1e1e2e 0px, #2e2e3e 40px, #1e1e2e 80px);
  background-size: 200px 100%;
  animation: skeleton-loading 1.5s infinite;
}

/* Improved focus indicators for keyboard navigation */
*:focus-visible {
  outline: 3px solid #6366f1;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Remove focus outline for mouse users */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Better button states */
button:active {
  transform: scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Improve clickable area for small elements */
.clickable::before {
  content: '';
  position: absolute;
  top: -8px;
  right: -8px;
  bottom: -8px;
  left: -8px;
}

/* Responsive typography */
@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 1024px) {
  html {
    font-size: 16px;
  }
}

@media (min-width: 1440px) {
  html {
    font-size: 18px;
  }
}

/* Grid layout for desktop */
@media (min-width: 1024px) {
  .desktop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
  }
}

/* Improved tooltip styling */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-size: 0.875rem;
  white-space: nowrap;
  border-radius: 4px;
  z-index: 1000;
  pointer-events: none;
}

/* Styling for the install prompt */
.install-prompt {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  gap: 1rem; /* Adds spacing between elements */
}

.install-prompt button {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  background-color: #6366f1;
  color: white;
  cursor: pointer;
}

.install-prompt button:hover {
  background-color: #4f46e5;
}

.install-prompt button:active {
  transform: scale(0.98);
}

/* Header install button is now created dynamically via JavaScript */

/* Loading logo and text styles for desktop */
@media (min-width: 1024px) {
  .loading-logo {
    width: 150px;
    height: 150px;
    font-size: 48px;
  }

  .loading-text {
    font-size: 24px;
  }
}
