/* ---
   Personalize_AI - Apple-Inspired Design System
   --- */

/* 1. Foundational Setup & Color Palette */
:root {
  --background-color: #ffffff;
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent-blue: #0071e3;
  --accent-green: #30a14e;
  --light-gray-bg: #f5f5f7;
  --border-color: #d2d2d7;
  --selected-bg: #e7f5ff;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  background-color: var(--background-color);
  color: var(--text-primary);
  margin: 0;
  padding: 2rem 1rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main { max-width: 780px; margin: 0 auto; }

/* 2. Premium Typography & Section Headers */
h1, h2, p { margin: 0; }

h1 { font-size: clamp(2.5rem, 6vw, 3.5rem); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.75rem; text-align: center; }
.subheader { font-size: clamp(1rem, 3vw, 1.2rem); color: var(--text-secondary); text-align: center; margin: 0 auto 1.5rem auto; max-width: 620px; }
h2 { font-size: clamp(1.75rem, 5vw, 2rem); font-weight: 600; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid #e5e5e5; }
.question-title { font-size: 1.2rem; font-weight: 600; color: var(--text-primary); margin-bottom: 1rem; }
.stats-subheader { font-size: 1rem; color: var(--text-secondary); margin-top: -1.5rem; margin-bottom: 2rem; }

/* 3. Language Selector */
.language-selector-wrapper { text-align: center; margin-bottom: 3rem; }
#lang-switcher {
  -webkit-appearance: none; appearance: none;
  background-color: var(--light-gray-bg);
  border: 1px solid var(--border-color);
  padding: 0.5rem 2rem 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236E6E73%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: .5em auto;
}

/* 4. Sections (Demo, Stats, Questionnaire) */
#demo-section, #stats-section, #questionnaire-container, #llm-section { margin: 4rem 0; }
.video-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 18px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.1); background-color: #000; }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

#stats-chart-container {
  position: relative;
  height: 547px;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* 5. Questionnaire */
.question-block {
  margin-bottom: 2.5rem;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.question-block.visible {
  opacity: 1;
  transform: translateY(0);
}
.options-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.option-btn { padding: 1.25rem 1.5rem; font-size: 1rem; background-color: var(--light-gray-bg); border: 1px solid var(--light-gray-bg); border-radius: 12px; cursor: pointer; transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94); text-align: left; color: var(--text-primary); }
.option-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07); }
.option-btn.selected { background-color: var(--selected-bg); border-color: var(--accent-blue); color: var(--accent-blue); font-weight: 600; }
#mbti-select { width: 100%; padding: 1.25rem; font-size: 1rem; border: 1px solid var(--border-color); border-radius: 12px; background-color: var(--light-gray-bg); -webkit-appearance: none; appearance: none; background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236E6E73%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.4-12.8z%22%2F%3E%3C%2Fsvg%3E'); background-repeat: no-repeat; background-position: right 1.25rem center; background-size: .65em auto; }
#submit-btn { display: block; width: 100%; padding: 1rem; font-size: 1.1rem; font-weight: 600; background-color: var(--accent-green); color: #fff; border: none; border-radius: 12px; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; margin-top: 1rem; }
#submit-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(48, 161, 78, 0.3); }

/* 6. Results */
#results-container { margin-top: 4rem; }
.prompt-wrapper { position: relative; }
#prompt-output { width: 100%; min-height: 280px; padding: 1.5rem; font-family: 'SF Mono', 'Fira Code', 'Fira Mono', 'Roboto Mono', monospace; font-size: 0.95rem; line-height: 1.6; border: 1px solid var(--border-color); border-radius: 12px; resize: vertical; background-color: var(--light-gray-bg); color: var(--text-primary); }
#copy-btn { position: absolute; top: 12px; right: 12px; background: rgba(255, 255, 255, 0.7); backdrop-filter: blur(5px); border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; padding: 0.5rem; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s ease; }
#copy-btn:hover { background: #fff; }
#copy-btn svg { width: 16px; height: 16px; stroke: var(--text-secondary); }
#copy-notification { text-align: center; margin-top: 1rem; padding: 0.75rem; background-color: var(--accent-blue); color: #fff; border-radius: 8px; font-weight: 600; }
.results-instructions { text-align: center; font-size: 0.9rem; color: var(--text-secondary); margin-top: 1.5rem; max-width: 500px; margin-left: auto; margin-right: auto; }

/* 7. LLM Links Section */
#llm-section { margin-top: 4rem; }
.llm-links-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
}
.llm-link-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  background-color: var(--light-gray-bg);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.llm-link-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.07);
  background-color: #fff;
  color: var(--accent-blue);
}

/* 8. Responsive */
@media (max-width: 600px) {
  body { padding: 2rem 1rem; }
  main { padding: 0; }
  h1 { font-size: 2.2rem; }
  .subheader { font-size: 1rem; }
  .options-wrapper { grid-template-columns: 1fr; }
  .llm-links-wrapper { grid-template-columns: 1fr 1fr; }
}