/* Base layout for idioms showcase */
:root {
  --bg: #0b1224;
  --card: #131d39;
  --accent: #f4c95d;
  --text: #f8fbff;
  --muted: #aeb5c1;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top right, #1a2a53, var(--bg));
  color: var(--text);
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.hero {
  padding: 3rem clamp(1.5rem, 6vw, 3rem);
  text-align: center;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2.25rem, 4vw, 3rem);
}

.hero p {
  margin: 0 auto;
  max-width: 45ch;
  color: var(--muted);
}

/* Feature Blocks */
.feature-blocks {
  padding: 0 clamp(1rem, 4vw, 3rem) 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

.feature-block {
  position: relative;
  background: var(--card);
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  flex-direction: column;
}

.feature-block:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.iotd-block {
  border-color: rgba(244, 201, 93, 0.3);
  background: linear-gradient(135deg, rgba(244, 201, 93, 0.12), rgba(244, 201, 93, 0.04));
}

.iotd-block:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(244, 201, 93, 0.2);
}

.quiz-block {
  border-color: rgba(100, 150, 255, 0.3);
  background: linear-gradient(135deg, rgba(100, 150, 255, 0.12), rgba(100, 150, 255, 0.04));
}

.quiz-block:hover {
  border-color: rgba(100, 150, 255, 0.6);
  box-shadow: 0 8px 24px rgba(100, 150, 255, 0.2);
}

.generator-block {
  border-color: rgba(200, 100, 255, 0.3);
  background: linear-gradient(135deg, rgba(200, 100, 255, 0.12), rgba(200, 100, 255, 0.04));
}

.generator-block:hover {
  border-color: rgba(200, 100, 255, 0.6);
  box-shadow: 0 8px 24px rgba(200, 100, 255, 0.2);
}

.feature-badge {
  padding: 0.625rem 1rem;
  background: linear-gradient(135deg, var(--accent), #e6b84d);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.quiz-block .feature-badge {
  background: linear-gradient(135deg, #6496ff, #4b7bd9);
}

.generator-block .feature-badge {
  background: linear-gradient(135deg, #c864ff, #a050d9);
}

.feature-content {
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  text-decoration: none;
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.feature-title {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  color: var(--accent);
  line-height: 1.3;
}

.quiz-block .feature-title {
  color: #6496ff;
}

.generator-block .feature-title {
  color: #c864ff;
}

.feature-description {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--muted);
  flex: 1;
}

.feature-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--accent);
  font-size: 0.95rem;
  margin-top: auto;
}

.quiz-block .feature-action {
  color: #6496ff;
}

.generator-block .feature-action {
  color: #c864ff;
}

@media (min-width: 768px) {
  .feature-blocks {
    grid-template-columns: repeat(3, 1fr);
  }
}

.search-bar {
  display: flex;
  justify-content: center;
  padding: 0 1rem;
}

.search-bar input {
  width: min(520px, 100%);
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1rem;
}

.search-bar input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(244, 201, 93, 0.25);
}

.category-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem;
  flex-wrap: wrap;
}

.category-filter label {
  font-weight: 600;
  color: var(--text);
}

.category-filter select {
  padding: 0.625rem 1rem;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-filter select:hover {
  border-color: var(--accent);
}

.category-filter select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 201, 93, 0.15);
}

.browse-categories {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.browse-categories:hover {
  text-decoration: underline;
}

.idiom-count {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.load-more-container {
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.load-more-btn {
  padding: 1rem 2.5rem;
  background: var(--card);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.load-more-btn:hover {
  background: rgba(244, 201, 93, 0.1);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.idiom-grid {
  padding: 0 clamp(1rem, 4vw, 3rem) 3rem;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.idiom-card {
  padding: 1.5rem;
  background: var(--card);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.idiom-card:hover {
  transform: translateY(-4px);
  border-color: rgba(244, 201, 93, 0.4);
}

.idiom-card h3 {
  margin: 0;
  font-size: 1.35rem;
}

.idiom-card p {
  margin: 0;
  color: var(--muted);
}

.read-more {
  margin-top: auto;
  font-weight: 600;
  color: var(--accent);
}

.footer {
  padding: 2rem clamp(1rem, 4vw, 3rem);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  text-align: center;
}

.detail-wrapper {
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 960px;
  margin: 0 auto;
}

.detail-header h1 {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 3.5rem);
}

.detail-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--muted);
  margin-bottom: 1rem;
}

.detail-section {
  margin-bottom: 2rem;
}

.detail-section h2 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.detail-section p {
  margin: 0;
  line-height: 1.7;
  color: var(--text);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1.5rem;
}

.related-section {
  margin-top: 3rem;
  margin-bottom: 2rem;
}

.related-section h2 {
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.related-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.related-card {
  padding: 1.25rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

.related-card:hover {
  transform: translateY(-2px);
  border-color: rgba(244, 201, 93, 0.4);
}

.related-card h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--text);
}

.related-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Quiz Styles */
.quiz-wrapper {
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 800px;
  margin: 0 auto;
  min-height: 100vh;
}

.quiz-header {
  margin-bottom: 2rem;
}

.quiz-header h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 2.5rem);
}

.quiz-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.quiz-score {
  font-weight: 700;
  color: var(--accent);
}

.quiz-container {
  margin-bottom: 2rem;
}

.quiz-card {
  padding: 2rem;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.quiz-question {
  margin: 0 0 1.5rem;
  font-size: 1.25rem;
  color: var(--muted);
  font-weight: 500;
}

.idiom-display {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2rem;
  text-align: center;
  padding: 1rem;
  background: rgba(244, 201, 93, 0.1);
  border-radius: 12px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.quiz-option {
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-option:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  transform: translateX(4px);
}

.quiz-option:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.quiz-option.selected {
  border-color: var(--accent);
  background: rgba(244, 201, 93, 0.1);
}

.quiz-option.correct {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
}

.quiz-feedback {
  padding: 1rem;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
}

.quiz-feedback.correct {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.quiz-feedback.incorrect {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.feedback-icon {
  font-size: 1.25rem;
  margin-right: 0.5rem;
}

.quiz-next-btn {
  width: 100%;
  padding: 1rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  font-size: 1.125rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quiz-next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 201, 93, 0.4);
}

.hidden {
  display: none !important;
}

/* Results Styles */
.results-container {
  margin-top: 2rem;
}

.results-card {
  padding: 3rem 2rem;
  background: var(--card);
  border-radius: 16px;
  border: 2px solid rgba(244, 201, 93, 0.3);
  text-align: center;
}

.results-card h2 {
  margin: 0 0 2rem;
  font-size: clamp(2rem, 4vw, 2.5rem);
  color: var(--accent);
}

.results-score {
  margin-bottom: 2rem;
}

.score-display {
  font-size: clamp(4rem, 8vw, 6rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 1rem;
}

.score-total {
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--muted);
}

.results-score p {
  font-size: 1.25rem;
  color: var(--text);
  margin: 0;
}

.results-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.quiz-btn {
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
}

.quiz-btn.primary {
  background: var(--accent);
  color: var(--bg);
}

.quiz-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 201, 93, 0.4);
}

.quiz-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.quiz-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* Categories Page */
.categories-wrapper {
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 1200px;
  margin: 0 auto;
}

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

.categories-header h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 2.5rem);
}

.categories-header p {
  color: var(--muted);
  font-size: 1.125rem;
  margin: 0;
}

.categories-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.category-card {
  padding: 1.75rem;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: rgba(244, 201, 93, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.category-card h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--accent);
}

.category-badge {
  padding: 0.375rem 0.875rem;
  background: rgba(244, 201, 93, 0.15);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

.category-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* Generator Page */
.generator-wrapper {
  padding: clamp(1.5rem, 4vw, 3rem);
  max-width: 900px;
  margin: 0 auto;
  min-height: 100vh;
}

.generator-header {
  text-align: center;
  margin-bottom: 2rem;
}

.generator-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
  background: linear-gradient(135deg, var(--accent), #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.generator-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1.125rem;
}

.generator-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.generated-idiom-card {
  padding: 2.5rem 2rem;
  background: linear-gradient(135deg, rgba(244, 201, 93, 0.15), rgba(244, 201, 93, 0.05));
  border: 2px solid rgba(244, 201, 93, 0.3);
  border-radius: 20px;
  text-align: center;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
  position: relative;
}

@keyframes idiomPop {
  0% {
    transform: scale(0.95);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.idiom-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1.25rem;
  background: linear-gradient(135deg, var(--accent), #e6b84d);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(244, 201, 93, 0.3);
}

.generated-idiom {
  margin: 1rem 0 0;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--accent);
  line-height: 1.3;
}

.generated-meaning {
  margin: 0;
  font-size: 1.125rem;
  color: var(--text);
  line-height: 1.6;
}

.generator-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.generator-btn {
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.generator-btn.primary {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 4px 16px rgba(244, 201, 93, 0.3);
}

.generator-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(244, 201, 93, 0.4);
}

.generator-btn.primary:active {
  transform: translateY(0);
}

.generator-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.generator-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent);
}

.copy-feedback {
  text-align: center;
  padding: 0.75rem;
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border-radius: 8px;
  font-weight: 600;
  animation: fadeInOut 2s ease;
}

@keyframes fadeInOut {
  0%, 100% {
    opacity: 0;
  }
  10%, 90% {
    opacity: 1;
  }
}

.generator-history {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--card);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.generator-history h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: var(--text);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-empty {
  color: var(--muted);
  text-align: center;
  font-style: italic;
  margin: 1rem 0;
}

.history-item {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

.history-item strong {
  display: block;
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.history-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.generator-info {
  margin-top: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.generator-info h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: var(--text);
}

.generator-info p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.generator-info ul {
  margin: 0;
  padding-left: 1.5rem;
  color: var(--muted);
}

.generator-info li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* Newsletter Section */
.newsletter-section {
  padding: 3rem clamp(1rem, 4vw, 3rem);
  background: linear-gradient(135deg, rgba(244, 201, 93, 0.08), rgba(244, 201, 93, 0.03));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.newsletter-content {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.newsletter-content h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  color: var(--accent);
}

.newsletter-content > p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1.125rem;
}

.email-form {
  display: flex;
  gap: 0.75rem;
  max-width: 500px;
  margin: 0 auto 1rem;
  flex-wrap: wrap;
}

.email-form input[type="email"] {
  flex: 1;
  min-width: 200px;
  padding: 0.875rem 1.25rem;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: var(--card);
  color: var(--text);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.email-form input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(244, 201, 93, 0.2);
}

.email-form button {
  padding: 0.875rem 2rem;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.email-form button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(244, 201, 93, 0.4);
}

.email-form button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.form-message {
  min-height: 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-message.success {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.form-message.error {
  background: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

@media (max-width: 600px) {
  .email-form {
    flex-direction: column;
  }

  .email-form input[type="email"] {
    width: 100%;
  }

  .email-form button {
    width: 100%;
  }
}
