/* --- SHARED STYLES FOR ALL PRACTICE TOOLS --- */
/* --- Setup Screen --- */
#setup-screen {
  text-align: center;
  padding: 30px;
}

.tool-select {
  display: block;
  width: 50%;
  margin: 20px auto;
  padding: 12px;
  font-size: 1.1rem;
  border-radius: 8px;
  border: 1px solid #374151;
  background: #2b3a50; /* Dark input bg */
  color: #E5E7EB;
  -webkit-appearance: none; /* Fix for iOS */
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
}

.setup-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    width: 80%;
    margin: 20px auto;
}
.setup-row .tool-select {
    width: 100%;
    margin: 0;
}

/* --- Buttons --- */
.tool-button, .tool-button-primary, .tool-button-secondary, .tool-button-danger, .tool-button-solution, .tool-button-success {
  padding: 12px 25px;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin: 5px;
  transition: all 0.2s ease;
}
.tool-button-primary { 
  color: white;
  background: linear-gradient(90deg, #0ea5e9, #6366f1);
  background-size: 200% 100%;
}
.tool-button-primary:hover:not(:disabled) { 
  background-position: 100% 0;
  box-shadow: 0 4px 15px rgba(56, 189, 248, 0.2);
}
.tool-button-secondary { 
  background-color: #374151; /* Dark grey */
  color: #E5E7EB; 
  border: 1px solid #4B5563;
}
.tool-button-secondary:hover:not(:disabled) { background-color: #4B5563; }
.tool-button-danger { background-color: #E11D48; color: white; }
.tool-button-danger:hover:not(:disabled) { background-color: #BE123C; }

/* Green buttons */
.tool-button-success {
  background-color: #059669 !important;
  color: white;
}
.tool-button-success:hover:not(:disabled) { background-color: #047857 !important; }
.tool-button-solution { background-color: #059669; color: white; }
.tool-button-solution:hover:not(:disabled) { background-color: #047857; }

#run-code-btn.tool-button-solution { background-color: #059669; }
#run-code-btn.tool-button-solution:hover:not(:disabled) { background-color: #047857; }

.tool-button:disabled, .tool-button-primary:disabled, .tool-button-secondary:disabled, .tool-button-danger:disabled, .tool-button-solution:disabled {
  background: #374151;
  color: #6B7280;
  cursor: not-allowed;
  opacity: 0.7;
  background-image: none;
}

/* --- Practice Screen --- */
.stats-bar {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: bold;
  color: #D1D5DB; /* Lighter grey */
  background: #2b3a50; /* Darker bg */
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}
#question-topic {
  font-style: italic;
  color: #9CA3AF;
}

.question-box {
  font-size: 1.25rem;
  line-height: 1.6;
  text-align: left;
  background: #2b3a50; /* Darker bg */
  border: 1px solid #374151;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  min-height: 100px;
  color: #E5E7EB;
}

/* --- (Aptitude Option styles) --- */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  text-align: left;
}
@media (min-width: 768px) {
  .options-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.option {
  display: block;
  background: #2b3a50;
  border: 2px solid #374151;
  padding: 15px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  color: #E5E7EB;
}
.option:hover {
  background-color: #374151;
  border-color: #4B5563;
}
.option.selected {
  background-color: #1E40AF; /* Dark blue */
  border-color: #3B82F6; /* Bright blue */
  font-weight: bold;
  color: white;
}
.option.correct {
  background-color: #064E3B; /* Dark green */
  border-color: #10B981; /* Bright green */
}
.option.incorrect {
  background-color: #7F1D1D; /* Dark red */
  border-color: #F87171; /* Bright red */
}
.option.disabled {
  pointer-events: none;
  opacity: 0.8;
}

/* --- STYLES FOR TECHNICAL TOOL --- */
#logic-answer-box {
  width: 100%;
  height: 200px;
  border: 1px solid #374151;
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 15px;
  box-sizing: border-box; 
  background: #2b3a50;
  color: #E5E7EB;
}
#logic-answer-box:focus {
  outline: none;
  border-color: #38BDF8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.3);
}

.run-code-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}
.run-code-row #run-code-btn {
    width: auto;
    margin: 0;
}

.editor-label {
  display: block;
  text-align: left;
  font-weight: bold;
  font-size: 0.9rem;
  color: #D1D5DB; /* Lighter text */
  margin-bottom: 5px;
}

#code-editor-container {
  width: 100%;
  height: 300px;
  border: 1px solid #374151;
  border-radius: 8px;
  text-align: left;
  margin-bottom: 15px;
}

#output-box {
  min-height: 100px;
  background: #111827; /* Darkest bg */
  color: #D1D5DB; /* Lighter text */
  font-family: 'Courier New', Courier, monospace;
  white-space: pre-wrap;
  text-align: left;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #374151;
}
#output-box .pass { color: #34D399; font-weight: bold; } /* Brighter green */
#output-box .fail { color: #F87171; font-weight: bold; } /* Brighter red */
#output-box .error { color: #FBBF24; font-weight: bold; } /* Brighter yellow */

.nav-button-row {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  gap: 10px;
}
.nav-button-row button { width: 100%; }
@media (min-width: 768px) {
    .nav-button-row button { width: 48%; }
}

/* --- Solution Box --- */
.solution-button-row {
  text-align: center;
  margin-top: 10px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
}
.solution-button-row button { width: 100%; }
@media (min-width: 768px) {
    .solution-button-row button { width: 48%; }
}

.solution-box,
pre#solution-box {
  background: #111827; /* Darkest bg */
  border-radius: 8px;
  padding: 15px;
  text-align: left;
  white-space: pre-wrap;
  font-family: "Courier New", Courier, monospace;
  color: #E5E7EB; /* Light text */
  border: 1px solid #374151;
  margin-top: 20px;
  box-sizing: border-box; /* Fix for <pre> */
  width: 100%; /* Fix for <pre> */
}

.button-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
  border-top: 1px solid #374151; /* Dark border */
  padding-top: 20px;
}
.button-row #end-btn { width: 100%; }

/* --- Feedback Screen --- */
#feedback-screen .response-box { margin-bottom: 20px; }

/* --- Utility --- */
.hidden { display: none; }

/* --- SPINNER STYLES --- */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 24, 39, 0.8); /* Dark overlay */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}
.spinner-overlay p {
  font-size: 1.2rem;
  font-weight: bold;
  color: #E5E7EB; /* Light text */
  margin-top: 20px;
}
.spinner {
  border: 8px solid #374151; /* Dark grey border */
  border-top: 8px solid #38BDF8; /* Accent color */
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* ================= CYBERPUNK PREMIUM REPORT STYLES (paste at BOTTOM) ================= */

/* Outer report container */
.apt-report {
  background: linear-gradient(180deg, rgba(10,12,20,0.95), rgba(6,8,15,0.96));
  border-radius: 16px;
  padding: 28px;
  border: 1px solid rgba(100, 120, 255, 0.06);
  box-shadow: 0 20px 60px rgba(2,6,23,0.7), inset 0 2px 10px rgba(56, 24, 80, 0.12);
  color: #cddbf8;
  overflow: hidden;
}

/* premium header */
.apt-report h3 {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  font-weight: 700;
  font-size: 1.35rem;
  color: #dff3ff;
  text-shadow: 0 3px 18px rgba(64, 140, 255, 0.08);
}
.apt-report .subtitle {
  color: #9fb9ff;
  opacity: 0.9;
  margin-top: 6px;
  font-size: 0.95rem;
}

/* top row layout */
.report-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 30px;
  flex-wrap: wrap;
}

/* cyberpunk donut (large) */
.apt-score-wrapper {
  width: 320px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.apt-score-ring {
  width: 280px;
  height: 280px;
  filter: drop-shadow(0 8px 20px rgba(56, 168, 255, 0.14));
}
.apt-score-text {
  position: absolute;
  inset: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  color:#e9f4ff;
  font-weight:800;
  font-size:2.6rem;
  text-shadow: 0 6px 24px rgba(32,110,255,0.12), 0 1px 0 rgba(255,255,255,0.02);
}
.apt-score-percent {
  font-size: 0.9rem;
  color: #9fb9ff;
  font-weight:700;
}
.report-stats-horizontal-wrapper {
  display: flex;
  gap: 15px; /* Spacing between the three cards */
  justify-content: center; /* Center the cards horizontally */
  margin-top: 25px; /* Spacing below the main score ring */
  flex-wrap: wrap; /* Allow wrapping on small screens */
}

.stat-card {
  min-width:120px;
  padding:12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(80,120,255,0.06);
  border-radius:10px;
  box-shadow: 0 6px 18px rgba(4,6,18,0.6);
  color:#dbeaff;
  text-align:center;
}
.stat-card .label { font-size:0.85rem; color:#9fb9ff; }
.stat-card .value { font-size:1.2rem; font-weight:800; margin-top:6px; }

/* 4-card ai grid (overall,strongest,weakest,key) */
.ai-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 30px; /* cleaner spacing */
}
.ai-card {
  background: linear-gradient(180deg, rgba(12,14,22,0.45), rgba(7,8,14,0.5));
  border-radius:12px;
  padding:14px;
  border: 1px solid rgba(95,130,255,0.06);
  min-height:130px;
  color:#d9ecff;
  transition: transform .28s ease, box-shadow .28s ease;
}
.ai-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(56,168,255,0.08), 0 6px 30px rgba(120,40,255,0.03);
}
.ai-card h4 {
  margin:0 0 8px;
  color:#9ad1ff;
  font-size:0.98rem;
  display:flex;
  gap:8px;
  align-items:center;
  font-weight:700;
}

/* small inner bubble for content (md -> html) */
.ai-card .ai-content {
  background: rgba(255,255,255,0.02);
  border-radius:8px;
  padding:10px;
  color:#d7e7ff;
  line-height:1.5;
  font-size:0.95rem;
  border: 1px solid rgba(255,255,255,0.02);
  max-height: none;
  overflow: visible;
}

/* cyberpunk bar chart row placeholder */
.report-chart-row {
  margin-top: 18px;
  display:flex;
  gap:16px;
  align-items:flex-end;
}

/* small key */
.mini-legend {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 20px;
  opacity: 0.9;
  color: #9fb9ff;
  font-size: 0.92rem;
}

/* back button style (report) */
.apt-report-footer {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-top: 20px;
}
.btn-ghost {
  padding:10px 16px;
  border-radius:10px;
  background: rgba(255,255,255,0.02);
  color: #dbeaff;
  border: 1px solid rgba(120,180,255,0.06);
}
.btn-primary {
  padding:12px 20px;
  border-radius:10px;
  background: linear-gradient(90deg, #3ab7ff, #7c4dff);
  color:white;
  font-weight:700;
  box-shadow: 0 10px 30px rgba(64,100,255,0.12);
}

/* small responsive rules */
@media (max-width: 980px) {
  .report-top-row { grid-template-columns: 1fr; }
  .ai-cards-grid { grid-template-columns: 1fr 1fr; }
  .apt-score-wrapper { width: 220px; height: 220px; }
  .apt-score-ring { width: 190px; height: 190px; }
}
@media (max-width: 560px) {
  .ai-cards-grid { grid-template-columns: 1fr; }
  .stat-card { min-width:100px; }
}

/* small glows and animated accent lines */
.apt-report::before {
  content: "";
  position: absolute;
  left: -10%;
  top: -40%;
  width: 140%;
  height: 120%;
  background: radial-gradient(circle at 20% 10%, rgba(60,160,255,0.06), transparent 10%),
              radial-gradient(circle at 80% 90%, rgba(140, 40, 255, 0.04), transparent 12%);
  pointer-events:none;
  mix-blend-mode: screen;
}

.apt-report {
  margin-bottom: 40px;
}