
/*
All of the colors

1a1a1a
fafafa
333
666
999
377e17 -> special color / will not change
f51515 -> special color / will not change
e5e5e5
f8f8f8
fff

*/

:root {
  --color-1: #fafafa;
  --color-2: #1a1a1a;
  --color-3: #333;
  --color-4: #666;
  --color-5: #999;
  --color-6: #fff;
  --color-7: #f8f8f8;
  --color-8: #e5e5e5;
  --color-9: #333333af;

  --alpha-color-1: rgba(250, 250, 250, 0.95);
  --alpha-color-2: rgba(0, 0, 0, 0.05);
}

.dark-theme {
  --color-1: #050505;
  --color-2: #e5e5e5;
  --color-3: #ccc;
  --color-4: #999;
  --color-5: #666;
  --color-6: #000;
  --color-7: #070707;
  --color-8: #1a1a1a;
  --color-9: #ccccccaf;

  --alpha-color-1: rgba(5, 5, 5, 0.95);
  --alpha-color-2: rgba(255, 255, 255, 0.05);
}

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

body {
  font-family: "Inter", sans-serif;
  background: var(--color-1);
  color: var(--color-2);
  line-height: 1.6;
  overflow-x: hidden;
  transition: all 0.3s ease;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  text-transform: uppercase;
}

.loading-text {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 2px;
  margin-bottom: 20px;
  color: var(--color-4);
}

.loading-counter {
  font-size: 48px;
  font-weight: 300;
  color: var(--color-2);
  font-family: "JetBrains Mono", monospace;
}

/* Main Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
  opacity: 0;
  transition: opacity 1s ease 0.5s;
}

.container.visible {
  opacity: 1;
}

/* Navigation */
.main-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 60px;
  padding: 30px 0;
  background: var(--alpha-color-1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-8);
  transition: all 0.3s ease;
}

.main-nav.scrolled {
  padding: 20px 0;
  box-shadow: 0 2px 20px var(--alpha-color-2);
}

.nav-link {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--color-4);
  text-decoration: none;
  transition: color 0.3s ease;
  position: relative;
}

.nav-link:hover {
  color: var(--color-2);
}

.nav-link.active {
  color: var(--color-2);
  font-weight: 500;
  text-decoration: underline;
}

/* .nav-link::after,
.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-2);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
} */

/* theme icon */

.change-theme {
  background: none;
  border: none;
  font-size: 21px;
  color: var(--color-4);
  transition: all 0.3s ease;
  cursor: pointer;
}

.change-theme:hover {
  color: var(--color-2);
}

/* Sections */
.section {
  padding: 60px 0;
  border-bottom: 1px solid var(--color-8);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 80px;
}

.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  letter-spacing: -1px;
  color: var(--color-2);
}

.section-number {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-5);
  letter-spacing: 1px;
}

.section-description {
  text-align: center;
  font-size: 16px;
  color: var(--color-4);
  margin-bottom: 60px;
  line-height: 1.8;
}

/* Converter Grid */
.converter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.input-area textarea {
  width: 100%;
  min-height: 120px;
  padding: 20px;
  border: 1px solid var(--color-9);
  border-radius: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  background: var(--color-6);
  resize: vertical;
  transition: border-color 0.3s ease;
  color: var(--color-2);
}

.input-area textarea:focus {
  outline: none;
  border-color: var(--color-2);
}

.button-row {
  display: flex;
  gap: 20px;
  margin-top: 30px;
}

.output-area {
  min-height: 120px;
  display: flex;
  align-items: stretch;
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 8px 16px;
  background: var(--color-2);
  color: var(--color-6);
  border: none;
  font-family: "Inter", sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  opacity: 0.8;
}

.copy-btn:hover {
  opacity: 1;
  background: var(--color-3);
}

.morse-display,
.text-display {
  width: 100%;
  min-height: 120px;
  padding: 20px;
  background: var(--color-7);
  border: 1px solid var(--color-9);
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  word-break: break-all;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-accent {
  padding: 12px 30px;
  border: 1px solid var(--color-2);
  background: transparent;
  font-family: "Inter", sans-serif;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--color-2);
  color: var(--color-6);
}

.btn-primary:hover {
  background: var(--color-3);
}

.btn-secondary {
  color: var(--color-2);
}

.btn-secondary:hover {
  background: var(--color-2);
  color: var(--color-6);
}

.btn-accent {
  border-color: var(--color-4);
  color: var(--color-4);
}

.btn-accent:hover {
  background: var(--color-4);
  color: var(--color-6);
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.clear-btn {
  padding: 12px 15px;
  min-width: 50px;
}

.clear-btn i {
  font-size: 12px;
}

/* Cheatsheet Grid */
.cheatsheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.cheatsheet-item {
  padding: 30px;
  border: 1px solid var(--color-8);
  background: var(--color-6);
  transition: all 0.3s ease;
  cursor: pointer;
}

.cheatsheet-item:hover {
  border-color: var(--color-2);
  transform: translateY(-2px);
}

.cheatsheet-letter {
  font-size: 24px;
  font-weight: 500;
  margin-bottom: 10px;
  color: var(--color-2);
}

.cheatsheet-morse {
  font-family: "JetBrains Mono", monospace;
  font-size: 18px;
  margin-bottom: 15px;
  letter-spacing: 2px;
  color: var(--color-3);
}

.cheatsheet-phrase {
  font-size: 14px;
  color: var(--color-4);
  line-height: 1.6;
  font-style: italic;
}

/* Accordion functinality - Only for cheatsheet and reference sections */
.cheatsheet-header,
.reference-header {
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 10px 20px;
  margin: -10px -20px 40px -20px;
  user-select: none;
}

.cheatsheet-header:hover,
.reference-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.cheatsheet-header.collapsed,
.reference-header.collapsed {
  opacity: 0.7;
  margin-bottom: 0;
}

.accordion-arrow {
  margin-left: 20px;
  transition: transform 0.3s ease;
  color: var(--color-4);
  font-size: 1.2rem;
}

.accordion-arrow.collapsed {
  transform: rotate(-180deg);
}

/* Accordion Content */
.accordion-content {
  transition: all 0.4s ease;
  overflow: hidden;
  max-height: none;
}

.accordion-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
}

.accordion-content .section-description {
  color: var(--color-4);
  margin-bottom: 30px;
  line-height: 1.6;
}

.accordion-content .cheatsheet-grid,
.accordion-content .morse-reference-grid {
  transition: opacity 0.3s ease 0.1s;
}

.accordion-content.collapsed .cheatsheet-grid,
.accordion-content.collapsed .morse-reference-grid {
  transition: none;
}

/* Practice Section */
.practice-container {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.practice-question-area {
  margin-bottom: 60px;
}

.practice-morse {
  font-family: "JetBrains Mono", monospace;
  font-size: 4rem;
  font-weight: 300;
  letter-spacing: 8px;
  margin-bottom: 30px;
  color: var(--color-2);
}

.practice-answer-area {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 40px;
}

.practice-answer-area input {
  width: 80px;
  height: 80px;
  text-align: center;
  font-size: 32px;
  font-weight: 300;
  border: 1px solid var(--color-9);
  background: var(--color-6);
  text-transform: uppercase;
  color: var(--color-2);
}

.practice-answer-area input:focus {
  outline: none;
  border-color: var(--color-2);
}

.practice-result {
  font-size: 18px;
  font-weight: 400;
  margin-bottom: 40px;
  min-height: 30px;
}

.practice-result.correct {
  color: #377e17;
}

.practice-result.incorrect {
  color: #f51515;
}

.practice-result.fade-in {
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
  color: var(--color-2);
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.practice-score {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 40px;
  border-top: 1px solid var(--color-8);
  font-family: "JetBrains Mono", monospace;
}

/* Sound Quiz - Music Player Style */
.quiz-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px;
}

/* Player Controls */
.player-controls {
  margin-bottom: 40px;
}

.player-main-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
}

.player-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: 2px solid var(--color-2);
  background: var(--color-6);
  color: var(--color-2);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-btn:hover {
  background: var(--color-2);
  color: var(--color-6);
  transform: scale(1.05);
}

.player-btn.playing {
  background: #377e17;
  border-color: #377e17;
  color: var(--color-6);
  animation: pulse 1s infinite;
}

.reset-btn {
  background: var(--color-2);
  color: var(--color-6);
  padding: 12px 30px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
}

.reset-btn:hover {
  background: var(--color-3);
  border-color: var(--color-3);
  transform: translateY(-1px);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Progress bar removed */

/* Settings Panel */
.player-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
  border-radius: 8px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-group label {
  font-size: 12px;
  color: var(--color-4);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
}

.setting-group select {
  padding: 12px;
  background: var(--color-6);
  border: 1px solid var(--color-9);
  color: var(--color-2);
  font-family: "Inter", sans-serif;
  font-size: 14px;
}

.speed-control,
.volume-control {
  display: flex;
  align-items: center;
  gap: 15px;
}

.speed-control input[type="range"],
.volume-control input[type="range"] {
  flex: 1;
  height: 4px;
  background: var(--color-8);
  border-radius: 2px;
  outline: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb,
.volume-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--color-2);
  border-radius: 50%;
  cursor: pointer;
}

.speed-control span,
.volume-control span {
  font-size: 12px;
  color: var(--color-4);
  font-family: "JetBrains Mono", monospace;
  min-width: 40px;
}

/* Mini Visualizer */
.mini-visualizer {
  display: flex;
  align-items: center;
  padding: 0 15px;
}

.mini-visualizer .visualizer-bars {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 2px;
  height: 30px;
}

.mini-visualizer .visualizer-bars .bar {
  width: 4px;
  background: var(--color-4);
  border-radius: 1px;
  transition: height 0.1s ease;
  height: 8px;
}

.mini-visualizer .visualizer-bars .bar.active {
  background: var(--color-2);
  animation: visualizerPulse 0.3s ease;
}

@keyframes visualizerPulse {
  0% { transform: scaleY(1); }
  50% { transform: scaleY(1.2); }
  100% { transform: scaleY(1); }
}

/* Answer Section */
.answer-section {
  margin-bottom: 40px;
}

.answer-input-group {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.answer-input-group input {
  flex: 1;
  padding: 16px 20px;
  border: 1px solid var(--color-9);
  background: var(--color-6);
  color: var(--color-2);
  font-size: 16px;
  transition: border-color 0.3s ease;
}

/* Smooth clear effect for answer input */
.answer-input-group input.clearing {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.answer-input-group input:focus {
  outline: none;
  border-color: var(--color-2);
}

.check-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--color-2);
  background: var(--color-2);
  color: var(--color-6);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 400px) {
  .check-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .answer-input-group input {
    font-size: 14px;
    padding: 10px 14px;
  }
}

@media (max-width: 320px) {
  .check-btn {
    width: 35px;
    height: 35px;
    font-size: 14px;
  }

  .answer-input-group input {
    font-size: 13px;
    padding: 8px 12px;
  }
}

.check-btn:hover {
  background: var(--color-3);
  transform: scale(1.05);
}

.result-display {
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  min-height: 30px;
  padding: 15px;
  transition: all 0.3s ease;
}

.result-display.correct {
  background: rgba(55, 126, 23, 0.1);
  color: #377e17;
  border: 1px solid rgba(55, 126, 23, 0.3);
}

.result-display.incorrect {
  background: rgba(245, 21, 21, 0.1);
  color: #f51515;
  border: 1px solid rgba(245, 21, 21, 0.3);
  animation: fadeHoldOut 2.2s ease forwards;
}

@keyframes fadeHoldOut {
  0% { opacity: 0; transform: translateY(-8px); }
  15% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-8px); }
}

/* Player Stats */
.player-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  padding: 30px;
  background: var(--color-7);
  border-radius: 8px;
}

.stat-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-label {
  display: block;
  font-size: 12px;
  color: var(--color-4);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: var(--color-2);
  font-family: "JetBrains Mono", monospace;
}

/* Reference Grid */
.morse-reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
}

.morse-item {
  padding: 20px;
  border: 1px solid var(--color-8);
  background: var(--color-6);
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.morse-item:hover {
  border-color: var(--color-2);
  transform: translateY(-2px);
}

.morse-letter {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 10px;
  color: var(--color-2);
}

.morse-code {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--color-4);
}

/* Footer */
.footer {
  text-align: center;
  padding: 40px 0;
  color: var(--color-2);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 400;
  letter-spacing: 1px;
}

.footer a {
  text-decoration: none;
  color: var(--color-2);
}

.footer-link {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 1px;
  color: var(--color-4);
  text-decoration: none;
  transition: color 0.3s ease;
  position: relative;
}

.footer-link:hover {
  color: var(--color-2);
}

.footer-link::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-2);
  transition: width 0.3s ease;
}

.footer-link:hover::after {
  width: 100%;
}

/* Video Link */
.video-link {
  color: var(--color-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.video-link:hover {
  border-bottom-color: var(--color-2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 20px;
  }

  .main-nav {
    flex-wrap: wrap;
    gap: 30px;
  }

  .converter-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .section {
    padding: 40px 0;
  }

  .section-header {
    /* flex-direction: column; */
    gap: 20px;
    margin-bottom: 60px;
  }

  .practice-morse {
    font-size: 2.5rem;
    letter-spacing: 4px;
  }

  .practice-answer-area {
    flex-direction: column;
    align-items: center;
  }

  .practice-score {
    flex-direction: column;
    gap: 20px;
  }

  .cheatsheet-grid {
    grid-template-columns: 1fr;
  }

  .footer {
    flex-direction: column;
    gap: 1rem;
  }
}
