/* SPA App Shell Architecture for Bemotion PWA */

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* CSS Custom Properties for consistent theming */
:root {
  --primary-color: #00b894;
  --primary-dark: #00a085;
  --secondary-color: #667eea;
  --text-primary: #2c3e50;
  --text-secondary: #636e72;
  --background-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-background: rgba(255, 255, 255, 0.95);
  --border-radius: 20px;
  --shadow-light: 0 10px 30px rgba(0, 0, 0, 0.1);
  --shadow-heavy: 0 25px 50px rgba(0, 0, 0, 0.15);
  --transition-smooth: all 0.3s ease;
}

/* App Shell Pattern */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--background-gradient);
}

/* Login Page Container - Separate from SPA */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 10;
}

/* SPA Content Container - Clean approach */
.spa-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--background-gradient);
  z-index: 10;
  scroll-behavior: smooth;
}

.spa-container.active {
  display: flex !important;
  flex-direction: column;
}

/* Page wrapper for all SPA pages */
.page-wrapper {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  animation: fadeIn 0.3s ease-in-out;
}

/* Page containers */
.page-container {
  background: var(--card-background);
  backdrop-filter: blur(10px);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-heavy);
  overflow: hidden;
  min-height: 95vh;
  width: 100%;
}

/* Common page header */
.page-header {
  background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
  color: white;
  padding: 20px 30px;
  text-align: center;
}

.page-header .logo {
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 10px;
}

.page-header .subtitle {
  font-size: 18px;
  opacity: 0.9;
}

/* Page content area */
.page-content {
  padding: 40px;
  flex: 1;
}

/* Loading states */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--background-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* PWA specific styles */
@media (display-mode: standalone) {
  .spa-container {
    padding-top: env(safe-area-inset-top);
  }
  
  .page-wrapper {
    padding-top: calc(20px + env(safe-area-inset-top));
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .page-wrapper {
    padding: 15px;
  }
  
  .page-content {
    padding: 20px;
  }
  
  .page-header {
    padding: 15px 20px;
  }
  
  .page-header .logo {
    font-size: 24px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .spa-container {
    background: white;
  }
  
  .page-container {
    box-shadow: none;
    border: 1px solid #ccc;
  }
  
  .page-header {
    background: #f0f0f0 !important;
    color: black !important;
  }
}

/* Error states */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  color: white;
}

.error-title {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.error-message {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.error-button {
  padding: 12px 24px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 16px;
  transition: var(--transition-smooth);
}

.error-button:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}