/* ======================================================
   🎨 DESIGN TOKENS — COLOR, ENERGY, SHADOW
   ====================================================== */

:root {
  /* Backgrounds */
  --bg-main: radial-gradient(1200px at 10% 10%, #0f172a 0%, #020617 45%);
  --bg-panel: #0f172a;
  --bg-header: #020617;
  --bg-hover: #1e293b;
  --bg-focus: rgba(56, 189, 248, 0.15);

  /* Borders & Shadows */
  --border: rgba(148, 163, 184, 0.15);
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.45);

  /* Text */
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #64748b;

  /* Status Colors */
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.2);

  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.2);

  --yellow: #facc15;
  --yellow-soft: rgba(250, 204, 21, 0.2);

  /* Accent */
  --blue: #38bdf8;
  --purple: #a78bfa;
}

/* ======================================================
   BASE / RESET
   ====================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
}

/* ======================================================
   APP SHELL
   ====================================================== */

.app {
  display: flex;
  height: 100vh;
  min-height: 0;
}

/* ======================================================
   SIDEBAR
   ====================================================== */

.sidebar {
  width: 250px;
  padding: 18px 14px;
  background: var(--bg-header);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transition: width 0.3s ease, padding 0.3s ease;
  position: relative;
}

.sidebar.collapsed {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-right: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sidebar-toggle-btn,
.sidebar-show-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  cursor: pointer;
  box-shadow: none;
}

.sidebar-toggle-btn:hover,
.sidebar-show-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  box-shadow: none;
}

.sidebar h3 {
  margin-bottom: 0;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.day-title {
  margin: 18px 0 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Problem links */

.problem-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.problem-link::before {
  content: "•";
  color: var(--text-muted);
}

.problem-link:hover {
  background: var(--bg-hover);
}

.problem-link.active {
  font-weight: 600;
  background: linear-gradient(90deg,
      rgba(56, 189, 248, 0.2),
      rgba(167, 139, 250, 0.15));
}

.problem-link.solved {
  color: var(--green);
}

.problem-link.solved::before {
  content: "✓";
  color: var(--green);
}

/* ======================================================
   MAIN AREA
   ====================================================== */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ======================================================
   HEADER
   ====================================================== */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.header h2 {
  margin: 0;
  font-size: 20px;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* ======================================================
   BUTTONS
   ====================================================== */

button {
  padding: 10px 22px;
  border-radius: 10px;
  border: none;
  cursor: pointer;

  font-weight: 700;
  letter-spacing: 0.4px;
  color: #020617;

  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.35);

  transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  opacity: 0.92;
  box-shadow: 0 12px 28px rgba(34, 197, 94, 0.45);
}

button.secondary {
  background: #1e293b;
  color: var(--text-primary);
  box-shadow: none;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ======================================================
   CONTENT SPLIT
   ====================================================== */

.container {
  display: flex;
  height: 70vh;
  min-height: 0;
}

/* ======================================================
   PROBLEM PANEL
   ====================================================== */

.problem-panel {
  width: 42%;
  padding: 28px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.problem-panel p {
  line-height: 1.75;
  color: var(--text-secondary);
}

.problem-panel pre {
  padding: 14px;
  border-radius: 10px;
  background: #020617;
  border: 1px solid var(--border);
}

/* ======================================================
   EDITOR PANEL (CRITICAL)
   ====================================================== */

.editor-panel {
  width: 58%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #020617;
}

.editor {
  flex: 1;
  min-height: 0;
}

/* ======================================================
   OUTPUT PANEL
   ====================================================== */

.output-panel {
  height: 20vh;
  padding: 18px 28px;
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  overflow-y: auto;
}

.muted {
  color: var(--text-secondary);
}

/* ======================================================
   TEST RESULTS
   ====================================================== */

.test-line {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
}

.test-pass {
  background: var(--green-soft);
  border-left: 4px solid var(--green);
}

.test-fail {
  background: var(--red-soft);
  border-left: 4px solid var(--red);
}

.test-error {
  background: var(--yellow-soft);
  border-left: 4px solid var(--yellow);
}

.test-line b {
  color: var(--blue);
}

/* ======================================================
   SCROLLBAR
   ====================================================== */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background: linear-gradient(var(--blue), var(--purple));
}

/* ======================================================
   TOP BAR
   ====================================================== */

.topbar {
  height: 58px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s ease;
}

.nav-link:hover {
  background: var(--bg-hover);
}

/* ======================================================
   DASHBOARD
   ====================================================== */

.dashboard {
  max-width: 1000px;
  margin: 32px auto;
  padding: 0 20px;
}

.dashboard h1 {
  margin-bottom: 24px;
}

/* Top stat cards */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dashboard .card {
  padding: 20px;
  border-radius: 14px;
  background: var(--bg-panel);
  box-shadow: var(--shadow-soft);
}

.stat-card h3 {
  margin: 0 0 12px;
  color: var(--text-secondary);
}

.stat-card p {
  margin: 6px 0;
}

/* Day rows */

.day-row {
  display: grid;
  grid-template-columns: 180px 1fr 80px;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.day-row span {
  white-space: nowrap;
}

/* Progress bars */

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #020617;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), #16a34a);
  transition: width 0.4s ease;
}

/* Big percentage */

.big {
  font-size: 48px;
  font-weight: 800;
  color: var(--green);
  margin-bottom: 8px;
}

/* ======================================================
   METADATA BADGES & TAGS
   ====================================================== */

.meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-easy {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-medium {
  background: rgba(250, 204, 21, 0.15);
  color: var(--yellow);
  border: 1px solid rgba(250, 204, 21, 0.3);
}

.badge-hard {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.tags {
  display: flex;
  gap: 8px;
}

.tag {
  font-size: 12px;
  color: var(--text-secondary);
  background: #1e293b;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ======================================================
   HINTS
   ====================================================== */

.hint-box {
  margin-top: 24px;
  padding: 16px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.05);
  /* Blue tint */
  border: 1px solid rgba(56, 189, 248, 0.2);
}

details summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 600;
  list-style: none;
  /* Hide default triangle in some browsers */
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::before {
  content: "💡 ";
}

.hint-list {
  margin: 12px 0 0 20px;
  padding: 0;
  color: var(--text-primary);
}

.hint-list li {
  margin-bottom: 6px;
}