/* ============================================================
   CUBES CONTAINER
   ============================================================ */
#super-cubes-container {
  padding: 1.8em 0.5em 1em 0.5em;
  display: flex;
  flex-flow: row nowrap;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  transition: background-color 0.3s ease;
}

/* ============================================================
   CUBE — each nav item: [3D cube] [title + desc]
   Uses flex row wrap so the module list drops to a new line
   ============================================================ */
.cube {
  flex: 1 1 0;
  max-width: 200px;
  min-width: 0;
  cursor: pointer;
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  padding: 0.5em 0.6em;
  border-radius: 6px;
  transition: opacity 0.3s ease, transform 0.2s ease, background 0.3s ease;
}

.cube:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   CUBE 3D CONTAINER — sized to fit the isometric cube exactly.
   --side: 15px → visual footprint ≈ 26 × 30 px. No scale needed.
   ============================================================ */
.cube-container {
  width: 36px;
  height: 36px;
  min-width: 36px;
  position: relative;
  margin-right: 6px;
}

/* Offset sides down so the 3D visual is vertically centered */
.cube-container .cube-side {
  top: 7px;
}

/* ============================================================
   CUBE SIDES — isometric 3D, natively small (no scale hack)
   ============================================================ */
.cube-side {
  --side: 22px;
  width: var(--side);
  height: var(--side);
  line-height: var(--side);
  position: absolute;
  text-align: center;
  font-size: 0;
  font-weight: bold;
  transition: border-color 0.3s ease;
}

.cube-top-side {
  border: 1px solid var(--black-second-color);
  background-color: var(--yellow-color);
  transform: rotate(-45deg) skew(15deg, 15deg) translate(50%, -50%);
}

.cube-left-side {
  border: 1px solid var(--black-second-color);
  background-color: var(--yellow-second-color);
  transform: rotate(15deg) skew(15deg, 15deg) translate(-50%, 50%);
}

.cube-right-side {
  border: 1px solid var(--black-second-color);
  background-color: var(--yellow-color);
  transform: rotate(-15deg) skew(-15deg, -15deg) translate(50%, 50%);
}

/* ============================================================
   CUBE INFO — title, description, module list
   ============================================================ */
.cube-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  color: white;
}

.cube-info-title {
  font-size: clamp(11px, 1.6vw, 14px);
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.cube-info-desc {
  margin: 0;
  font-size: clamp(8px, 1.2vw, 11px);
  opacity: 0.5;
  font-style: italic;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.3s ease;
  max-height: 18px;
}

/* Section progress bar inside each cube */
.cube-progress {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-top: 3px;
  overflow: hidden;
}

.cube-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--yellow-color);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.cube-progress-fill[data-complete="true"] {
  background: #4caf50;
}

/* Module list — full width row below cube+title, visible on all cubes */
.cube-info-list {
  flex-basis: 100%;
  margin: 2px 0 0 0;
  padding: 0 0 0 0;
  list-style: none;
  max-height: 80px;
  overflow: hidden;
  opacity: 0.4;
  transition: opacity 0.3s ease;
}

.cube.cube-active .cube-info-list {
  opacity: 0.7;
}

.cube-info-list-item {
  font-size: clamp(8px, 1.1vw, 10px);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   ACTIVE CUBE — lid hidden, title highlights
   ============================================================ */
.cube.cube-active .cube-top-side {
  opacity: 0;
}

.cube.cube-active .cube-info-title {
  color: var(--yellow-color);
}

/* ============================================================
   STICKY NAV — compact single row, title only
   ============================================================ */
.cubes-sticky #super-cubes-container {
  padding: 0.6em 0;
  gap: 0;
}

.cubes-sticky .cube {
  padding: 0.35em 0.4em;
  opacity: 0.5;
  border-radius: 0;
  background: none;
  flex-flow: row nowrap;
}

.cubes-sticky .cube:hover {
  opacity: 1;
  background: none;
}

.cubes-sticky .cube.cube-active {
  opacity: 1;
}

/* Smaller cube in sticky */
.cubes-sticky .cube-container {
  width: 24px;
  height: 28px;
  min-width: 24px;
  margin-right: 4px;
}

.cubes-sticky .cube-side {
  --side: 14px;
}

.cubes-sticky .cube-info-title {
  font-size: 11px;
  font-family: monospace;
  color: var(--white-second-color);
  transition: color 0.2s ease;
}

.cubes-sticky .cube:hover .cube-info-title,
.cubes-sticky .cube.cube-active .cube-info-title {
  color: var(--yellow-color);
}

/* Hide desc, progress bar and list in sticky */
.cubes-sticky .cube-info-desc {
  max-height: 0;
  opacity: 0;
}

.cubes-sticky .cube-progress {
  display: none;
}

.cubes-sticky .cube-info-list {
  max-height: 0 !important;
  opacity: 0 !important;
}

.cubes-sticky .cube.cube-active .cube-left-side,
.cubes-sticky .cube.cube-active .cube-right-side {
  border-color: var(--yellow-color);
}

/* Sticky search button */
.sticky-search-btn {
  display: none;
}

.cubes-sticky .sticky-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 1em;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 1px solid #555;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--white-second-color);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  z-index: 2;
}

.cubes-sticky .sticky-search-btn:hover {
  color: var(--yellow-color);
  border-color: var(--yellow-color);
  background: rgba(255, 221, 0, 0.08);
}

.cubes-sticky .sticky-search-btn .material-icons {
  font-size: 18px;
}

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] .cube-info {
  color: #ccc;
}

[data-theme="dark"] .cube-info-title {
  color: #ddd;
}

[data-theme="dark"] .cube.cube-active .cube-info-title {
  color: var(--yellow-color);
}

[data-theme="dark"] .cube-info-desc {
  color: #888;
}

[data-theme="dark"] .cube-side {
  border-color: #444;
}

[data-theme="dark"] .cube-top-side {
  background-color: var(--yellow-color);
  border-color: #555;
}

[data-theme="dark"] .cube-left-side {
  background-color: var(--yellow-second-color);
  border-color: #555;
}

[data-theme="dark"] .cube-right-side {
  background-color: var(--yellow-color);
  border-color: #555;
}

[data-theme="dark"] .cubes-sticky .cube-info-title {
  color: #888;
}

[data-theme="dark"] .cubes-sticky .cube:hover .cube-info-title,
[data-theme="dark"] .cubes-sticky .cube.cube-active .cube-info-title {
  color: var(--yellow-color);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
  .cube-info-title {
    font-size: 10px;
  }

  .cube-info-desc {
    font-size: 8px;
  }

  .cubes-sticky .cube-info-title {
    font-size: 9px;
  }

  .cubes-sticky .sticky-search-btn {
    width: 28px;
    height: 28px;
    left: 0.5em;
  }

  .cubes-sticky .sticky-search-btn .material-icons {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  #super-cubes-container {
    gap: 0;
  }

  .cube {
    padding: 0.2em 0.3em;
  }

  .cube-info-desc {
    display: none;
  }

  .cube-info-title {
    font-size: 9px;
  }

  .cubes-sticky .cube-info {
    max-height: 0;
    opacity: 0;
    padding: 0;
  }

  .cubes-sticky .sticky-search-btn {
    position: static;
    transform: none;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    margin: auto 0.3em;
  }
}
