/* =========================================================================
   QCM — Styles for the quiz end-user pages
   Ported from exemple/css/men.css, sh.css, and inline alert styles
   ========================================================================= */

/* --- CSS Custom Properties (overridden per-level in template) --- */
:root {
  --qcm-head: #171717;
  --qcm-head-dark: #0a0a0a;
  --qcm-bg: #ccccff;
  --qcm-fd: none;
  --main-position: 80px;
  --div-gen-visi: inline-block;
}

/* --- Base page --- */
body.qcm-page {
  color: rgb(0, 0, 0);
  background-color: var(--qcm-bg);
  background-image: var(--qcm-fd);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  margin: 10px;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
}

/* =========================================================================
   Dropdown menu
   ========================================================================= */

.qcm-menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 18;
}

/* --- Top bar --- */
.qcm-menu-bar > ul {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--qcm-head-dark);
  height: 28px;
  width: 100%;
  border-bottom: 2px solid var(--qcm-head);
}

.qcm-menu-bar > ul > li {
  display: inline;
  position: relative;
  float: left;
}

.qcm-menu-bar > ul > li > a {
  display: block;
  float: left;
  height: 28px;
  line-height: 28px;
  padding: 0 20px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  font-weight: normal;
  font-size: 14px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  transition: color 0.2s, background-color 0.2s;
}

.qcm-menu-bar > ul > li:first-child > a,
.qcm-menu-bar > ul > li:first-child > span {
  border-left: none;
}

.qcm-menu-bar > ul > li > a:hover,
.qcm-menu-bar > ul > li:hover > a {
  color: #ffffff;
  background: var(--qcm-head);
}

/* --- Home link --- */
.qcm-menu-bar .qcm-home > a {
  font-weight: bold;
}

/* --- Level name badge --- */
.qcm-menu-bar .qcm-niv-name > span {
  display: block;
  float: left;
  height: 28px;
  line-height: 28px;
  padding: 0 16px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- Dropdown sub-menus --- */
.qcm-menu-bar li ul {
  margin: 0;
  padding: 5px 0;
  position: absolute;
  top: 28px;
  left: 0;
  width: 260px;
  display: block;
  list-style: none;
  background: var(--qcm-head-dark);
  border: 1px solid var(--qcm-head);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.qcm-menu-bar li:hover ul {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.qcm-menu-bar li ul li {
  display: block;
  float: none;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
}

.qcm-menu-bar li ul li a {
  display: block;
  float: none;
  height: auto;
  padding: 7px 16px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: color 0.15s, background-color 0.15s, padding-left 0.2s;
}

.qcm-menu-bar li ul li:last-child > a {
  border-bottom: none;
}

.qcm-menu-bar li ul li a:hover {
  color: #ffffff;
  background: var(--qcm-head);
  padding-left: 22px;
}

.qcm-menu-bar:hover ~ .qcm-content select:focus {
  display: none;
}

/* =========================================================================
   Content area — ported from sh.css
   ========================================================================= */

.qcm-content {
  position: absolute;
  display: var(--div-gen-visi);
  top: var(--main-position);
  left: 40px;
  right: 80px;
  height: 800px;
  transition: opacity 0.3s;
}

.qcm-content.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#qcm-img-container {
  position: absolute;
  z-index: 0;
  left: 50px;
  top: 10px;
}

#qcm-img-container img {
  font-weight: bold;
  font-style: italic;
  color: rgb(51, 0, 153);
  animation: qcm-fade-in 0.3s ease-out;
}

/* --- Verify button area --- */
#qcm-check-area {
  position: absolute;
  width: 100%;
  left: 300px;
  top: 650px;
}

.qcm-check-btn {
  background-color: var(--qcm-head);
  border: none;
  color: white;
  padding: 6px 5px;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 12px;
  margin: 1px 1px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s;
}

.qcm-check-btn:hover {
  transform: scale(1.05);
}

.qcm-check-btn:active {
  transform: scale(0.97);
}

/* --- Close button --- */
#qcm-close {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 20;
}

.qcm-close-btn {
  background-color: var(--qcm-head);
  border: none;
  color: white;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.15s;
}

.qcm-close-btn:hover {
  transform: scale(1.1);
}

.qcm-close-btn:active {
  transform: scale(0.95);
}

/* --- Question labels --- */
p.qcm-what {
  font-weight: bold;
  font-style: italic;
  color: var(--qcm-head);
  font-size: 10pt;
  font-family: Arial;
}

.qcm-select {
  font-size: 10pt;
  font-family: Arial;
}

/* --- Label positioning containers (generated dynamically) --- */
.qcm-label {
  position: absolute;
  z-index: 10;
}

/* =========================================================================
   Custom alert — ported from new_alert.js
   ========================================================================= */

.qcm-alert-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.35);
}

.qcm-alert-box {
  position: fixed;
  z-index: 10000;
  overflow: hidden;
  left: 50%;
  top: 50%;
  width: 360px;
  min-height: 160px;
  max-height: 480px;
  margin-left: -180px;
  border: 2px solid var(--qcm-head);
  background-color: #ffffff;
  font-family: sans-serif;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  animation: qcm-alert-in 0.25s ease-out;
}

.qcm-alert-title {
  display: block;
  width: 100%;
  height: 32px;
  line-height: 32px;
  text-align: center;
  background-color: var(--qcm-head-dark);
  font-size: 16px;
  color: #ffffff;
  font-weight: bold;
}

.qcm-alert-close {
  position: absolute;
  cursor: pointer;
  z-index: 10001;
  right: 2px;
  top: 2px;
  background: none;
  border: none;
  color: #ffffff;
  font-size: 18px;
  font-weight: bold;
  padding: 0 6px;
  line-height: 28px;
}

.qcm-alert-content {
  display: block;
  width: 352px;
  min-height: 120px;
  margin: 4px;
  font-size: 14px;
  overflow: auto;
}

/* =========================================================================
   Video player
   ========================================================================= */

.qcm-player {
  position: absolute;
  top: 20px;
  left: 40px;
}

.qcm-player video {
  max-width: 90vw;
  max-height: 80vh;
}

/* =========================================================================
   Keyframes
   ========================================================================= */

@keyframes qcm-alert-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes qcm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* =========================================================================
   Accessibility: respect user motion preferences
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
