/**
 * White Screen Error Fallback Styles
 * Mobile-First Design with Social Sport Athlete Theme
 *
 * This file provides styles for the error screen shown when the app
 * fails to load properly, particularly in problematic in-app browsers
 * like Instagram, Facebook, TikTok, and LinkedIn.
 *
 * Brand Colors:
 * - Primary/Tertiary: #5260ff (Social Sport Blue)
 * - Social Green: #69bb7b
 * - Background: #f8f8f8
 */

/* ========================================================================
   Base Container - Mobile First
   ======================================================================== */

#white-screen-error {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  min-height: -webkit-fill-available;
  background: white;
  z-index: 99999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: white;
  padding: 1rem;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#white-screen-error.show {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Safe area for notched devices (iPhone X+, etc) */
@supports (padding: max(0px)) {
  #white-screen-error {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-top: max(1rem, env(safe-area-inset-top));
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

/* ========================================================================
   Error Container
   ======================================================================== */

.error-container {
  width: 100%;
  max-width: 28rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 1.5rem;
  padding: 2rem 1.5rem;
  margin: auto;
  color: #222428;
}

/* Tablet and larger */
@media (min-width: 768px) {
  .error-container {
    padding: 2.5rem 2rem;
  }
}

/* ========================================================================
   Logo
   ======================================================================== */

.error-logo {
  width: 180px;
  max-width: 60%;
  height: auto;
  margin: 0 auto 1.5rem;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
}

/* ========================================================================
   Error Icon
   ======================================================================== */

.error-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: pulse 2s ease-in-out infinite;
  line-height: 1;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.85;
  }
}

/* ========================================================================
   Error Content
   ======================================================================== */

.error-title {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.02em;
  color: #222428;
}

.error-message {
  font-size: clamp(0.9375rem, 3vw, 1rem);
  margin: 0 0 1.5rem 0;
  opacity: 0.85;
  line-height: 1.6;
  color: #222428;
}

/* ========================================================================
   Browser Advice Box - Animated Call-to-Action
   ======================================================================== */

.browser-advice-box {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: linear-gradient(135deg, #dee2f7 0%, #f8f8f8 100%);
  border-radius: 1rem;
  border-left: 0.25rem solid #5260ff;
  box-shadow: 0 4px 12px rgba(82, 96, 255, 0.15);
  text-align: left;
}

.advice-title {
  margin: 0 0 0.75rem 0;
  font-weight: 700;
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #5260ff;
}

.advice-content {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #222428;
}

.advice-content strong {
  display: block;
  margin-top: 0.75rem;
  margin-bottom: 0.375rem;
  font-weight: 600;
  color: #5260ff;
}

.advice-steps {
  margin: 0.75rem 0 0 0;
  padding-left: 0;
  list-style: none;
}

.advice-steps li {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.875rem;
  color: #222428;
}

.advice-steps li:before {
  content: "→";
  position: absolute;
  left: 0;
  font-weight: bold;
  color: #5260ff;
}

/* ========================================================================
   Action Buttons - Mobile First
   ======================================================================== */

.error-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.error-button {
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.error-button:active {
  transform: scale(0.98);
}

/* Primary Button - Social Sport Blue */
.error-button.primary {
  background: #5260ff;
  color: white;
  box-shadow: 0 0.25rem 1rem rgba(82, 96, 255, 0.3);
}

/* Hover effect only on devices that support hover */
@media (hover: hover) {
  .error-button.primary:hover {
    transform: translateY(-0.125rem);
    box-shadow: 0 0.5rem 1.5rem rgba(82, 96, 255, 0.4);
    background: #6370ff;
  }
}

/* Secondary Button - Social Green */
.error-button.secondary {
  background: #69bb7b;
  color: white;
  border: 0.125rem solid #69bb7b;
}

@media (hover: hover) {
  .error-button.secondary:hover {
    background: #78c288;
    border-color: #78c288;
  }
}

/* Tertiary Button - Outline */
.error-button.tertiary {
  background: transparent;
  color: #5260ff;
  border: 0.125rem solid #5260ff;
}

@media (hover: hover) {
  .error-button.tertiary:hover {
    background: rgba(82, 96, 255, 0.1);
  }
}

/* ========================================================================
   Error Details (Technical Info)
   ======================================================================== */

.error-details {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f8f8f8;
  border-radius: 0.75rem;
  border: 1px solid #dee2f7;
  font-size: 0.75rem;
  font-family: 'Courier New', Courier, monospace;
  text-align: left;
  word-break: break-word;
  max-height: 10rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  color: #222428;
}

/* ========================================================================
   Loading Spinner
   ======================================================================== */

.loading-spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 0.1875rem solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
