/* styles.css - Modern Dark Theme with Distinctive Visual Effects */
/* Complete redesign with vibrant colors, glass-morphism, and improved UX */

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

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: radial-gradient(circle at 10% 20%, #0a0f1e, #03060c);
  color: #eef2ff;
  min-height: 100vh;
  position: relative;
}

/* Animated grain effect */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIj48ZmlsdGVyIGlkPSJmIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iLjciIG51bU9jdGF2ZXM9IjMiLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWx0ZXI9InVybCgjZikiIG9wYWNpdHk9IjAuMDMiLz48L3N2Zz4=');
  background-repeat: repeat;
  pointer-events: none;
  opacity: 0.3;
  z-index: 0;
}

.app-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.5rem;
  position: relative;
  z-index: 1;
}

/* Header Styles - Vibrant Gradient */
.header {
  text-align: center;
  margin-bottom: 2.5rem;
  position: relative;
}

.header h1 {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 800;
  background: linear-gradient(135deg, #FFB347 0%, #FF6B6B 50%, #A259FF 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.header p {
  color: #a0b3e0;
  background: rgba(162, 89, 255, 0.12);
  backdrop-filter: blur(8px);
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border-radius: 60px;
  border: 1px solid rgba(255, 180, 71, 0.35);
  font-size: 0.9rem;
  max-width: 900px;
  margin: 0.5rem auto 0;
}

/* Search Bar - Glass Morphism */
.search-bar {
  margin-bottom: 2rem;
}

.search-bar input {
  width: 100%;
  padding: 1rem 1.8rem;
  background: rgba(18, 25, 45, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 180, 71, 0.4);
  border-radius: 80px;
  font-size: 1rem;
  color: #ffffff;
  font-family: 'Inter', monospace;
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  outline: none;
}

.search-bar input:focus {
  border-color: #FF6B6B;
  box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.2), 0 8px 25px rgba(0, 0, 0, 0.4);
  background: rgba(25, 35, 60, 0.9);
}

.search-bar input::placeholder {
  color: #7a8bb5;
}

/* Two Column Layout */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .two-col {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .app-container {
    padding: 1rem;
  }
}

/* Card Styles - Glass Effect */
.card {
  background: rgba(12, 18, 30, 0.6);
  backdrop-filter: blur(16px);
  border-radius: 2rem;
  border: 1px solid rgba(255, 200, 100, 0.25);
  overflow: hidden;
  transition: all 0.35s ease;
  box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.5);
}

.card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 107, 107, 0.6);
  box-shadow: 0 28px 40px -15px rgba(162, 89, 255, 0.25);
}

.card-header {
  padding: 1.3rem 1.8rem;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(162, 89, 255, 0.1));
  border-bottom: 2px solid rgba(255, 180, 71, 0.5);
}

.card-header h2 {
  font-size: 1.7rem;
  font-weight: 700;
  background: linear-gradient(120deg, #FFE6C7, #FFB347);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card-body {
  padding: 1.6rem;
}

/* Selector Groups */
.selector-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.select-field {
  flex: 1;
  min-width: 160px;
}

.select-field label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: #FFB347;
  display: block;
  margin-bottom: 0.5rem;
}

select {
  width: 100%;
  padding: 0.8rem 1rem;
  background: #0a1020;
  border: 1px solid #2d3a5e;
  border-radius: 1.2rem;
  color: #f0f3fc;
  font-weight: 500;
  font-family: 'Inter', monospace;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

select:hover {
  border-color: #FFB347;
}

select:focus {
  border-color: #FF6B6B;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.25);
}

/* Language Bar (if used) */
.lang-bar {
  background: linear-gradient(135deg, rgba(255, 180, 71, 0.1), rgba(162, 89, 255, 0.1));
  padding: 0.8rem 1rem;
  border-radius: 1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 180, 71, 0.3);
  backdrop-filter: blur(4px);
}

/* Explanation Box */
.explanation-box {
  background: linear-gradient(145deg, #070c1a, #0a1020);
  border-radius: 1.5rem;
  padding: 1.3rem;
  margin-top: 0.2rem;
  border-left: 5px solid #FFB347;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.05), 0 4px 12px rgba(0,0,0,0.2);
  max-height: 70vh;
  overflow-y: auto;
}

.explanation-text {
  font-size: 1rem;
  line-height: 1.65;
  color: #e2ecff;
  margin-bottom: 1rem;
}

/* Grammar Term Styles */
.grammar-term-bilingual {
  background: rgba(162, 89, 255, 0.2);
  color: #FFB347;
  padding: 0.2rem 0.5rem;
  border-radius: 0.4rem;
  font-weight: 600;
  font-size: 0.85rem;
  display: inline-block;
  margin: 0.1rem 0.2rem;
  border-left: 2px solid #FF6B6B;
}

.grammar-term-en {
  font-family: monospace;
  font-weight: 700;
  color: #FF6B6B;
}

.grammar-term-trans {
  font-family: monospace;
  font-weight: 500;
  color: #FFB347;
  margin-left: 0.3rem;
}

/* ===== DISTINCTIVE SUBTOPIC BUTTONS ===== */
.subtopic-vertical {
  margin: 1rem 0 1.2rem 0;
  padding: 0;
  list-style: none;
}

.subtopic-vertical li {
  background: linear-gradient(135deg, rgba(162, 89, 255, 0.2), rgba(255, 107, 107, 0.15));
  margin: 0.7rem 0;
  padding: 0.8rem 1.2rem;
  border-radius: 60px;
  border: 1.5px solid rgba(162, 89, 255, 0.5);
  font-size: 0.85rem;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.2);
  font-weight: 600;
  letter-spacing: 0.3px;
  backdrop-filter: blur(4px);
  margin-right: 0.8rem;
  display: inline-flex;
}

.subtopic-vertical li::before {
  content: "🎯";
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.subtopic-vertical li:hover {
  background: linear-gradient(135deg, #A259FF, #FF6B6B);
  border-color: #FFB347;
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 22px rgba(162, 89, 255, 0.5);
}

.subtopic-vertical li:hover::before {
  transform: scale(1.1) rotate(5deg);
}

/* Alternative subtopic styling for non-list layouts */
.badge-subtopic, .subtopic-button {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, rgba(162, 89, 255, 0.25), rgba(255, 107, 107, 0.2));
  backdrop-filter: blur(8px);
  border-radius: 60px;
  padding: 0.7rem 1.5rem 0.7rem 1.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.2);
  border: 1.5px solid rgba(162, 89, 255, 0.6);
  color: #ffffff;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  margin: 0.4rem;
}

.badge-subtopic::before, .subtopic-button::before {
  content: "🎯";
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.badge-subtopic:hover, .subtopic-button:hover {
  background: linear-gradient(135deg, #A259FF, #FF6B6B);
  border-color: #FFB347;
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 22px rgba(162, 89, 255, 0.5);
}

/* Example Block */
.example-block {
  background: linear-gradient(120deg, rgba(255, 180, 71, 0.1), rgba(162, 89, 255, 0.08));
  padding: 1rem;
  border-radius: 1rem;
  margin: 1rem 0;
  border-left: 4px solid #FF6B6B;
  transition: all 0.2s;
}

.example-block:hover {
  background: rgba(162, 89, 255, 0.2);
  transform: translateX(4px);
}

.example-title {
  font-weight: 700;
  color: #FFB347;
  font-size: 0.75rem;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
  letter-spacing: 1px;
}

.example-sentence {
  background: rgba(10, 18, 32, 0.6);
  padding: 0.85rem 1.2rem;
  border-radius: 0.9rem;
  margin: 0.7rem 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88rem;
  color: #d4e2ff;
  border-left: 3px solid #FFB347;
  transition: all 0.15s;
  line-height: 1.5;
}

.example-sentence:hover {
  background: rgba(162, 89, 255, 0.15);
  transform: translateX(4px);
}

.example-sentence strong, .example-sentence b {
  color: #FFB347;
  background: rgba(255, 180, 71, 0.2);
  padding: 0.1rem 0.25rem;
  border-radius: 0.3rem;
  font-weight: 700;
}

/* Practice Area */
#practiceArea {
  background: linear-gradient(145deg, #050a12, #0b1120);
  border-radius: 1.5rem;
  padding: 1.5rem;
  min-height: 350px;
  border: 1px solid rgba(255, 180, 71, 0.2);
}

.practice-card {
  background: rgba(10, 18, 32, 0.6);
  border-radius: 1.25rem;
  padding: 1.2rem;
  border: 1px solid rgba(255, 180, 71, 0.2);
}

.question-text {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 1rem;
  background: rgba(162, 89, 255, 0.1);
  padding: 0.8rem 1rem;
  border-radius: 1rem;
  border-left: 3px solid #FFB347;
  color: #eef2ff;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1.1rem;
  background: #0f1626;
  border: 1px solid #29324b;
  border-radius: 1rem;
  margin-bottom: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #d4e2ff;
}

.option-item:hover {
  background: #1a2340;
  border-color: #FFB347;
  transform: translateX(5px);
}

/* GREEN COLOR FOR SELECTED ANSWER */
.option-item.selected {
  background: linear-gradient(95deg, #2e7d32, #1b5e20) !important;
  border-color: #4caf50 !important;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.5), inset 0 1px 2px rgba(255,255,255,0.2);
  color: #ffffff !important;
  font-weight: 600;
}

/* Progress Bar */
.progress-bar-container {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  height: 8px;
  margin: 1rem 0;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, #FFB347, #FF6B6B);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

/* Practice Summary */
.practice-summary {
  background: rgba(10, 18, 32, 0.8);
  border-radius: 1rem;
  padding: 1rem;
  margin-top: 1rem;
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid rgba(255, 180, 71, 0.2);
}

.incorrect-item {
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: rgba(255, 107, 107, 0.15);
  border-left: 3px solid #FF6B6B;
  border-radius: 0.5rem;
}

/* Buttons */
button {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  border: none;
  outline: none;
}

button.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #FFB347;
  border: 1px solid rgba(255, 180, 71, 0.5);
  margin-top: 0.5rem;
}

button.secondary:hover {
  background: rgba(255, 180, 71, 0.2);
  transform: translateY(-2px);
}

button.primary, .btn-primary {
  background: linear-gradient(105deg, #FF6B6B, #A259FF);
  color: white;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(162, 89, 255, 0.3);
}

button.primary:hover, .btn-primary:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 22px rgba(162, 89, 255, 0.5);
  background: linear-gradient(105deg, #FF7B7B, #B259FF);
}

/* Loading Indicator */
.loading-indicator {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #FFB347;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #0a1020;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #FFB347;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #FF6B6B;
}

/* ===== MODAL - WHITE TEXT & MODERN DESIGN ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: linear-gradient(145deg, #121a2c, #0a0f1e);
  border-radius: 2rem;
  max-width: 650px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 40px 70px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 180, 71, 0.2) inset;
  border: 1px solid rgba(255, 180, 71, 0.6);
  animation: modalFloat 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFloat {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.8rem;
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(162, 89, 255, 0.15));
  border-bottom: 2px solid rgba(255, 180, 71, 0.5);
}

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(120deg, #FFB347, #FF6B6B);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-close {
  font-size: 2rem;
  cursor: pointer;
  color: #bfceff;
  transition: all 0.2s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  line-height: 1;
}

.modal-close:hover {
  color: #FF6B6B;
  background: rgba(255, 107, 107, 0.2);
  transform: rotate(90deg);
}

/* Modal body - WHITE TEXT */
#modalBody, .modal-body {
  padding: 2rem;
  line-height: 1.7;
  color: #ffffff !important;
}

#modalBody *,
.modal-body * {
  color: #ffffff !important;
}

.modal-example {
  background: linear-gradient(135deg, rgba(162, 89, 255, 0.2), rgba(255, 107, 107, 0.15));
  padding: 1rem 1.2rem;
  border-radius: 1rem;
  margin: 0.8rem 0;
  font-family: monospace;
  border-left: 3px solid #FFB347;
}

/* Subtopic section title */
.subtopic-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.2rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid rgba(255, 180, 71, 0.4);
}

.subtopic-section-title span {
  font-size: 0.9rem;
  font-weight: 700;
  background: linear-gradient(135deg, #FFB347, #FF8C42);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
}

.badge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.8rem;
}

/* Button Loading State */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  right: 12px;
  margin-top: -8px;
  border: 2px solid white;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .card-header h2 {
    font-size: 1.3rem;
  }
  
  .subtopic-vertical li,
  .badge-subtopic,
  .subtopic-button {
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
  }
  
  .modal-content {
    width: 95%;
    margin: 1rem;
  }
  
  .modal-header h3 {
    font-size: 1.2rem;
  }
}