/* === General Setup === */

body {
  font-family: "Segoe UI", sans-serif;
  background-color: #f0f8ff;
  margin: 0;
  padding: 20px;
  min-width: 320px;
  position: relative;
  z-index: 0;
}

/* Background pattern */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background-color: #f2cde2;
  background-repeat: url("/static/assets/background-pattern.png");
}

body {
  opacity: 0;
  transition: opacity 0.4s ease;
}

body.revealed {
  opacity: 1;
}

/* === Layout Containers === */
.container {
  min-width: 280px;
  max-width: 480px;
  margin: auto;
  padding: 20px;
  background: #f0f8ff;
  border: 1.5px dashed #d07fae;
  border-radius: 12px;
}

#gameLobby {
  transform-origin: top center;
}

@media (max-width: 400px) {
  #gameLobby {
    transform: scale(0.95);
  }
}

/* === Headings === */
h2.section-label {
  margin: 0;
  font-weight: bold;
  color: #a44a76;
  text-align: center;
}

/* === Filters & Inputs === */
.filterBar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 400px;
  margin: 0 auto 20px;
}

#filters {
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

#filters input[type="text"],
input.teacher-email,
input.teacher-pass,
#searchInput,
#join-code,
input[type="text"] {
  border: 1px solid #d07fae;
  border-radius: 10px;
  padding: 8px 10px;
  color: #555;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  width: 100%;
  margin-top: 10px;
  font-size: 1em;
  box-sizing: border-box;
  outline: none;
  background: #fff;
}

/* Remove blue focus ring */
input:focus,
textarea:focus,
select:focus {
  outline: none;
  box-shadow: none;
}

/* Base level filter */
.level-filter {
  flex: 1 1 0;
  text-align: center;
  border: 1px solid #d07fae;
  border-radius: 10px;
  padding: 4px 6px;
  font-size: 0.8em;
  color: #888;
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  background: #fff;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

/* Active state */
.level-filter.active {
  background: #d07fae;
  color: white;
  border-color: #d07fae;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Desktop-only hover: deeper shadow + slight lift */
@media (hover: hover) and (pointer: fine) {
  .level-filter:hover {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transform: scale(1.04);
  }
}

/* Mobile: no hover effects */
@media (hover: none) and (pointer: coarse) {
  .level-filter:hover:not(.active),
  .level-filter:active:not(.active) {
    background: #fff !important; /* revert to default, not 'none' */
    color: #888 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  .level-filter {
    transition: none !important;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
}
/* === Topic Tiles === */
#topicGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  min-height: 290px;
}

#topicGrid.hidden {
  visibility: hidden; /* it still takes up its height/width */
  opacity: 0; /* invisible, but in the layout */
  pointer-events: none; /* optional */
}

#topicGrid.visible {
  opacity: 1;
  min-height: 0px;
}

#topicGrid.loaded {
  visibility: visible;
  opacity: 1;
  transition: opacity 0.4s ease;
  min-height: 0px;
}

@media (max-width: 552px) {
  #topicGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 553px) {
  #topicGrid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tile-text {
  display: block; /* or inline-block */
  white-space: nowrap; /* no wrapping */
  overflow: hidden; /* clip overflow */
  text-overflow: ellipsis; /* show "..." */
}

@keyframes fadeInContent {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tile-content {
  opacity: 0; /* hide initially */
}

.tile-content.cascade-animate,
.control-bar.cascade-animate {
  animation-name: fadeInContent;
  animation-duration: 0.6s;
  animation-fill-mode: forwards;
  animation-timing-function: ease;
}
.topic-tile {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 90px;
  min-height: 90px;
  background: #ffe7ef;
  border: 1.5px dashed #d07fae;
  border-radius: 12px;
  padding: 10px;
  text-align: center;
  color: #a44a76;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  transition: transform 0.2s ease, box-shadow 0.2s, height 0.2s ease,
    opacity 0.2s ease;
}

.control-bar {
  display: flex;
  opacity: 0;
}

.control-bar {
  position: absolute;
  bottom: 6px;
  margin-left: 5px;
  margin-right: 5px;
  width: 90%;
  justify-content: space-between;
  gap: 7px;
  z-index: 1;
  pointer-events: auto;
}

/* Target tile content only inside teacher-view grid */
.topic-tile {
  display: flex;
  flex-direction: column;
  align-items: space-between;
  padding-bottom: 32px; /* match control bar height */
  position: relative;
  min-height: 90px;
  z-index: 2;
}

.topic-author {
  background: #d07faea8;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px; /* tweak until it’s about 15 chars */
}

@media (hover: hover) and (pointer: fine) {
  .topic-tile:hover {
    transform: scale(1.03);
  }
}

/* === Join Game === */

.or-divider {
  height: 1.5px;
  background-color: #d07fae; /* or a softer shade if preferred */
  margin: 10px 0;
  width: 100%;
  opacity: 0.5;
}

@media (hover: hover) and (pointer: fine) {
  #selectTopicBtn:hover,
  #join-btn:hover,
  #closeModal,
  #closeShareModal :hover {
    transform: scale(1.01);
  }
}
@media (hover: hover) and (pointer: fine) {
  #closeModal.close-button:hover,
  #closeShareModal.close-button:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    color: #a44a76;
  }
}

.topic-tile:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* === Pagination === */
#pagination {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 2px;
  margin-bottom: 10px;
  margin-top: 20px;
  min-height: 20px;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#pagination .arrow-btn {
  font-size: 12px;
  color: #888;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, color 0.2s ease;
}

#pagination .arrow-btn.active {
  opacity: 1;
  pointer-events: auto;
}

#pagination .page-number {
  font-size: 0.8em;
  color: #888;
  cursor: pointer;
  padding: 2px 4px;
  margin: 0 2px;
  border-radius: 4px;
  user-select: none;
  transition: background 0.2s ease, color 0.2s ease;
}

#pagination .page-number:hover,
#pagination .arrow-btn:hover {
  background: rgba(212, 127, 174, 0.2);
  color: #a44a76;
}

#pagination .active-page,
#pagination .active-page:hover {
  background: #d07fae;
  color: white;
  cursor: default;
}

/* === Modal === */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal.show {
  opacity: 1;
}

.modal-content {
  background: #fff7fb;
  border-radius: 12px;
  padding: 20px;
  max-width: 380px;
  min-width: 300px;
  margin: 40px;
  text-align: left;
  color: #a44a76;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transform: scale(0.95);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: relative;
}

.modal.show .modal-content {
  opacity: 1;
  transform: scale(1);
}

.modal-content h2 {
  margin-top: 0;
  text-align: center;
}

.modal-content p {
  margin-bottom: 10px;
}

.modal-content ul {
  list-style: disc;
  padding-left: 20px;
  margin: 10px 0;
}

.modal-content button {
  margin-top: 10px;
}

.modal-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 20px;
  position: relative;
}

.modal-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between; /* badges on left, button on right */
  gap: 12px; /* spacing between badges & button */
  margin-top: 1em; /* a bit of breathing room */
  width: 100%;
}

#modalTitle {
  flex: 1;
  margin: 10px 0 0;
  text-align: center;
}

.close-button {
  position: absolute;
  top: -12px;
  right: -12px;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 20px;
  height: 20px;
  font-size: 1.5em;
  color: #d07fae;
  border-radius: 6px;
  padding-bottom: 2px;
  transform: scale(0.97);
  transition: transform 0.1s ease;
  cursor: pointer;
  z-index: 10;
}

/* === Misc === */
.hidden {
  display: none !important;
}

.error {
  /* we'll drive these from JS + the --full-height var */
  --full-height: 0px;

  display: block; /* always in flow, but collapsed */
  height: 0; /* start collapsed */
  overflow: hidden;
  opacity: 0; /* fully transparent */
  margin-top: 0; /* no gap */
  padding: 0; /* no padding */

  /* styling */
  background: #ffd4d487;
  color: #d20000;
  border: 1px solid #c40000;
  border-radius: 10px;
  font-size: 1rem;
  line-height: normal;
  text-align: center;

  /* unified transitions */
  transition: height 0.4s ease, opacity 0.3s ease, margin-top 0.4s ease,
    padding 0.4s ease;
}

/* the "visible" state */
.error.visible {
  height: var(--full-height);
  opacity: 1;
  margin-top: 10px;
  padding: 10px 12px;
}
#levelFilters {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 20px;
  width: 100%;
}

#levelFilters label,
#tagFilters label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  cursor: pointer;
}

.topic-tile.shimmer {
  background-color: #ffe7ef;
  background-image: linear-gradient(
    130deg,
    rgba(255, 255, 255, 0) 30%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0) 70%
  );
  background-size: 300% 100%;
  background-repeat: no-repeat;
  border: 1.5px dashed #d07fae;
  border-radius: 12px;
  height: 90px;
  padding: 10px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  color: transparent;
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  will-change: background-position, opacity;
  opacity: 1;

  /* 👇 Combined shimmer + fadeIn */
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: -100% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.topic-tile.shimmer::after {
  content: "Topic Title";
  visibility: hidden;
  font-size: 1em;
  font-family: "Segoe UI", sans-serif;
  line-height: 1.2;
  display: block;
}

.teacher-login-box {
  text-align: center;
  margin-top: 20px;
}

.teacher-login-box p {
  font-weight: bold;
  color: #a44a76;
  margin-bottom: 8px;
}

/* Container stays the same */
.auth-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  flex: 1; /* each button grows to fill the container evenly */
  min-width: 120px;
}

/* Style each “tab” button */
#teacher-auth-buttons .tab {
  background-color: #d07fae;
  color: white;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 1em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease, background-color 0.3s ease;
}

/* Hover state for inactive tabs */
#teacher-auth-buttons .tab:hover:not(.active) {
  background-color: #a44a76;
}

/* Active tab state */
#teacher-auth-buttons .tab.active {
  background-color: #a44a76; /* darker background */
  transform: translateY(-2px); /* subtle “lift” */
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  font-size: 1rem !important; /* match your regular input font-size */
  line-height: 1.2 !important;
  -webkit-text-fill-color: #000 !important;
  /* preserve your white background from earlier */
  background-color: #fff !important;
  -webkit-box-shadow: 0 0 0px 1000px #fff inset !important;
}

#verification-step {
  display: block;
  opacity: 1; /* default visible */
  transition: opacity 0.4s ease;
}

.fade-in {
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}

.fade-out {
  opacity: 1;
  animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
  }
}

.verify-info-text {
  font-size: 0.9rem;
  line-height: 1.3;
  color: #555;
  padding: 4px 16px;
  margin-bottom: 5px;
  font-family: "Segoe UI", sans-serif;
  /* NEW: vertical bar */
  border-left: 3px solid #a44a76;
  padding-left: 12px; /* make room for the bar */
}

@media not all and (min-resolution: 0.001dpcm) {
  @supports (-webkit-appearance: none) and (stroke-color: transparent) {
    .topic-tile,
    .container {
      border-style: solid !important;
    }
  }
}

.expiry-note {
  font-size: 0.8rem;
  margin-top: 0px;
  margin-bottom: 5px;
}

#previewModal.hidden {
  display: none;
  opacity: 0;
}

/* by default the (hidden) modal never catches the pointer */
#previewModal {
  pointer-events: none;
}

/* when it’s “shown” you want it interactive again */
#previewModal.show {
  pointer-events: all;
}
