:root {
  --primary: #5E4B8B;
  --primary-light: #7E6BA3;
  --primary-lighter: #A99BC1;
  --primary-lightest: #EFE9F7;
  --white: #FFFFFF;
  --off-white: #FAFAFA;
  --light-gray: #F5F5F7;
  --gray: #E6E6E9;
  --dark-gray: #6E6E76;
  --black: #1D1D21;
  --shadow: rgba(0, 0, 0, 0.06);
  --shadow-strong: rgba(0, 0, 0, 0.12);
  --accent: #C2A83E;
  --accent-light: #E5D9A8;
}

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

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

body {
  font-family: 'Inter', sans-serif;
  color: var(--black);
  line-height: 1.6;
  background-color: var(--off-white);
  letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 3.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

h2 {
  font-size: 2.5rem;
  color: var(--primary);
}

h3 {
  font-size: 1.5rem;
  color: var(--primary-light);
}

p {
  margin-bottom: 1.25rem;
  font-weight: 300;
  font-size: 1.05rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: 500;
}

a:hover {
  color: var(--primary-light);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Header & Navigation */
header {
  background-color: var(--white);
  box-shadow: 0 4px 20px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  list-style: none;
}

.nav-links li {
  margin-left: 2rem;
}

.nav-links a {
  color: var(--black);
  margin-left: 2rem;
  font-weight: 500;
  position: relative;
  padding-bottom: 0.25rem;
}

.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--primary);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 50%;
}

.nav-links a.active {
  color: var(--primary);
}

.nav-links a.active::after {
  width: 100%;
}

/* Sections */
.section {
  padding: 6rem 0;
  min-height: 80vh;
  display: flex;
  align-items: center;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-badge {
  display: inline-block;
  background-color: var(--primary-lightest);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.section-subtitle {
  max-width: 700px;
  margin: 0 auto;
  color: var(--dark-gray);
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.6;
}

.section-intro {
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto 3rem;
  text-align: center;
}

/* Hero Section */
.hero {
  padding: 8rem 0;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--off-white) 0%, var(--light-gray) 100%);
}

.hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4rem;
}

.hero-text {
  flex: 1;
}

.pre-heading {
  display: inline-block;
  background-color: var(--primary-lightest);
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px var(--shadow);
}

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

.hero-shape {
  width: 320px;
  height: 320px;
  background: linear-gradient(135deg, var(--primary-lightest) 0%, var(--primary-lighter) 100%);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  position: relative;
  box-shadow: 0 20px 40px rgba(94, 75, 139, 0.15);
  animation: morphShape 15s ease-in-out infinite alternate;
}

@keyframes morphShape {
  0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
  25% { border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%; }
  50% { border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%; }
  75% { border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%; }
  100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

.hero-shape::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  animation: morphShapeInner 15s ease-in-out infinite alternate;
}

@keyframes morphShapeInner {
  0% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
  25% { border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%; }
  50% { border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%; }
  75% { border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%; }
  100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; }
}

.hero h1 {
  margin-bottom: 0.5rem;
}

.hero h2 {
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
  font-weight: 500;
}

.hero p {
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 0 2rem;
  color: var(--dark-gray);
}

.cta-button {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  padding: 0.9rem 2.2rem;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  letter-spacing: 0.03em;
  box-shadow: 0 4px 12px var(--shadow-strong);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  transition: left 0.5s ease;
  z-index: -1;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
}

.secondary-button {
  display: inline-block;
  background-color: transparent;
  color: var(--primary);
  padding: 0.9rem 2.2rem;
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 1px solid var(--primary);
  cursor: pointer;
  font-size: 1rem;
  letter-spacing: 0.03em;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.secondary-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background-color: var(--primary-lightest);
  transition: left 0.5s ease;
  z-index: -1;
}

.secondary-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}

.secondary-button:hover::before {
  left: 0;
}

.cta-button:hover {
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px var(--shadow-strong);
}

.cta-button:hover::before {
  left: 0;
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.feature {
  background-color: var(--white);
  padding: 2.5rem;
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s ease;
  border: 1px solid var(--gray);
  box-shadow: 0 8px 20px var(--shadow);
  position: relative;
  overflow: hidden;
}

.feature::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 0;
  background: linear-gradient(to bottom, var(--primary), var(--primary-light));
  transition: height 0.5s ease;
}

.feature:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px var(--shadow-strong);
  border-color: var(--primary-lighter);
}

.feature:hover::after {
  height: 100%;
}

/* Process */
.process {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.process-step {
  background-color: var(--white);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--shadow);
  position: relative;
  border: 1px solid var(--gray);
}

.step-number {
  position: absolute;
  top: -15px;
  left: 20px;
  width: 30px;
  height: 30px;
  background-color: var(--primary);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 2px 4px var(--shadow);
}

.technical-details {
  background-color: var(--white);
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid var(--gray);
  box-shadow: 0 2px 8px var(--shadow);
}

/* Engine Form */
.engine-form {
  background-color: var(--white);
  padding: 3rem;
  border-radius: 12px;
  margin-bottom: 3rem;
  border: 1px solid var(--gray);
  box-shadow: 0 10px 30px var(--shadow);
  position: relative;
  overflow: hidden;
}

.engine-form::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
}

.form-header {
  margin-bottom: 2.5rem;
  text-align: center;
  position: relative;
}

.form-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: 0 8px 16px var(--shadow-strong);
}

.form-icon i {
  color: var(--white);
  font-size: 1.5rem;
}

.error-message {
  color: #d32f2f;
  background-color: rgba(211, 47, 47, 0.1);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-top: 1rem;
  font-size: 0.9rem;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.form-description {
  color: var(--dark-gray);
  margin-bottom: 1.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  font-weight: 300;
  font-size: 1.05rem;
}

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

.form-row {
  display: flex;
  gap: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--primary);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

input, select, textarea {
  width: 100%;
  padding: 1rem 1.2rem;
  border: 1px solid var(--gray);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  background-color: var(--white);
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px var(--shadow);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(94, 75, 139, 0.15);
  transform: translateY(-2px);
}

small {
  display: block;
  color: var(--dark-gray);
  margin-top: 0.3rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.form-actions {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-right: 0.5rem;
}

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

/* Results */
.results {
  background-color: var(--white);
  border-radius: 12px;
  box-shadow: 0 10px 30px var(--shadow);
  overflow: hidden;
  border: 1px solid var(--gray);
  position: relative;
}

.results::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--primary) 100%);
}

.hidden {
  display: none;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--gray);
  background-color: var(--light-gray);
  padding: 0 1rem;
}

.tab {
  padding: 1.2rem 1.8rem;
  cursor: pointer;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--primary);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.tab:hover {
  color: var(--primary);
}

.tab:hover::after {
  width: 40%;
}

.tab.active {
  color: var(--primary);
  background-color: var(--white);
}

.tab.active::after {
  width: 80%;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.tab-header {
  padding: 2rem 2rem 1.5rem 2rem;
  border-bottom: 1px solid var(--gray);
  background-color: var(--white);
}

.tab-header h3 {
  margin-bottom: 0.5rem;
  color: var(--primary);
  font-size: 1.5rem;
}

.tab-header .tab-description {
  color: var(--dark-gray);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.output-box {
  background-color: var(--light-gray);
  padding: 1.5rem;
  border-radius: 6px;
  white-space: pre-wrap;
  font-family: 'Inter', sans-serif;
  min-height: 200px;
  border: 1px solid var(--gray);
}

#iterations-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

#iterations-container {
  padding: 2rem;
  background-color: var(--off-white);
}

.iteration-item {
  background-color: var(--light-gray);
  padding: 1.5rem;
  border-radius: 6px;
  border: 1px solid var(--gray);
}

.iteration-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.iteration-content {
  white-space: pre-wrap;
}

#evaluation-scores {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.score-card {
  background-color: var(--white);
  padding: 1.8rem;
  border-radius: 8px;
  text-align: center;
  border: 1px solid var(--gray);
  box-shadow: 0 5px 15px var(--shadow);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.score-icon {
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary-lightest) 0%, var(--primary-lighter) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: var(--primary);
  font-size: 1.2rem;
}

.score-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
}

.score-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px var(--shadow-strong);
}

.score-value {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  margin-top: 0.5rem;
  display: inline-block;
}

/* Footer */
footer {
  background-color: var(--light-gray);
  padding: 3rem 0 1.5rem;
  margin-top: 3rem;
  border-top: 1px solid var(--gray);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3rem 0;
  border-bottom: 1px solid var(--gray);
}

.footer-tagline {
  color: var(--dark-gray);
  margin-top: 0.5rem;
  font-weight: 300;
  font-style: italic;
}

.footer-logo {
  font-family: 'Poppins', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

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

.footer-links a {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary-lightest);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.footer-links a:hover {
  background-color: var(--primary);
  color: var(--white);
  transform: translateY(-3px);
  box-shadow: 0 5px 15px var(--shadow);
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  color: var(--dark-gray);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  
  .section {
    padding: 3rem 0;
  }
  
  h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 1.8rem;
  }
  
  .hero {
    flex-direction: column;
    text-align: center;
  }
  
  .hero-content {
    text-align: center;
    order: 2;
  }
  
  .hero-image {
    order: 1;
    margin-bottom: 2rem;
  }
  
  .hero p {
    margin: 0 auto 2rem;
  }
  
  .hero-buttons {
    justify-content: center;
  }
  
  .footer-content {
    flex-direction: column;
    gap: 1.5rem;
  }
}

/* New UI Elements */
.action-buttons {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.progress-container {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--light-gray);
  border-radius: 12px;
  border: 1px solid var(--gray);
}

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

.progress-header h4 {
  margin: 0;
  color: var(--primary);
  font-size: 1.1rem;
}

#progress-text {
  color: var(--dark-gray);
  font-size: 0.9rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  width: 0%;
  transition: width 0.3s ease;
}

.current-iteration {
  text-align: center;
  color: var(--dark-gray);
  font-size: 0.9rem;
  font-weight: 500;
}

.iteration-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.view-toggle {
  display: flex;
  background: var(--gray);
  border-radius: 6px;
  overflow: hidden;
}

.toggle-btn {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--dark-gray);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  font-weight: 500;
}

.toggle-btn.active {
  background: var(--primary);
  color: white;
}

.toggle-btn:hover:not(.active) {
  background: var(--light-gray);
}

.iteration-item {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray);
  position: relative;
}

.iteration-item.selectable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.iteration-item.selectable:hover {
  border-color: var(--primary-light);
  box-shadow: 0 4px 12px var(--shadow);
}

.iteration-item.selected {
  border-color: var(--primary);
  box-shadow: 0 4px 16px var(--shadow-strong);
}

.iteration-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray);
}

.iteration-number {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.iteration-score {
  color: var(--dark-gray);
  font-size: 0.9rem;
  font-weight: 500;
}

.iteration-content {
  color: var(--black);
  line-height: 1.6;
  white-space: pre-wrap;
}

.comparison-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.comparison-side {
  padding: 1rem;
  background: var(--light-gray);
  border-radius: 8px;
}

.comparison-side h4 {
  margin-bottom: 1rem;
  color: var(--primary);
  font-size: 1rem;
}

.diff-highlight {
  background: var(--accent-light);
  padding: 0.1rem 0.2rem;
  border-radius: 3px;
}
