:root {
  --bg-dark: #0D0D0D;
  --bg-panel: #1A1A1A;
  --bg-terminal: #050505;
  --text-main: #E0E0E0;
  --primary: #00FF88;
  --secondary: #00CC6A;
  --accent: #FF6B6B;
  --border-color: #333333;
  --font-mono: 'Fira Code', 'Courier New', Courier, monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-mono);
  overflow: hidden;
  height: 100vh;
}

#app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border-color);
}

.header-title {
  color: var(--primary);
  font-weight: bold;
  font-size: 1.2rem;
  letter-spacing: 2px;
}

nav button {
  background: none;
  border: none;
  color: #888;
  font-family: var(--font-mono);
  font-size: 1rem;
  margin: 0 10px;
  cursor: pointer;
  transition: color 0.2s;
}

nav button:hover, nav button.active {
  color: var(--primary);
}

.user-stats span {
  margin-left: 15px;
  font-size: 0.9rem;
}
.user-stats span span {
  color: var(--primary);
  font-weight: bold;
}

/* Main Layout */
main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sections */
#view-problems, #view-dashboard {
  flex: 1;
  display: flex;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* Panels */
.panel {
  padding: 20px;
  overflow-y: auto;
}

.list-panel {
  width: 350px;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-panel);
}

.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-dark);
}

/* List View */
.list-panel h2 {
  font-size: 1.1rem;
  margin-bottom: 15px;
  color: var(--primary);
}

.filters select {
  width: 100%;
  padding: 8px;
  background: var(--bg-dark);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-family: var(--font-mono);
  margin-bottom: 15px;
}

#problem-list {
  list-style: none;
}

.prob-item {
  padding: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 10px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.prob-item:hover, .prob-item.active {
  border-color: var(--primary);
  background-color: rgba(0, 255, 136, 0.05);
}

.prob-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}

.prob-item-title {
  font-weight: bold;
}

.prob-meta span {
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 3px;
  background: #222;
}
.prob-meta .solved-badge {
  color: var(--primary);
  background: rgba(0,255,136,0.1);
  margin-left: 5px;
}

/* Editor Panel */
.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

#active-problem {
  display: flex;
  flex-direction: column;
  height: 100%;
}

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

.problem-header h2 {
  color: #fff;
}

.badge {
  background: #333;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.badge.easy { color: #00FF88; border: 1px solid #00FF88; }
.badge.medium { color: #FFCC00; border: 1px solid #FFCC00; }
.badge.hard { color: #FF6B6B; border: 1px solid #FF6B6B; }

.timer {
  font-size: 1.2rem;
  color: var(--primary);
  margin-left: 15px;
}

.problem-description {
  background: var(--bg-panel);
  padding: 15px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  margin-bottom: 15px;
  line-height: 1.5;
  font-size: 0.95rem;
}

/* Code Editor */
.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-bottom: 15px;
  min-height: 250px;
}

.editor-header {
  background: #222;
  padding: 8px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.btn-small {
  background: none;
  border: 1px solid #555;
  color: #aaa;
  font-family: var(--font-mono);
  padding: 2px 8px;
  cursor: pointer;
  border-radius: 3px;
}
.btn-small:hover { border-color: #fff; color: #fff; }

#code-editor {
  flex: 1;
  background: var(--bg-terminal);
  color: #A6E22E;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 15px;
  border: none;
  resize: none;
  outline: none;
  line-height: 1.5;
}

/* Actions */
.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 15px;
}

button[class^="btn-"] {
  padding: 10px 20px;
  font-family: var(--font-mono);
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  border: none;
  transition: transform 0.1s, opacity 0.2s;
}
button[class^="btn-"]:active { transform: scale(0.98); }
button[class^="btn-"]:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover { background: var(--secondary); }
.btn-accent { background: var(--accent); color: #fff; }

/* Terminal Output */
.terminal-output {
  height: 150px;
  background: var(--bg-terminal);
  border: 1px solid var(--border-color);
  padding: 10px;
  overflow-y: auto;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #ccc;
  border-radius: 4px;
}
.term-pass { color: var(--primary); }
.term-fail { color: var(--accent); }
.term-info { color: #66D9EF; }

/* Dashboard */
.dashboard-panel {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}
.dashboard-panel h2 { color: var(--primary); margin-bottom: 20px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}
.stat-card {
  background: var(--bg-panel);
  padding: 20px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  text-align: center;
}
.stat-card h3 { font-size: 0.9rem; color: #888; margin-bottom: 10px; }
.stat-val { font-size: 2rem; color: var(--primary); font-weight: bold; }

.activity-log h3 { margin-bottom: 15px; color: #fff; }
#recent-list { list-style: none; }
#recent-list li {
  padding: 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  border-radius: 4px;
}

/* Modal */
#modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex; justify-content: center; align-items: center;
  z-index: 100;
}
.modal {
  background: var(--bg-panel);
  padding: 30px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  width: 500px;
  max-width: 90%;
}
.modal h2 { color: var(--primary); margin-bottom: 15px; text-transform: uppercase; }
.modal hr { border: 0; border-top: 1px solid var(--border-color); margin: 15px 0; }
.modal pre {
  background: var(--bg-terminal); padding: 10px;
  border-radius: 4px; overflow-x: auto; font-size: 0.85rem;
  color: #E6DB74; margin-bottom: 20px;
}
