/* =========================
   BASE.CSS
   Global defaults only
   ========================= */

/* ---------- CSS VARIABLES ---------- */
:root {
  --space-xs: 5px;
  --space-sm: 10px;
  --space-md: 20px;
  --space-lg: 30px;
}

/* ---------- RESET / GLOBAL ---------- */
* {
  box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;

    /* Background image */
    background-image: url('../images/background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.container {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(2px);
}

/* Remove default margins globally */
h1, h2, h3, p {
  margin: 0;
}

/* ---------- TYPOGRAPHY ---------- */
p.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 25px;
}

/* ---------- INPUTS (BASE ONLY) ---------- */
label {
  font-weight: 600;
  display: block;
  margin-top: var(--space-md);
}

input[type="number"] {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 14px;
}

/* ---------- RANGE SLIDER ---------- */
/* ================= SLIDER LAYOUT ================= */

.slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* Make slider longer if needed */
.slider-container input[type="range"] {
    width: 300px;
    max-width: 60vw;
}

/* Number UNDER slider, centered */
.slider-value {
    text-align: center;
    font-weight: 600;
    font-size: 14px;
}

/* ---------- BUTTON BASE ---------- */
button {
  font-family: inherit;
}

/* ---------- CATEGORY BUTTON ---------- */
.category-btn {
  width: 100%;
  margin-top: var(--space-sm);
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #FDFDFD;
  color: #6CA1C6;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
}

.category-btn:hover {
  background: #C0C0C0;
}

/* ---------- WORKSHEET DROPDOWN ---------- */
.worksheet-buttons {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin: 30px 0;
    width: 100%;
    align-items: stretch;

    position: relative; /* allows dropdown to span full row */
}
.worksheet-btn,
#generateBtn,
.generate-wrapper {
    flex: 1;
    min-width: 0;
}

.worksheet-btn,
#generateBtn {
    width: 100%;
    height: 56px;
    background-color: #6CA1C6;
    color: white;
    border: none;
    font-size: 18px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
}
.worksheet-btn:hover {
    background-color: #218838;
}



.generate-wrapper {
    position: relative;
}
.generate-dropdown {
    display: none;

    position: absolute;
    top: 100%;
    left: 0;

    width: 100%; /* 👈 now matches .container through flex column */

    margin-top: 15px;

    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);

    z-index: 999;
}
.generate-dropdown.show {
    display: block;
}

.slider-block {
    margin-bottom: 20px;
}

.slider-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

#slider {
    flex: 1;
}

.slider-value {
    background: #28a745;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    min-width: 40px;
    text-align: center;
    font-weight: bold;
}

.answer-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.answer-toggle {
    width: 20px;
    height: 20px;
}

.create-btn {
    width: 100%;
    background-color: #28a745;
    color: white;
    border: none;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
}

.create-btn:hover {
    background-color: #218838;
}

#typeWarning {
    display: none;
    color: red;
    margin-bottom: 15px;
    font-weight: 600;
}

/* ---------- SUBCATEGORY BASE ---------- */
.subcategory {
  display: none;
  margin-top: 5px;
  margin-bottom: 5px;
  grid-template-columns: 1fr 1fr;
  gap: 4px 5px;
  padding-left: 10px;
}

.subcategory.open {
  display: grid;
}

.subcategory p {
  grid-column: span 2;
  margin: 5px 0;
  color: #888;
}

/* ---------- TOPIC ROW (DESKTOP BASE) ---------- */
.topic-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* left side */
.topic-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* right side (hidden by default) */
.topic-right {
  display: none;
  gap: 6px;
  align-items: flex-end;
}

/* ---------- FIELDS ---------- */
.field {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  line-height: 1.1;
  margin: 0;
}

.field label {
  margin-bottom: 1px;
  font-weight: 500;
  line-height: 1.1;
}

.field input[type="number"] {
  width: 48px;
  padding: 2px 4px;
  font-size: 11px;
  text-align: center;
  height: 22px;
}

/* ---------- INFO ICON ---------- */
.info-icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #5cb8b8;
  color: white;
  font-size: 11px;
  cursor: pointer;
  margin-left: 4px;
}

/* ---------- POPUP ---------- */
.info-popup {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-width: 200px;
  display: none;
  z-index: 9999;
}

/* ---------- SUBMIT BUTTON ---------- */
button.submit-btn {
  width: 100%;
  margin-top: var(--space-lg);
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: #4CAF50;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

button.submit-btn:hover {
  background: #43a047;
}

/* ---------- FOOTER ---------- */
.footer {
  text-align: center;
  margin-top: 15px;
  font-size: 12px;
  color: #999;
}

/* ---------- SPINNER ---------- */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ddd;
  border-top: 4px solid #4CAF50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ---------- ERROR ---------- */
#errorMessage {
  display: none;
  color: #d32f2f;
  background: #ffebee;
  border: 1px solid #ffcdd2;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 15px;
  font-size: 13px;
  font-weight: 600;
}

/* ---------- SEO CONTENT ---------- */
.seo-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

/* ---------- GRADE GRID ---------- */
.grade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grade-grid a {
  display: block;
  padding: 10px;
  border-radius: 8px;
  text-decoration: none;
  background: #FDFDFD;
  color: #6CA1C6;
  font-weight: 600;
  transition: 0.2s;
}

.grade-grid a:hover {
  background: #f0f0f0;
}

.generate-wrapper {
    position: static;
}

.generate-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 760px;
}