/**
 * Level Up Members - Main Stylesheet
 * Common styles for all pages
 */

/* ===== CSS Reset & Base Styles ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  color: #333;
}

/* ===== Header & Navigation ===== */
.header {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  transition: opacity 0.3s;
}

.logo:hover {
  opacity: 0.8;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  color: white;
  text-decoration: none;
  opacity: 0.9;
  transition: opacity 0.3s;
  font-weight: 500;
}

.nav-links a:hover {
  opacity: 1;
}

.nav-links a.active {
  opacity: 1;
  border-bottom: 2px solid white;
}

.nav-links a.logout-link {
  color: #ffd6d6;
}

.nav-links a.btn-nav {
  background: white;
  color: #667eea;
  padding: 0.5rem 1.5rem;
  border-radius: 6px;
  opacity: 1;
}

.nav-links a.btn-nav:hover {
  background: rgba(255, 255, 255, 0.9);
}

/* ===== Main Content Container ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.container {
  background: white;
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 100%;
  text-align: center;
}

.wide-container {
  max-width: 1200px;
}

/* ===== Typography ===== */
.page-title {
  color: white;
  font-size: 2rem;
  margin-bottom: 2rem;
  text-align: center;
}

h1, h2, h3, h4, h5, h6 {
  margin-bottom: 1rem;
  color: #333;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* ===== Buttons ===== */
.btn,
.button,
button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.btn:hover,
.button:hover,
button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn.secondary,
button.secondary {
  background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
}

.btn.logout,
button.logout {
  background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
}

.buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

/* ===== Loading State ===== */
.loading-container {
  background: white;
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  max-width: 500px;
  width: 100%;
}

.loading-spinner,
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  color: #333;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.loading-subtext {
  color: #666;
  font-size: 0.9rem;
}

/* ===== Error States ===== */
.error-container,
.error-box {
  background: white;
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  max-width: 500px;
  width: 100%;
  display: none;
}

.error-box {
  background: rgba(220, 53, 69, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.8);
  display: block;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.error-title {
  color: #e53e3e;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.error-message {
  color: #666;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.error {
  background: #fee;
  border: 1px solid #fcc;
  color: #c33;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

/* ===== Visibility Utilities ===== */
.hidden {
  display: none !important;
}

.show {
  display: block !important;
}

/* ===== User Info Display ===== */
.user-info {
  background: #f7fafc;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  text-align: left;
}

.user-info p {
  margin-bottom: 0.5rem;
  color: #4a5568;
}

.user-info strong {
  color: #2d3748;
  display: inline-block;
  min-width: 100px;
}

/* ===== Delphi-specific Styles ===== */
.delphi-container {
  width: 100%;
  max-width: 1200px;
  margin: 2rem auto;
  display: none;
}

#delphi-frame {
  width: 100%;
  min-height: 800px;
  border: none;
}

/* ===== Responsive Design ===== */
@media (max-width: 600px) {
  .header {
    padding: 1rem;
  }

  /* Keep nav-links horizontal but allow wrapping if needed */
  .nav-links {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .nav-links a {
    font-size: 0.9rem;
  }

  .main-content {
    padding: 0.5rem !important;
  }

  .container,
  .loading-container,
  .error-container {
    padding: 2rem 1.5rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .buttons {
    gap: 0.75rem;
  }

  .btn,
  .button,
  button {
    width: 100%;
  }

  #delphi-frame {
    min-height: 600px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.75rem;
  }

  .logo {
    font-size: 1.25rem;
  }

  .nav-links {
    gap: 0.25rem;
    font-size: 0.9rem;
  }

  .page-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
  }

  .container,
  .loading-container,
  .error-container {
    padding: 1.5rem 1rem;
  }
}

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

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
.btn:focus {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}
