/* =======================================================
   1. RENK DEĞİŞKENLERİ VE TEMEL AYARLAR
   ======================================================= */
:root {
  --primary: #009688;
  --accent: #ff7043;
  --bg: #E0F7FA;
  --bg-card: #ffffff;
  --text: #343a40;
  --text-light: #6c757d;
  --border-color: #dee2e6;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;

  --font-family: 'Baloo 2', cursive;
  --header-font-weight: 600;
  --body-font-weight: 400;
  --line-height: 1.7;
  --letter-spacing-heading: 0.5px;
}

body.dark {
  --primary: #26a69a;
  --accent: #ffa726;
  --bg: #1f2937;
  --bg-card: #374151;
  --text: #f3f4f6;
  --text-light: #9ca3af;
  --border-color: #4b5563;
}

/* =======================================================
   2. TEMEL STİLLER
   ======================================================= */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  transition: background-color 0.3s, color 0.3s;
  line-height: var(--line-height);
  font-weight: var(--body-font-weight);
}

header {
  background: linear-gradient(135deg, var(--primary) 0%, #00897b 100%);
  color: #fff;
  padding: 2.5rem 1.5rem;
  text-align: center;
  border-bottom-left-radius: 30px;
  border-bottom-right-radius: 30px;
  box-shadow: 0 4px 15px rgba(0, 150, 136, 0.2);
}

header h1 {
  font-weight: var(--header-font-weight);
  font-size: 2.5em;
  letter-spacing: var(--letter-spacing-heading);
  margin: 0 0 0.5rem 0;
}

header p {
  opacity: 0.95;
  font-size: 1.1em;
  margin: 0;
}

.site-logo {
  max-width: 200px;
  height: auto;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
  transition: transform 0.3s ease;
}

.site-logo:hover {
  transform: scale(1.05) rotate(-2deg);
}

.toggle-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1.5rem 1rem;
  flex-wrap: wrap;
}

main {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 1rem;
}

/* =======================================================
   3. DERS KARTLARI
   ======================================================= */
.lesson-card {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  background: var(--bg-card);
  border-radius: 20px;
  padding: 2rem;
  margin: 1.5rem 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  border: 4px solid #FF9800;
  opacity: 0;
  animation: cardIn 0.6s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.lesson-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
}

body.dark .lesson-card {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

body.dark .lesson-card:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lesson-icon {
  font-size: 3.5em;
  line-height: 1;
  min-width: 80px;
  text-align: center;
  opacity: 0.9;
}

.lesson-content {
  flex: 1;
}

.lesson-title {
  color: var(--primary);
  font-weight: var(--header-font-weight);
  font-size: 1.5em;
  letter-spacing: var(--letter-spacing-heading);
  margin: 0 0 0.6rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.completed-badge {
  font-size: 0.65em;
  font-weight: 600;
  color: #fff;
  background: var(--success);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  white-space: nowrap;
}

.lesson-desc {
  color: var(--text-light);
  font-size: 1em;
  margin: 0 0 1.5rem 0;
  line-height: 1.6;
}

.btns {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
}

/* =======================================================
   4. BUTONLAR
   ======================================================= */
button,
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 0.8rem 1.4rem;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), box-shadow 0.2s ease, background-color 0.2s ease;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  font-size: 0.95em;
}

button:hover,
.btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  filter: brightness(1.1);
}

button:active,
.btn:active {
  transform: scale(0.97) translateY(-1px);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.btn.note {
  background: var(--primary);
}

.btn.play {
  background: var(--accent);
}

.btn.test {
  background: #6c757d;
}

.btn.done {
  background: var(--success) !important;
  box-shadow: 0 3px 8px rgba(40, 167, 69, 0.3);
}

body.dark .btn.test {
  background: #9ca3af;
  color: #1f2937;
}

/* =======================================================
   5. İLERLEME ÇUBUĞU
   ======================================================= */
.progress-wrap {
  position: relative;
  background: #e9ecef;
  border-radius: 20px;
  width: 80%;
  max-width: 600px;
  height: 25px;
  margin: 2rem auto;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

body.dark .progress-wrap {
  background: var(--bg-card);
}

#progress {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  transition: width 0.6s cubic-bezier(0.65, 0, 0.35, 1);
  border-radius: 20px;
}

.percentage-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text);
  font-weight: 700;
  font-size: 0.9em;
  text-shadow: 0 0 3px var(--bg);
  pointer-events: none;
}

/* =======================================================
   7. FOOTER
   ======================================================= */
.footer {
  background: var(--text);
  color: var(--bg);
  padding: 2rem;
  text-align: center;
  margin-top: 4rem;
  font-size: 0.95em;
}

body.dark .footer {
  background: #111827;
}

/* =======================================================
   8. MODAL STİLLERİ
   ======================================================= */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  z-index: 101;
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.active {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.modal-backdrop.active {
  display: block;
  opacity: 1;
}

.modal-content {
  background: var(--bg);
  border-radius: 18px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}

.modal-header h2 {
  margin: 0;
  color: var(--primary);
  font-size: 1.6em;
  font-weight: var(--header-font-weight);
  letter-spacing: var(--letter-spacing-heading);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2.5rem;
  font-weight: 300;
  color: var(--text-light);
  opacity: 0.8;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: transform 0.2s ease, color 0.2s ease;
}

.modal-close:hover {
  opacity: 1;
  color: var(--text);
  transform: rotate(90deg) scale(1.1);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: var(--bg);
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* =======================================================
   9. DERS NOTLARI STİLLERİ
   ======================================================= */
.notes-section {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px dashed var(--border-color);
}

.notes-section:last-child {
  border-bottom: none;
}

.notes-section h3 {
  color: var(--accent);
  font-size: 1.4em;
  margin: 0 0 1rem 0;
  font-weight: 600;
}

.notes-section p {
  color: var(--text);
  line-height: 1.8;
  margin: 0 0 1rem 0;
}

.notes-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.2rem;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
}

.notes-table tr:first-child td {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  padding: 1rem;
}

.notes-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.notes-table tr:last-child td {
  border-bottom: none;
}

.notes-table tr:nth-child(even) {
  background: rgba(0, 150, 136, 0.02);
}

.notes-table td.emoji {
  font-size: 1.8em;
  width: 60px;
  text-align: center;
}

.notes-table strong {
  color: var(--primary);
  font-weight: 600;
}

/* =======================================================
   10. OYUN STİLLERİ
   ======================================================= */
.game-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 15px;
  margin-top: 1.5rem;
}

.game-card {
  background: var(--bg-card);
  border: 2px solid var(--primary);
  color: var(--text);
  padding: 1.2rem;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  font-weight: 500;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  word-wrap: break-word;
}

.game-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);
}

.game-card.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(255, 112, 67, 0.3);
}

.game-card.matched {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
  cursor: default;
  animation: matchAnim 0.5s ease-out;
  box-shadow: 0 6px 15px rgba(40, 167, 69, 0.3);
}

.game-card.wrong {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  animation: wrongAnim 0.5s ease-out;
}

@keyframes matchAnim {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes wrongAnim {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-5px);
  }
  100% {
    transform: translateX(0);
  }
}

/* =======================================================
   11. TEST STİLLERİ
   ======================================================= */
.question-card {
  margin-bottom: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
}

.question-text {
  font-size: 1.2em;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg);
  color: var(--text);
  font-weight: 500;
}

.option:hover {
  border-color: var(--primary);
  background: rgba(0, 150, 136, 0.05);
}

.option.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

.test-controls {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  gap: 1rem;
}

.test-result {
  text-align: center;
  padding: 2rem;
}

.test-result h3 {
  color: var(--primary);
  font-size: 2em;
  margin-bottom: 1.5rem;
}

.score {
  font-size: 3.5em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.percent-text {
  font-size: 1.3em;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text);
}

.test-result p {
  font-size: 1.2em;
  margin-bottom: 2rem;
  color: var(--text-light);
}

/* =======================================================
   12. RESPONSIVE TASARIM
   ======================================================= */
@media (max-width: 768px) {
  header h1 {
    font-size: 2em;
  }

  .lesson-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
  }

  .lesson-icon {
    font-size: 3em;
  }

  .lesson-title {
    justify-content: center;
  }

  .btns {
    justify-content: center;
  }

  .game-board {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }

  .modal {
    width: 95%;
    max-width: 100%;
  }

  .modal-body {
    padding: 1.5rem;
  }

  .progress-wrap {
    width: 90%;
  }
}

@media (max-width: 480px) {
  header {
    padding: 1.5rem 1rem;
  }

  header h1 {
    font-size: 1.6em;
  }

  .lesson-card {
    padding: 1rem;
    margin: 1rem 0;
  }

  .lesson-icon {
    font-size: 2.5em;
  }

  .btns {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .game-board {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .game-card {
    padding: 0.8rem;
    min-height: 80px;
    font-size: 0.9em;
  }

  .modal-header h2 {
    font-size: 1.3em;
  }

  .test-controls {
    flex-direction: column;
  }
}

/* =======================================================
   13. VIDEO PLACEHOLDER VE EXTERNAL LINKS
   ======================================================= */
.video-placeholder {
  width: 100%;
  margin-bottom: 20px;
  border-radius: 10px;
  overflow: hidden;
  background: #f0f0f0;
  aspect-ratio: 16 / 9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body.dark .video-placeholder {
  background: #1a1a1a;
}

.video-placeholder iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* External Links */
.external-links {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.external-link-btn {
  flex: 1;
  min-width: 150px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  text-decoration: none;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  font-size: 0.95em;
}

.external-link-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.external-link-btn:active {
  transform: translateY(-1px);
}

/* =======================================================
   14. MATCHING GAME BOARD (GELIŞTIRILMIŞ)
   ======================================================= */
.matching-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
  padding: 10px;
}

.matching-card {
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: bold;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  word-wrap: break-word;
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
  font-size: 0.95em;
}

.matching-card:hover:not(.matched) {
  transform: translateY(-8px);
  box-shadow: 0 12px 30px rgba(102, 126, 234, 0.5);
}

.matching-card.selected {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  border-color: #f5576c;
  transform: scale(1.08);
  box-shadow: 0 8px 25px rgba(245, 87, 108, 0.4);
}

.matching-card.matched {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  border-color: #4CAF50;
  opacity: 0.9;
  cursor: default;
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.matching-card.matched.correct {
  animation: correctMatch 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.matching-card.wrong {
  animation: wrongMatch 0.7s ease;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

@keyframes correctMatch {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

@keyframes wrongMatch {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  25% { transform: translateX(-12px) rotate(-2deg); }
  75% { transform: translateX(12px) rotate(2deg); }
}

/* =======================================================
   15. FILL IN THE BLANKS GAME (BOŞLUK DOLDURMA)
   ======================================================= */
.fill-game-container {
  padding: 20px;
  background: var(--bg);
  border-radius: 12px;
}

.fill-question {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 25px;
  padding: 18px;
  background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
  border-radius: 10px;
  border-left: 5px solid #667eea;
  line-height: 1.6;
}

body.dark .fill-question {
  background: linear-gradient(135deg, #333 0%, #2a2a2a 100%);
  color: #fff;
  border-left-color: #764ba2;
}

.fill-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 25px;
}

.fill-option {
  padding: 14px 16px;
  background: #e8e8e8;
  border: 2px solid #ddd;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  font-size: 0.95em;
}

.fill-option:hover {
  background: #d0d0d0;
  border-color: #667eea;
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.fill-option.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.5);
  transform: scale(1.05);
}

body.dark .fill-option {
  background: #444;
  border-color: #555;
  color: #fff;
}

body.dark .fill-option:hover {
  background: #555;
  border-color: #667eea;
}

body.dark .fill-option.selected {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.fill-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 25px;
  flex-wrap: wrap;
}

.fill-controls .btn {
  flex: 1;
  min-width: 120px;
  max-width: 160px;
}

/* =======================================================
   16. RESPONSIVE OYUN STİLLERİ
   ======================================================= */
@media (max-width: 768px) {
  .matching-board {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 12px;
  }

  .matching-card {
    min-height: 95px;
    padding: 15px;
    font-size: 0.85em;
  }

  .fill-options {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
  }

  .fill-option {
    padding: 12px 14px;
    font-size: 0.9em;
  }

  .fill-controls {
    gap: 10px;
  }

  .fill-controls .btn {
    min-width: 100px;
    max-width: 140px;
  }
}

@media (max-width: 480px) {
  .matching-board {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .matching-card {
    min-height: 85px;
    padding: 12px;
    font-size: 0.8em;
  }

  .fill-question {
    font-size: 16px;
    padding: 14px;
  }

  .fill-options {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .fill-option {
    padding: 10px 12px;
    font-size: 0.85em;
  }

  .fill-controls {
    flex-direction: column;
    gap: 10px;
  }

  .fill-controls .btn {
    width: 100%;
    max-width: none;
  }

  .external-links {
    flex-direction: column;
  }

  .external-link-btn {
    width: 100%;
    min-width: auto;
  }
}
