/* ==========================================================================
   PWA WRAPPER STYLES - Premium, Native, Responsive, Safe-Area-Aware
   ========================================================================== */

/* Inter Font Import - Modern, elegant, clean sans-serif */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition-all: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & Native Safe Area Support */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f8fafc; /* Dynamic fallback */
  color: #1e293b;
  
  /* Disable zoom and native scroll bounce for native app feel */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Main Container */
.app-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  position: relative;
  
  /* Safe Area Support */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Splash / Loading Screen UI */
.splash-wrapper {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  max-width: 90%;
  width: 400px;
}

.logo-container {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 28px;
  background: white;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pulseLogo 2.5s ease-in-out infinite;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.app-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

.app-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #0f172a;
  margin-bottom: 12px;
  opacity: 0.9;
}

.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 32px;
}

/* Circular Loader - beautiful, responsive, modern */
.circular-loader {
  width: 40px;
  height: 40px;
  border: 3.5px solid rgba(37, 99, 235, 0.15);
  border-top-color: #2563eb; /* Dynamic fallback */
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

.loading-text {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #64748b;
  animation: pulseText 1.5s ease-in-out infinite;
}

/* Offline Page UI - Professional, High Contrast, Actionable */
.offline-card {
  background: white;
  border-radius: 24px;
  padding: 40px 32px;
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(226, 232, 240, 0.8);
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.offline-icon-container {
  width: 80px;
  height: 80px;
  background-color: #fee2e2;
  color: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.offline-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 12px;
}

.offline-description {
  font-size: 0.95rem;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 32px;
}

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition-all);
  outline: none;
}

.btn-primary {
  background-color: #2563eb; /* Dynamic fallback */
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:active, .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.btn-secondary:active, .btn-secondary:hover {
  background-color: #e2e8f0;
}

/* Toast Notification Styles */
.toast {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: #0f172a;
  color: white;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Animations */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseLogo {
  0%, 100% { transform: scale(1); box-shadow: var(--shadow-lg); }
  50% { transform: scale(1.02); box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08); }
}

@keyframes pulseText {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Responsive Desktop Optimizations */
@media (min-width: 768px) {
  body {
    touch-action: auto;
    overflow-y: auto;
  }
  .app-container {
    padding: 40px;
    background: radial-gradient(circle at top right, #f1f5f9, #f8fafc);
  }
  .offline-card {
    border-radius: 28px;
    padding: 48px;
  }
}
