/* iQuiz - Core Stylesheet (Unified Arch Dark Theme) */
:root {
  --bg-color: #0d1117;
  --card-bg: #161b22;
  --card-subtle: #21262d;
  --header-bg: #161b22;
  --border-color: #30363d;
  --border-muted: #21262d;
  --text-color: #f0f6fc;
  --text-muted: #8b949e;
  --accent-color: #00d2d3;
  --accent-hover: #00b5b6;
  --success-color: #238636;
  --success-hover: #2ea043;
  --danger-color: #da3633;
  --danger-hover: #f85149;
  --warning-color: #d29922;
  --warning-hover: #e3b341;
  --info-color: #38bdf8;
  --secondary-color: #30363d;
  --secondary-hover: #3c444d;

  /* Kahoot vibrant answer palette */
  --ans-a: #f1c40f;
  --ans-b: #e74c3c;
  --ans-c: #e67e22;
  --ans-d: #2ecc71;
  --ans-e: #3498db;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.iquiz-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
}

/* Header & Navigation */
.iquiz-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.iquiz-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-color);
}

.iquiz-header .badge-pin {
  background: #21262d;
  color: var(--accent-color);
  border: 1px solid var(--border-color);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 2px;
}

/* Cards & Containers */
.card {
  background: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Typography & Form Elements */
label {
  color: var(--text-color);
  font-weight: 600;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="file"],
select,
textarea {
  background-color: #0d1117;
  color: #f0f6fc;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 210, 211, 0.2);
}

select {
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.btn-primary {
  background-color: var(--accent-color);
  color: #0d1117;
  border-color: var(--accent-color);
  font-weight: 700;
}
.btn-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #0d1117;
}

.btn-success {
  background-color: var(--success-color);
  color: #ffffff;
  border-color: rgba(240, 246, 252, 0.1);
}
.btn-success:hover {
  background-color: var(--success-hover);
}

.btn-danger {
  background-color: var(--danger-color);
  color: #ffffff;
  border-color: rgba(240, 246, 252, 0.1);
}
.btn-danger:hover {
  background-color: var(--danger-hover);
}

.btn-secondary {
  background-color: #21262d;
  color: var(--text-color);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: #30363d;
  border-color: #8b949e;
}

.btn-outline {
  background-color: transparent;
  color: var(--accent-color);
  border-color: var(--accent-color);
}
.btn-outline:hover {
  background-color: rgba(0, 210, 211, 0.15);
}

.btn-block {
  display: flex;
  width: 100%;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

table.iquiz-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  color: var(--text-color);
  font-size: 0.95rem;
}

table.iquiz-table th {
  background-color: #21262d;
  color: var(--text-color);
  padding: 0.9rem 1rem;
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
}

table.iquiz-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: #c9d1d9;
}

table.iquiz-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

/* Projector Amphitheater Layout */
.projector-body {
  background-color: #090d13;
  color: #f0f6fc;
}

.projector-header {
  background: #161b22;
  padding: 1rem 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--border-color);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.projector-header .quiz-info {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
}

.projector-header .pin-display {
  background: #b92b27;
  color: #ffffff;
  padding: 0.5rem 1.6rem;
  border-radius: 10px;
  font-size: 2.1rem;
  font-weight: 900;
  letter-spacing: 4px;
  box-shadow: 0 4px 12px rgba(185, 43, 39, 0.4);
}

.projector-main {
  padding: 2rem 2.5rem 120px 2.5rem;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

.question-box {
  background: #161b22;
  border: 2px solid #30363d;
  border-radius: 16px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.question-title {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.35;
  color: #ffffff;
}

.timer-bar-container {
  width: 100%;
  height: 16px;
  background-color: #21262d;
  border-radius: 8px;
  margin-bottom: 2rem;
  overflow: hidden;
  border: 1px solid #30363d;
}

.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
  width: 100%;
  transition: width 1s linear;
}

/* Choices Grid */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.answer-card {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  border-radius: 12px;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  border: 3px solid transparent;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.answer-card.choice-A { background-color: #b78103; }
.answer-card.choice-B { background-color: #b92b27; }
.answer-card.choice-C { background-color: #c05621; }
.answer-card.choice-D { background-color: #276749; }
.answer-card.choice-E { background-color: #2b6cb0; }

.answer-card.is-correct {
  border-color: #2ecc71 !important;
  box-shadow: 0 0 25px rgba(46, 204, 113, 0.8) !important;
  transform: scale(1.02);
}

.answer-card.dimmed {
  opacity: 0.35;
}

.answer-card .choice-letter {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 50%;
  font-size: 1.6rem;
  font-weight: 900;
  margin-right: 1.2rem;
  flex-shrink: 0;
}

/* Stats Counter Box */
.counter-box {
  display: flex;
  justify-content: space-around;
  background: #161b22;
  padding: 1.1rem 2rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.counter-item {
  text-align: center;
}
.counter-value {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--accent-color);
}
.counter-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

/* Adaptive Pedagogical Feedback Banner */
.feedback-banner {
  padding: 1.35rem 2rem;
  border-radius: 12px;
  margin: 1.5rem 0;
  font-size: 1.6rem;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  border: 2px solid transparent;
  animation: slideDown 0.35s ease;
}

.feedback-banner.success {
  background: rgba(35, 134, 54, 0.25);
  border-color: #238636;
  color: #3fb950;
}

.feedback-banner.info {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #7dd3fc;
}

.feedback-banner.warning {
  background: rgba(210, 153, 34, 0.25);
  border-color: #d29922;
  color: #e3b341;
}

.feedback-banner.danger {
  background: rgba(218, 54, 51, 0.25);
  border-color: #da3633;
  color: #f85149;
}

/* Kahoot Vertical Bar Chart */
.vertical-chart-container {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  height: 320px;
  gap: 1.5rem;
  padding: 1.75rem 1.5rem;
  background: #0d1117;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  margin-top: 1.5rem;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.v-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  justify-content: flex-end;
}

.v-bar-track {
  width: 100%;
  max-width: 90px;
  height: 220px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid #30363d;
}

.v-bar-fill {
  width: 100%;
  border-radius: 8px 8px 0 0;
  transition: height 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-height: 6px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.v-bar-fill.A { background-color: var(--ans-a); }
.v-bar-fill.B { background-color: var(--ans-b); }
.v-bar-fill.C { background-color: var(--ans-c); }
.v-bar-fill.D { background-color: var(--ans-d); }
.v-bar-fill.E { background-color: var(--ans-e); }

.v-bar-fill.is-correct-bar {
  box-shadow: 0 0 20px rgba(46, 204, 113, 0.9);
  border: 2px solid #ffffff;
}

.v-bar-count {
  font-size: 1.4rem;
  font-weight: 800;
  color: #f0f6fc;
  margin-bottom: 0.3rem;
}

.v-bar-pct {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.v-bar-label {
  width: 100%;
  max-width: 90px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 900;
  padding: 0.45rem 0;
  border-radius: 8px;
  margin-top: 0.6rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.v-bar-label.A { background-color: #b78103; }
.v-bar-label.B { background-color: #b92b27; }
.v-bar-label.C { background-color: #c05621; }
.v-bar-label.D { background-color: #276749; }
.v-bar-label.E { background-color: #2b6cb0; }

.v-bar-correct-badge {
  display: inline-block;
  background: #238636;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
  letter-spacing: 0.5px;
}

/* Controls Dock */
.controls-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(12px);
  padding: 1rem 2.5rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  border-top: 1px solid var(--border-color);
  z-index: 100;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
}

/* Leaderboard */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  background: #161b22;
  border-radius: 12px;
  overflow: hidden;
  font-size: 1.35rem;
  border: 1px solid var(--border-color);
}

.leaderboard-table th {
  background: #21262d;
  color: var(--accent-color);
  padding: 1.2rem;
  text-align: left;
  border-bottom: 2px solid var(--border-color);
}

.leaderboard-table td {
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--border-color);
}

.leaderboard-table tr:nth-child(1) td {
  background: rgba(241, 196, 15, 0.12);
  font-weight: bold;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Results 2-Column Responsive Layout */
.results-layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

#section-question .answers-grid .answer-card.choice-E {
  grid-column: span 2;
}

@media (min-width: 1024px) {
  .results-layout-grid {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.5rem;
    align-items: stretch;
  }
  .results-layout-grid #proj-results-qcard,
  .results-layout-grid #proj-chart-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
  }
  .results-layout-grid #proj-results-answers-grid {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 0;
  }
  .results-layout-grid #proj-results-answers-grid .answer-card {
    padding: 0.75rem 1rem;
    font-size: 1.15rem;
    border-radius: 10px;
    width: 100%;
  }
  .results-layout-grid #proj-results-answers-grid .answer-card .choice-letter {
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    margin-right: 0.85rem;
  }
  .results-layout-grid .vertical-chart-container {
    flex: 1;
    margin-top: 0.5rem;
    height: 320px;
    padding: 1.2rem 1rem;
  }
}

/* Laptop Viewports (1366x768, 1440x900) & Amphitheater Projector Screen Optimization */
@media (max-height: 920px), (max-width: 1440px) {
  .projector-header {
    padding: 0.6rem 2rem;
  }
  .projector-header .quiz-info {
    font-size: 1.25rem;
  }
  .projector-header .pin-display {
    font-size: 1.6rem;
    padding: 0.35rem 1.2rem;
    letter-spacing: 2px;
  }
  .projector-main {
    padding: 1.2rem 1.8rem 100px 1.8rem;
  }
  .counter-box {
    padding: 0.55rem 1.5rem;
    margin-bottom: 0.9rem;
  }
  .counter-value {
    font-size: 1.7rem;
  }
  .counter-label {
    font-size: 0.8rem;
    letter-spacing: 0.5px;
  }
  .timer-bar-container {
    height: 10px;
    margin-bottom: 0.9rem;
  }
  .question-box {
    padding: 1.2rem 1.8rem;
    margin-bottom: 0.9rem;
  }
  .question-title {
    font-size: 1.65rem;
    line-height: 1.3;
  }
  .answers-grid {
    gap: 0.85rem;
    margin-bottom: 0.9rem;
  }
  .answer-card {
    padding: 0.85rem 1.2rem;
    font-size: 1.15rem;
    border-radius: 10px;
  }
  .answer-card .choice-letter {
    width: 38px;
    height: 38px;
    font-size: 1.25rem;
    margin-right: 0.9rem;
  }
  .feedback-banner {
    padding: 0.75rem 1.5rem;
    margin: 0.75rem 0;
    font-size: 1.25rem;
  }
  .results-layout-grid {
    gap: 1rem;
  }
  .results-layout-grid #proj-results-answers-grid .answer-card {
    padding: 0.55rem 0.85rem;
    font-size: 1.05rem;
  }
  .results-layout-grid #proj-results-answers-grid .answer-card .choice-letter {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    margin-right: 0.75rem;
  }
  .results-layout-grid .vertical-chart-container {
    height: 250px;
    padding: 0.85rem;
  }
  .results-layout-grid .v-bar-track {
    max-width: 65px;
    height: 155px;
  }
  .vertical-chart-container {
    height: 220px;
    padding: 1rem;
    margin-top: 0.9rem;
    gap: 1rem;
  }
  .v-bar-track {
    max-width: 70px;
    height: 140px;
  }
  .v-bar-count {
    font-size: 1.15rem;
  }
  .v-bar-label {
    max-width: 70px;
    font-size: 1.2rem;
    padding: 0.35rem 0;
  }
  .controls-dock {
    padding: 0.65rem 1.5rem;
    gap: 0.9rem;
  }
  .controls-dock .btn {
    padding: 0.45rem 0.9rem;
    font-size: 0.9rem;
  }
}
