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

:root {
  /* Pentastic Brand Colors */
  --red: #e53935;
  --red-dark: #d32f2f;
  --purple: #5c6bc0;
  --blue: #3f51b5;
  --gradient: linear-gradient(135deg, #e53935 0%, #5c6bc0 50%, #3f51b5 100%);
  --gradient-btn: linear-gradient(90deg, #e53935 0%, #5c6bc0 100%);
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #333;
  --text-secondary: #666;
  --border: #e0e0e0;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 16px;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px;
}

.screen { display: none; }
.screen.active { display: block; }

/* Split Screen Login Design */
.split-container {
  display: flex;
  min-height: calc(100vh - 40px);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card-bg);
}

.split-left {
  flex: 1;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eaf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  position: relative;
}

.split-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  background: var(--card-bg);
}

.branding-content {
  text-align: center;
  max-width: 400px;
}

.logo-container {
  margin-bottom: 40px;
}

.logo {
  max-width: 200px;
  max-height: 120px;
  object-fit: contain;
}

.brand-title {
  font-size: 2.5em;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 1.1em;
  color: var(--text-secondary);
  margin-bottom: 40px;
  line-height: 1.6;
}

.brand-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 1.8em;
  font-weight: 700;
  color: var(--red);
}

.stat-label {
  font-size: 0.85em;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.login-form-container {
  width: 100%;
  max-width: 400px;
}

.form-title {
  font-size: 1.8em;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.form-subtitle {
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.turnstile-container {
  margin: 20px 0;
}

.btn-gradient {
  background: var(--gradient-btn);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  width: 100%;
  margin-top: 10px;
}

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 57, 53, 0.3);
}

/* Legacy card style for other screens */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 30px;
  margin: 20px auto;
  box-shadow: var(--shadow);
  max-width: 600px;
}

h1 { color: var(--text); margin-bottom: 10px; font-size: 1.8em; font-weight: 700; }
h2 { color: var(--text); margin-bottom: 15px; font-size: 1.4em; font-weight: 600; }
h3 { margin-bottom: 5px; }

.subtitle { color: var(--text-secondary); margin-bottom: 20px; }

/* Forms */
.form-group { margin-bottom: 24px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9em; color: var(--text); }
.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1em;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
}
.form-group input:focus {
  outline: none;
  border-color: var(--purple);
  background: white;
  box-shadow: 0 0 0 3px rgba(92, 107, 192, 0.1);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  margin: 5px 0;
}
.btn-primary { background: var(--gradient-btn); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(229, 57, 53, 0.3); }
.btn-secondary { background: white; color: var(--text); border: 2px solid var(--border); }
.btn-secondary:hover { border-color: var(--purple); color: var(--purple); }
.btn-success { background: #4caf50; color: white; }
.btn-success:hover { background: #43a047; }
.btn-danger { background: var(--red); color: white; }
.btn-warning { background: #ff9800; color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Links */
.links { margin-top: 15px; text-align: center; }
.links a { color: var(--purple); text-decoration: none; margin: 0 10px; font-size: 0.9em; }
.links a:hover { text-decoration: underline; }

/* Messages */
.error { color: var(--red); margin-top: 10px; font-size: 0.9em; }
.success { color: #4caf50; margin-top: 10px; font-size: 0.9em; }
.feedback { margin-top: 10px; min-height: 20px; }
.hidden { display: none; }

/* Quiz Header */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--gradient);
  color: white;
  border-radius: var(--radius);
  margin-bottom: 15px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin: 20px 0;
}
.mode-btn {
  padding: 25px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.mode-btn:hover { border-color: var(--purple); transform: translateY(-2px); box-shadow: var(--shadow); }
.mode-btn h3 { color: var(--purple); margin-bottom: 5px; }
.mode-btn p { color: var(--text-secondary); font-size: 0.9em; margin-top: 5px; }

/* Quiz Options */
.options { margin: 20px 0; }
.option-btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  margin: 10px 0;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: white;
  cursor: pointer;
  text-align: left;
  font-size: 1em;
  transition: all 0.2s;
}
.option-btn:hover { border-color: var(--purple); background: #f5f7ff; }
.option-btn.selected { border-color: var(--purple); background: #e8eaf6; }
.option-btn.correct { border-color: #4caf50; background: #e8f5e9; }
.option-btn.incorrect { border-color: var(--red); background: #ffebee; }

/* Results */
.score-display {
  font-size: 2em;
  font-weight: 700;
  margin: 20px 0;
}
.score-display.pass { color: #4caf50; }
.score-display.fail { color: var(--red); }

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal.active { display: flex; }
.modal-card {
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 30px;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Admin */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-right: 80px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 25px;
}
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.stat-card .num { font-size: 2em; font-weight: 700; color: var(--purple); }
.stat-card .label { font-size: 0.85em; color: var(--text-secondary); margin-top: 4px; }

.tabs { display: flex; gap: 5px; margin-bottom: 15px; flex-wrap: wrap; }
.tab {
  padding: 12px 20px;
  border: none;
  background: #e8eaf6;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  transition: all 0.2s;
}
.tab.active { background: var(--purple); color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.tab-toolbar { display: flex; gap: 10px; margin-bottom: 15px; align-items: center; }
.search-input { padding: 10px 12px; border: 2px solid var(--border); border-radius: 8px; flex: 1; }
.search-input:focus { outline: none; border-color: var(--purple); }

table { width: 100%; border-collapse: collapse; margin: 10px 0; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9em; }
th { background: var(--purple); color: white; font-weight: 600; }
tr:nth-child(even) { background: #f5f7fa; }
tr:hover { background: #e8eaf6; }

.pagination { margin-top: 15px; text-align: center; }
.pagination button { padding: 8px 12px; margin: 0 3px; border-radius: 6px; border: 2px solid var(--border); background: white; cursor: pointer; }
.pagination button:hover { border-color: var(--purple); color: var(--purple); }

.status-badge { padding: 4px 12px; border-radius: 12px; font-size: 0.8em; font-weight: 600; }
.status-pending { background: #fff3e0; color: #e65100; }
.status-active { background: #e8f5e9; color: #2e7d32; }
.status-disabled { background: #ffebee; color: #c62828; }

/* Quiz Selection Grid */
.quiz-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 20px 0;
}
.quiz-card {
  display: block;
  padding: 20px 25px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
}
.quiz-card.active:hover {
  border-color: var(--purple);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.quiz-card.locked {
  cursor: not-allowed;
  background: #fafafa;
  opacity: 0.7;
}
.quiz-card h3 { color: var(--purple); margin-bottom: 5px; font-weight: 600; }
.quiz-card p { color: var(--text-secondary); font-size: 0.9em; margin-bottom: 8px; }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8em;
  font-weight: 600;
}
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-yellow { background: #fff3e0; color: #e65100; }
.badge-red { background: #ffebee; color: #c62828; }
.badge-grey { background: #eceff1; color: #546e7a; }
.badge-blue { background: #e3f2fd; color: #1565c0; }

/* Header row */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-right: 80px;
}

/* Hint text */
.hint { font-size: 0.8em; color: var(--text-secondary); margin-top: 4px; }

/* Language toggle button */
.lang-toggle-btn {
  position: fixed;
  top: 15px;
  right: 15px;
  padding: 8px 16px;
  font-size: 0.85em;
  z-index: 200;
  background: white;
  border: 2px solid var(--border);
  border-radius: 8px;
}
.lang-toggle-btn:hover {
  border-color: var(--purple);
  color: var(--purple);
}

/* Responsive */
@media (max-width: 768px) {
  .split-container {
    flex-direction: column;
  }
  .split-left {
    padding: 40px 20px;
    min-height: 40vh;
  }
  .split-right {
    padding: 40px 20px;
  }
  .brand-title {
    font-size: 1.8em;
  }
  .brand-stats {
    gap: 20px;
  }
  .quiz-grid { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }
  #app { padding: 10px; }
}

/* Anti-cheat warning */
.warning {
  background: #fff3e0;
  color: #e65100;
  padding: 12px 16px;
  border-radius: 8px;
  margin: 10px 0;
  font-size: 14px;
  text-align: center;
  border-left: 4px solid #ff9800;
}

#quiz-countdown {
  font-size: 16px;
  font-weight: 600;
}

/* Dashboard summary */
.dashboard-summary {
  margin-bottom: 20px;
}
.dashboard-stats {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}
.stat-card {
  flex: 1;
  min-width: 120px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eaf6 100%);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  border: 1px solid #e0e0e0;
}
.stat-value {
  font-size: 28px;
  font-weight: bold;
  color: var(--purple);
}
.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Badge row */
.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Answer review */
.review-list {
  margin-top: 15px;
}
.review-item {
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 8px;
  border-left: 4px solid;
}
.review-correct {
  background: #e8f5e9;
  border-color: #4caf50;
}
.review-wrong {
  background: #ffebee;
  border-color: var(--red);
}
.review-item p {
  margin: 5px 0;
}

/* Quiz Container - Linux Academy Style */
.quiz-container {
  display: flex;
  min-height: calc(100vh - 40px);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--card-bg);
}

/* Quiz Sidebar */
.quiz-sidebar {
  width: 320px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8eaf6 100%);
  padding: 30px 25px;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  margin-bottom: 30px;
}

.sidebar-logo {
  max-width: 140px;
  max-height: 60px;
  object-fit: contain;
  margin-bottom: 20px;
}

.sidebar-title {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 15px;
  line-height: 1.3;
}

.progress-container {
  margin-top: 20px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-btn);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.85em;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Sidebar Content */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
  padding: 10px 0;
  border-bottom: 2px solid rgba(0,0,0,0.08);
  margin-bottom: 15px;
}

.section-icon {
  color: var(--purple);
  font-size: 0.8em;
}

.question-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
  font-size: 0.9em;
}

.nav-item:hover {
  border-color: var(--purple);
}

.nav-item.active {
  border-color: var(--purple);
  background: #e8eaf6;
}

.nav-item.completed {
  border-color: #4caf50;
}

.nav-item-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.nav-item.active .nav-item-icon {
  background: var(--purple);
  color: white;
}

.nav-item.completed .nav-item-icon {
  background: #4caf50;
  color: white;
}

.nav-item-text {
  flex: 1;
}

.nav-item-status {
  font-size: 0.75em;
  color: var(--text-secondary);
}

/* Sidebar Footer */
.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 2px solid rgba(0,0,0,0.08);
}

.timer-display, .countdown-display {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--purple);
  text-align: center;
  padding: 10px;
  background: white;
  border-radius: 8px;
}

.countdown-display {
  color: var(--red);
  margin-top: 10px;
}

/* Quiz Main Area */
.quiz-main {
  flex: 1;
  padding: 40px 50px;
  background: var(--card-bg);
  overflow-y: auto;
}

.quiz-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.quiz-question-count {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--purple);
}

.quiz-timer-inline {
  font-size: 1.1em;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Question Card */
.question-card {
  max-width: 700px;
}

.question-text {
  font-size: 1.5em;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 35px;
  line-height: 1.5;
}

/* Options Grid - Circle Style */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 30px 0;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 18px 20px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: white;
  cursor: pointer;
  text-align: left;
  font-size: 1em;
  transition: all 0.2s;
  width: 100%;
}

.option-btn:hover {
  border-color: var(--purple);
  background: #f5f7ff;
  transform: translateX(5px);
}

.option-btn.selected {
  border-color: var(--purple);
  background: #e8eaf6;
}

.option-btn.correct {
  border-color: #4caf50;
  background: #e8f5e9;
}

.option-btn.incorrect {
  border-color: var(--red);
  background: #ffebee;
}

.option-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f5f7fa;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9em;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all 0.2s;
}

.option-btn:hover .option-circle {
  border-color: var(--purple);
  background: var(--purple);
  color: white;
}

.option-btn.selected .option-circle {
  border-color: var(--purple);
  background: var(--purple);
  color: white;
}

.option-btn.correct .option-circle {
  border-color: #4caf50;
  background: #4caf50;
  color: white;
}

.option-btn.incorrect .option-circle {
  border-color: var(--red);
  background: var(--red);
  color: white;
}

.option-text {
  flex: 1;
  color: var(--text);
}

/* Quiz Actions */
.quiz-actions {
  margin-top: 30px;
  display: flex;
  gap: 15px;
}

.btn-gradient {
  background: var(--gradient-btn);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(229, 57, 53, 0.3);
}

/* Results Screen */
.score-display {
  font-size: 3em;
  font-weight: 700;
  margin: 20px 0;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-display.pass {
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-display.fail {
  background: linear-gradient(135deg, #e53935, #c62828);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Responsive for Quiz */
@media (max-width: 768px) {
  .quiz-container {
    flex-direction: column;
  }
  .quiz-sidebar {
    width: 100%;
    padding: 20px;
  }
  .sidebar-logo {
    max-width: 100px;
  }
  .question-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .nav-item {
    width: auto;
    padding: 8px 12px;
  }
  .quiz-main {
    padding: 25px 20px;
  }
  .question-text {
    font-size: 1.2em;
  }
  .option-btn {
    padding: 15px;
  }
  .option-circle {
    width: 32px;
    height: 32px;
  }
}

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: rgba(92, 107, 192, 0.1); }
th.sortable::after { content: " ↕"; opacity: 0.3; font-size: 0.8em; }

/* Two-zone branding panel */
.brand-upper { text-align: center; }
.brand-divider { border: none; border-top: 1px solid rgba(0,0,0,0.08); margin: 30px 0; width: 80%; }
.pentastic-credit { text-align: center; }
.pentastic-logo { max-width: 200px; width: 100%; height: auto; margin: 0 auto 12px; display: block; }
.pentastic-tagline { font-size: 0.85rem; color: #555; margin: 0 0 8px; }
.pentastic-lines { font-size: 0.8rem; color: #777; line-height: 1.6; margin: 0 0 8px; }
.pentastic-link { font-size: 0.8rem; color: #1a73e8; text-decoration: none; }
.pentastic-link:hover { text-decoration: underline; }
