/* ==================================================
   COMMON CSS FOR TYPING PAGES
   ================================================== */

/* ------------------ PAGE CONTAINERS ------------------ */

.select-page,
.container,
.typing-container {
  max-width: 1150px;
  min-height: calc(100vh - 80px); /* header height */
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 10px auto;
  padding: 10px;
  background: #020617;
  border: 1px solid #1f2937;
  border-radius: 20px;
}

/* ------------------ HEADINGS ------------------ */

.select-page h1,
.container h1 {
  text-align: center;
  margin-bottom: 35px;
  font-weight: 700;
}

.hero h1,
.hero-title {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  line-height: 1.15;
  letter-spacing: -0.03em;

  /* Gradient colors */
  background: linear-gradient(
    110deg,
    #3f2e00 0%,
    #8c6b1f 10%,
    #fef3c7 18%,
    #facc15 25%,
    #fff7d6 32%,
    #eab308 40%,
    #ca8a04 52%,
    #facc15 65%,
    #fff1b8 72%,
    #8c6b1f 85%,
    #3f2e00 100%
  );

  background-size: 300% 100%;

  /* Gradient text magic */
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;

  /* Glow for dark background */
  text-shadow: 0 6px 35px rgba(34, 211, 238, 0.25);

  /* Animation */
  animation: heroGradient 6s ease infinite;
}

/* Gradient animation */
@keyframes heroGradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.disclaimer {
  margin-top: 0px;
  font-size: 13px;
  color: #9ca3af;
  text-align: center;
  opacity: 0.85;
}
.hero-subtitle {
  margin-top: 3px;
  font-size: 0.65em;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.main-container {
  padding: 30px;
}

#stepArea {
  padding: 30px;
}

#mainNav .nav-highlight {
  color: #facc15;
  font-weight: 600;
}

.nav-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==================================================
   TYPING LAYOUT (TEXT LEFT | WATCH RIGHT)
   ================================================== */

.typing-wrapper {
  display: grid;
  grid-template-columns: 1.6fr 0.4fr; /* MORE SPACE TO TEXT */
  gap: 36px;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .typing-wrapper {
    grid-template-columns: 1fr;
  }
}

/* ==================================================
   TEXT DISPLAY (FIXED HEIGHT + AUTO SCROLL)
   ================================================== */

.text-display {
  background: #020617;
  border: 1px solid #1f2937;
  border-radius: 18px;
  padding: 20px;
  font-size: 15px;
  line-height: 1.9;
  color: #e5e7eb;

  /* BIGGER FIXED AREA */
  height: 400px; /* ⬅ increased */
  overflow-y: auto;
}

/* Scrollbar styling (optional but nice) */
.text-display::-webkit-scrollbar {
  width: 6px;
}
.text-display::-webkit-scrollbar-thumb {
  background: #38bdf8;
  border-radius: 10px;
}
.text-display::-webkit-scrollbar-track {
  background: transparent;
}

/* Paragraph text */
#originalText {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
  display: block;
}

/* ==================================================
   FORCE TEXT VISIBILITY (CRITICAL FIX)
================================================== */

#originalText {
  color: #e5e7eb !important;
  opacity: 1 !important;
  font-size: 20px;
  line-height: 1.9;
}

/* Default state */
#originalText span.pending {
  color: #9ca3af; /* visible gray */
  opacity: 1;
}

/* Correct / Wrong */
#originalText span.correct {
  color: #22c55e;
}

#originalText span.wrong {
  color: #ef4444;
}

/* Remove accidental hiding */
.text-display:not(.completed) {
  opacity: 1 !important;
}

/* ==================================================
   INPUT AREA
   ================================================== */

.input-box,
textarea {
  width: 100%;
  margin-top: 10px;
  min-height: 140px;
  background: #020617;
  border: 2px solid #1f2937;
  border-radius: 14px;
  padding: 15px;
  font-size: 18px;
  color: #e5e7eb;
}

textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

/* ==================================================
   WATCH SECTION (RIGHT SIDE – FIXED AREA)
   ================================================== */

.exam-watch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;

  background: #020617;
  border: 1px solid #1f2937;
  border-radius: 16px;
  padding: 18px;

  position: sticky;
  top: 100px;
}

/* ------------------ CIRCULAR WATCH ------------------ */

.circle-watch {
  position: relative;
  width: 105px; /* reduced */
  height: 105px; /* reduced */
}

/* Rotate SVG correctly */
.circle-watch svg {
  transform: rotate(-90deg);
}

.circle-watch circle {
  fill: none;
  stroke-width: 8; /* thinner for small size */
}

/* Background circle */
.circle-watch .bg {
  stroke: #1f2937;
}

/* Progress circle */
.circle-watch .progress {
  stroke: #ef4444;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 0.4s linear;
}

.circle-watch .progress.wpm {
  stroke: #38bdf8;
}

/* ------------------ CENTER TEXT INSIDE WATCH ------------------ */

.center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-weight: 700;
}

.center-text span {
  font-size: 16px;
  color: #ffffff;
}

.center-text small {
  font-size: 9px;
  letter-spacing: 1px;
  color: #94a3b8;
}

/* ==================================================
   STATS & STRICT MODE
   ================================================== */

.strict-mode {
  /* margin: 18px 0; */
  font-size: 14px;
  opacity: 0.9;
}

.stats {
  display: flex;
  /* gap: 20px; */
  /* margin: 15px 0 25px; */
  font-weight: 600;
  font-size: 15px;
}

/* ==================================================
   BUTTON GROUPS
   ================================================== */
button {
  border: none;
}
.practice-buttons,
.result-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
}

.practice-buttons .btn,
.result-actions .btn {
  min-width: 140px;
  padding: 12px 22px;
}

/* ==================================================
   RESULTS
   ================================================== */

.results {
  margin-top: 30px;
  padding: 25px;
  background: #020617;
  border: 1px solid #1f2937;
  border-radius: 18px;
}

.results h3 {
  margin-bottom: 15px;
}

/* ==================================================
   FEEDBACK COLORS
   ================================================== */

.correct {
  color: #22c55e;
}

.wrong,
.incorrect {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* ==================================================
   UTILITIES
   ================================================== */

.hidden {
  display: none;
}

/* Paragraph completed state */
/* ===============================
   Test completed – gray ONLY original text
   =============================== */

.text-display.completed #originalText {
  color: #6b7280; /* gray */
  opacity: 0.7;
}

/* Keep typed text colors intact */
.text-display.completed .correct {
  color: #22c55e;
}

.text-display.completed .wrong,
.text-display.completed .incorrect {
  color: #ef4444;
}

/* Disable cursor feel after completion */
.text-display.completed {
  user-select: none;
}

/* ===============================
   After completion: typed text becomes neutral
   =============================== */

.text-display.completed .correct,
.text-display.completed .wrong,
.text-display.completed .incorrect,
.text-display.completed .pending {
  color: #9ca3af; /* neutral gray */
  background: none;
  text-decoration: none;
}

/* Stop caret animation after completion */
.text-display.completed .caret {
  animation: none;
  border-left-color: transparent;
}

/* ===============================
   Input disabled look after completion
   =============================== */

textarea.completed,
.input-box.completed {
  background: #020617;
  color: #9ca3af;
  border-color: #374151;
  opacity: 0.7;
  pointer-events: none; /* no typing */
}
/* ==================================================
   SELECT TYPING TEST PAGE FIX
   ================================================== */

.select-page {
  display: grid;
  grid-template-columns: 1fr;
  text-align: left;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.select-page h1 {
  text-align: center;
  margin-bottom: 40px;
}

.step {
  background: rgba(2, 6, 23, 0.7);
  border: 1px solid #1f2937;
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 25px;
}
.step h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  margin-bottom: 16px;
  color: #e5e7eb;
}

/* Number badge look */
.step h3 span,
.step h3::before {
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
}
.options {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.select-page #startBtn {
  margin-top: auto;
}

/* Option buttons */
.opt-btn {
  background: #020617;
  border: 1px solid #1f2937;
  color: #e5e7eb;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.opt-btn:hover {
  background: rgba(59, 130, 246, 0.15);
}

/* Active option */
.opt-btn.active {
  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  border-color: transparent;
  color: #fff;
}

/* ==================================================
   START TEST BUTTON (PRIMARY CTA)
   ================================================== */

#startBtn {
  display: block;
  margin: 30px auto 0;
  padding: 16px 48px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 14px;

  background: linear-gradient(90deg, #3b82f6, #06b6d4);
  color: #ffffff;
  border: none;
  cursor: pointer;

  box-shadow:
    0 10px 30px rgba(59, 130, 246, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;
}

/* Hover */
#startBtn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 16px 40px rgba(59, 130, 246, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Active (click) */
#startBtn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

/* Disabled state */
#startBtn:disabled {
  background: linear-gradient(90deg, #334155, #1e293b);
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
  opacity: 0.8;
}

/* ==================================================
   STEP TRANSITION ANIMATION
   ================================================== */

.step {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.step.hidden {
  opacity: 0;
  transform: translateX(40px);
  pointer-events: none;
}

/* When step becomes active */
.step.active {
  opacity: 1;
  transform: translateX(0);
}
/* Back button */
.back-btn {
  margin-top: 20px;
  background: transparent;
  border: 1px solid #1f2937;
  color: #cbd5f5;
}

.back-btn:hover {
  background: rgba(59, 130, 246, 0.15);
}
/* ==================================================
   CUSTOM TOAST (TOP RIGHT)
   ================================================== */

.toast-box {
  position: fixed;
  top: 24px;
  right: 24px;

  min-width: 260px;
  max-width: 320px;

  background: red;
  color: #e5e7eb;

  padding: 14px 18px;
  border-radius: 12px;
  border-left: 4px solid #38bdf8;

  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;

  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);

  opacity: 0;
  transform: translateX(20px);
  pointer-events: none;

  z-index: 99999;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

/* Show state */
.toast-box.show {
  opacity: 1;
  transform: translateX(0);
}

/* Error type (optional for future use) */
.toast-box.error {
  border-left-color: #ef4444;
}

/* Success type (optional) */
.toast-box.success {
  border-left-color: #22c55e;
}
/* ===============================
   MOBILE BUTTON FIX (Practice)
================================ */

@media (max-width: 600px) {
  .practice-buttons {
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .practice-buttons .btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border-radius: 12px;
  }
}

.modern-select {
  width: 260px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #020617;
  border: 1px solid #1f2937;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  appearance: none;
  cursor: pointer;

  background-image:
    linear-gradient(45deg, transparent 50%, #38bdf8 50%),
    linear-gradient(135deg, #38bdf8 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(1em + 2px),
    calc(100% - 13px) calc(1em + 2px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.modern-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* =========================================
   PAGE TITLE – ANIMATED GRADIENT
   ========================================= */

.page-title-gradient {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;

  background: linear-gradient(
    110deg,
    #3f2e00 0%,
    #8c6b1f 10%,
    #fef3c7 18%,
    #facc15 25%,
    #fff7d6 32%,
    #eab308 40%,
    #ca8a04 52%,
    #facc15 65%,
    #fff1b8 72%,
    #8c6b1f 85%,
    #3f2e00 100%
  );

  background-size: 300% 100%;

  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;

  text-shadow: 0 4px 24px rgba(168, 85, 247, 0.25);

  animation: pageTitleGradient 6s ease infinite;
}

/* Smooth gradient movement */
@keyframes pageTitleGradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

#textContainer {
  max-height: 250px;      /* adjust to your UI */
  overflow-y: hidden;    /* hide manual scroll */
  position: relative;
}

/* Hide scrollbar */
#textContainer::-webkit-scrollbar {
  display: none;
}

#textContainer {
  scrollbar-width: none;
}
