* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* Navigation */
.navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: #667eea;
}

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

.nav-link {
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-link:hover {
  color: #667eea;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* Pages */
.page {
  animation: fadeIn 0.3s ease-in;
}

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

/* Auth Container */
.auth-container {
  max-width: 450px;
  margin: 3rem auto;
  background: white;
  border-radius: 16px;
  padding: 3rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 2rem;
  color: #333;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #f5f5f5;
  color: #333;
}

.btn-secondary:hover {
  background: #e0e0e0;
}

.btn-outline {
  background: transparent;
  border: 2px solid #667eea;
  color: #667eea;
}

.btn-outline:hover {
  background: #667eea;
  color: white;
}

.btn-google {
  background: white;
  color: #333;
  border: 2px solid #e0e0e0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-google:hover {
  border-color: #667eea;
  background: #f8f9ff;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

.auth-divider {
  text-align: center;
  margin: 1.5rem 0;
  color: #999;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #e0e0e0;
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  color: #666;
}

.auth-footer a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4rem 0;
  margin-bottom: 2rem;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  opacity: 0.3;
}

.hero-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.3rem;
  margin-bottom: 2rem;
  opacity: 0.9;
  line-height: 1.5;
}

.hero-features {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-feature {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.feature-icon {
  font-size: 1.2rem;
}

.hero-visual {
  display: flex;
  justify-content: center;
  align-items: center;
}

.math-preview {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.preview-problem {
  margin-bottom: 1.5rem;
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
}

.preview-problem:last-child {
  margin-bottom: 0;
}

.problem-line {
  text-align: right;
  padding: 0.2rem 0;
}

.problem-underline {
  border-bottom: 2px solid white;
  margin-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* Main Content */
.main-content {
  background: white;
  border-radius: 16px;
  padding: 3rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  margin-bottom: 2rem;
}

.main-content h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: #333;
}

.subtitle {
  color: #666;
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

/* Section Titles */
.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #333;
  text-align: center;
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: 1.2rem;
  color: #666;
  text-align: center;
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Subscription Banner */
.subscription-banner {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 2rem;
  font-weight: 500;
}

.subscription-banner.free-trial {
  background: #fff3cd;
  border: 2px solid #ffc107;
  color: #856404;
}

.subscription-banner.trial-expired {
  background: #f8d7da;
  border: 2px solid #f5c6cb;
  color: #721c24;
}

.subscription-banner.active {
  background: #d4edda;
  border: 2px solid #c3e6cb;
  color: #155724;
}

/* Quick Start Section */
.quick-start-section {
  margin-bottom: 4rem;
}

/* Generator Form */
.generator-form {
  max-width: 1000px;
  margin: 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.form-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 2rem;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
}

.form-card:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.form-header {
  margin-bottom: 1.5rem;
}

.form-header h3 {
  color: #333;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.form-header p {
  color: #666;
  font-size: 0.95rem;
  margin: 0;
}

.form-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e0e0e0;
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section h3 {
  margin-bottom: 1rem;
  color: #667eea;
}

.operation-select {
  font-size: 1.1rem;
  padding: 1rem;
}

.generate-section {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, #f8f9ff 0%, #e8f2ff 100%);
  border-radius: 16px;
  border: 2px solid #e0e8ff;
}

.generate-btn {
  font-size: 1.2rem;
  padding: 1.2rem 3rem;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-icon {
  font-size: 1.3rem;
}

/* Sheet Preview */
.sheet-preview {
  margin-top: 3rem;
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 12px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.sheet-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.problems-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem;
  padding: 2rem;
  background: white;
  border-radius: 8px;
}

.problem {
  font-family: 'Courier New', monospace;
  font-size: 1.2rem;
  padding: 1rem;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
}

.problem-vertical {
  white-space: pre;
  line-height: 1.6;
  text-align: right;
}

.problem-horizontal {
  text-align: center;
  padding: 1.5rem;
}

.underline {
  border-bottom: 2px solid #333;
  margin-top: 0.5rem;
  padding-bottom: 1rem;
}

/* Saved Sheets */
.saved-sheets-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.saved-sheet-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 1.5rem;
  border: 2px solid #e0e0e0;
  transition: all 0.3s;
  cursor: pointer;
}

.saved-sheet-card:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.saved-sheet-card h3 {
  margin-bottom: 1rem;
  color: #333;
}

.saved-sheet-meta {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.saved-sheet-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Help & Contact */
.help-content,
.contact-content {
  background: white;
  border-radius: 16px;
  padding: 3rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  max-width: 900px;
  margin: 0 auto;
}

.help-section {
  margin-bottom: 3rem;
}

.help-section h2 {
  color: #667eea;
  margin-bottom: 1rem;
}

.help-section h3 {
  color: #333;
  margin: 1.5rem 0 0.5rem;
}

.help-section ul {
  list-style: none;
  padding-left: 0;
}

.help-section ul li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
}

.help-section ol {
  padding-left: 1.5rem;
}

.help-section ol li {
  padding: 0.5rem 0;
}

.example-box {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
  margin: 1rem 0;
  overflow-x: auto;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: #333;
  color: white;
  border-radius: 8px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(100px);
  transition: all 0.3s;
  z-index: 10000;
  max-width: 400px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: #28a745;
}

.toast.error {
  background: #dc3545;
}

.toast.warning {
  background: #ffc107;
  color: #333;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-links {
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.9rem;
  }

  .auth-container {
    padding: 2rem 1.5rem;
  }

  .main-content {
    padding: 1.5rem;
  }

  .main-content h1 {
    font-size: 2rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .sheet-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .sheet-actions {
    width: 100%;
  }

  .sheet-actions .btn {
    flex: 1;
  }

  .problems-container {
    grid-template-columns: 1fr;
    padding: 1rem;
  }

  .saved-sheets-container {
    grid-template-columns: 1fr;
  }

  .help-content,
  .contact-content {
    padding: 2rem 1.5rem;
  }

  .toast {
    right: 1rem;
    left: 1rem;
  }

  /* Hero Section Mobile */
  .hero-content {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .hero-features {
    justify-content: center;
    gap: 1.5rem;
  }

  /* Form Grid Mobile */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .form-card {
    padding: 1.5rem;
  }

  /* Features Grid Mobile */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .feature-card {
    padding: 2rem;
  }

  /* Grade Levels Mobile */
  .grade-levels-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .grade-card {
    padding: 2rem;
  }

  /* Section Titles Mobile */
  .section-title {
    font-size: 2rem;
  }

  .section-subtitle {
    font-size: 1.1rem;
  }
}

/* Features Section */
.features-section {
  margin-bottom: 4rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.feature-card {
  background: white;
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
  border: 2px solid #f0f0f0;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.15);
  border-color: #667eea;
}

.feature-card .feature-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  display: block;
}

.feature-card h3 {
  color: #333;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.feature-card p {
  color: #666;
  line-height: 1.6;
  margin: 0;
}

/* Grade Levels Section */
.grade-levels-section {
  margin-bottom: 4rem;
}

.grade-levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.grade-card {
  background: linear-gradient(135deg, #f8f9ff 0%, #e8f2ff 100%);
  border-radius: 16px;
  padding: 2.5rem;
  text-align: center;
  border: 2px solid #e0e8ff;
  transition: all 0.3s ease;
  position: relative;
}

.grade-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(102, 126, 234, 0.2);
  border-color: #667eea;
}

.grade-number {
  font-size: 3rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 0.5rem;
  display: block;
}

.grade-card h3 {
  color: #333;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.grade-card p {
  color: #666;
  line-height: 1.6;
  margin: 0;
}

@media print {
  .navbar,
  .sheet-header,
  .btn {
    display: none !important;
  }

  .sheet-preview {
    margin: 0;
    padding: 0;
    background: white;
  }

  .problems-container {
    page-break-inside: avoid;
  }

  .problem {
    page-break-inside: avoid;
    border: none;
    background: white;
  }
}


