/* Wrapper */
.phrase-block {
  border: 1px dashed #ccc;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  margin-top: 20px;
  background: #fff7fb;
}

/* Heading */
.section-heading {
  font-size: 18px;
  font-weight: 700;
  color: #b45c99;
  margin-bottom: 16px;
}

/* Phrase list container */
.phrase-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Header Row */
.phrase-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
  color: #888;
  font-weight: 500;
}

.header-empty {
  width: 24px;
  flex-grow: 1;
}

.points-header {
  width: 52px;
  text-align: center;
}

/* Phrase Row */
.phrase-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Number */
.phrase-number-label {
  width: 24px;
  text-align: right;
  font-weight: bold;
  font-size: 14px;
  color: #b45c99;
  flex-shrink: 0;
}

/* Points input */
.phrase-points {
  width: 42px;
  text-align: center;
  font-size: 14px;
  height: 32px;
  padding: 4px 0;
  border: 1px solid #dcb5d8;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  box-sizing: border-box;
  appearance: textfield;
  align-items: center;
  margin-top: 0px;
}

.phrase-points::-webkit-outer-spin-button,
.phrase-points::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.phrase-points {
  -moz-appearance: textfield;
  color: #555;
}

/* Trash icon */
.delete-icon {
  width: 18px;
  height: 18px;
  cursor: pointer;
  opacity: 0.85;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.delete-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}
.delete-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #c44;
  transition: transform 0.2s ease;
}
.delete-btn:hover {
  transform: scale(1.2);
}

/* Prompt block */
.prompt-block {
  border: 1px dashed #ccc;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  margin-top: 20px;
  background: #fff7fb;
}

/* Prompt Header */
.prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.prompt-heading,
.phrases-heading {
  font-size: 18px;
  font-weight: 700;
  color: #b45c99;
  margin: 0;
}

.phrase-text,
.prompt-text,
.aiActDetails {
  font-size: 14px;
  line-height: 1.4;
  padding: 6px 10px;
  min-height: 32px;
  max-height: 200px;
  border-radius: 10px;
  border: 1px solid #dcb5d8;
  background: #fff;
  font-family: inherit;
  color: #444;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  width: 100%;
}

/* Prompt delete */
.prompt-delete:hover {
  transform: scale(1.1);
  opacity: 1;
}

/* Prompt name input */
.prompt-name-wrapper {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
  margin-top: 0px;
}

.prompt-label {
  font-size: 13px;
  font-weight: 500;
  color: #888;
}

.prompt-name-label {
  font-size: 14px;
  padding: 5px 12px;
  border: 1px solid #dcb5d8;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  color: #444;
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
}

/* Questions */
.prompt-questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-question-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prompt-question-number {
  width: 24px;
  text-align: right;
  font-weight: bold;
  font-size: 14px;
  color: #b45c99;
  flex-shrink: 0;
  align-items: center;
}

/* Add item link */
.add-item-link {
  margin-top: 14px;
  margin-left: 6px;
  font-size: 14px;
  color: #b45c99;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.plus-icon {
  font-size: 16px;
  font-weight: bold;
}

/* Phrase columns header (grid) */
.phrase-columns-header {
  display: grid;
  grid-template-columns: 1fr 34px 24px;
  align-items: center;
  font-size: 13px;
  color: #888;
  font-weight: 500;
  padding: 0 10px 4px;
  box-sizing: border-box;
}

.phrase-column-label {
  text-align: left;
  margin-left: 23px;
}
.points-column-label {
  text-align: center;
}

/* Form rows */
.form-group,
.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}
.form-group label,
.form-row label,
.field-wrapper label,
.aiForm label {
  font-size: 14px;
  font-weight: 500;
  color: #888;
  margin-bottom: 0px;
  text-align: left;
  padding-left: 4px;
}

/* Inputs and selects */
.form-group input,
.form-row input,
.field-wrapper input,
.field-wrapper select,
#aiLevel,
.aiActLevel,
#aiTopic,
.aiActTopic,
#aiCount,
.aiActCount,
.aiActivityType,
#editTopicTags {
  padding: 10px 14px;
  border: 1px solid #d49bbd;
  border-radius: 12px;
  font-family: "Segoe UI", sans-serif !important;
  box-sizing: border-box;
  outline: none;
  background: white;
  color: #555;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.field-wrapper select {
  height: 36px;
}

.info-tooltip {
  position: relative;
  cursor: help;
  display: inline-block;
}
.info-tooltip .tooltip-text {
  /* allow it to size to its content, but cap it sensibly */
  width: max-content;
  min-width: 12ch; /* at least 12 characters wide */
  max-width: 40vw; /* at most half your viewport */
  bottom: 100%;

  /* wrapping and readability */
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  text-align: left;

  /* styling */
  padding: 0.6rem 1rem;
  background: rgba(0, 0, 0, 0.85);
  border-radius: 4px;
  font-size: 0.9rem;
  color: #fff;

  /* positioning tweaks */
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.info-tooltip:hover .tooltip-text,
.info-tooltip:focus .tooltip-text {
  opacity: 1;
  visibility: visible;
}

/* little arrow */
.info-tooltip .tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.85);
}

/* on very narrow screens, ensure it stays centered */
@media (max-width: 400px) {
  .info-tooltip .tooltip-text {
    max-width: 60vw;
    bottom: 100%;
  }
}

/* 1) Give your timer input a natural width (instead of 100%) */
#timerInputWrapper input[type="number"] {
  width: 55px; /* roughly “5 characters” wide */
  max-width: 100%; /* in case you shrink the container */
  box-sizing: border-box;
  height: 36px;
  font-size: 14px;
  text-align: center;
}

/* 2) Remove the up/down arrows in WebKit browsers */
#timerInputWrapper input[type="number"]::-webkit-outer-spin-button,
#timerInputWrapper input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* 3) Remove the arrows in Firefox */
#timerInputWrapper input[type="number"] {
  -moz-appearance: textfield;
}

/* Level + Extra + Tags layout on same line */
.meta-row {
  display: flex;
  gap: 16px;
  flex-wrap: 0 0 180px;
  align-items: center;
  margin-bottom: 10px;
  width: 100%;
}

/* Field containers */
.field-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Tags input */
.field-wrapper.grow {
  width: 100%;
  box-sizing: border-box;
}

/* Placeholder grayed */
select:invalid {
  color: #aaa;
}

/* Lock select font-size for Level/Extra */
.field-wrapper select,
.field-wrapper.small select,
.field-wrapper input,
#aiTopic,
.aiActTopic,
#aiCount,
.aiActCount,
#aiLevel,
.aiActLevel,
.aiActivityType {
  font-size: 14px !important;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: none !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.phrase-text:focus,
.prompt-text:focus,
.phrase-points:focus {
  box-shadow: none !important;
}

/* Wrap Levels side by side */
.levels-row {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

/* Reduce Level select width */
.field-wrapper.small {
  width: 80px;
  flex-shrink: 0;
}

/* Let tags take remaining space */
.field-wrapper.grow input {
  height: 36px;
  width: 100%;
  box-sizing: border-box;
}

/* Mobile: Stack only the tags input */
@media (max-width: 430px) {
  .meta-row {
    flex-direction: column;
    gap: 14px;
    align-items: flex-start; /* makes children left-aligned */
  }

  .levels-row {
    flex-direction: row;
    gap: 12px;
    width: 100%;
    justify-content: flex-start; /* keeps levels left-aligned */
  }

  .field-wrapper.grow {
    width: 100%;
  }

  .field-wrapper label {
    text-align: left;
  }
}

.hidden {
  display: none;
}

textarea:-webkit-autofill,
select:-webkit-autofill {
  background-color: white !important;
  -webkit-box-shadow: 0 0 0 1000px white inset !important;
  -webkit-text-fill-color: #000 !important;
}

textarea.phrase-text,
textarea.prompt-text {
  max-height: 200px;
  overflow-y: hidden !important; /* no internal scroll by default */
  scrollbar-width: none; /* hide in Firefox */
}
/* only when focused AND overflowed will the browser scroll internally */
textarea.phrase-text:focus,
textarea.prompt-text:focus {
  overflow-y: auto !important;
}
/* hide scrollbars in WebKit */
textarea.phrase-text::-webkit-scrollbar,
textarea.prompt-text::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.prompt-header,
.prompt-question-number,
.phrase-number-label {
  cursor: move;
}

/* Actions area: flex row, spacing, clean look */
.page-actions-flex {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 10px;
}

/* Group Save/Publish neatly */
.save-publish-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Add Prompt: full width, soft color, matches theme */

/* Primary Save button with dropdown */

/* The centering wrapper (if needed) */

.add-link-center {
  margin-top: -14px;
}

/* The link itself */
.add-item-link {
  display: inline-flex; /* or just flex if you're always using the wrapper */
  align-items: center;
  gap: 6px;
  margin-top: 15px;
  padding: 0;
  color: #b45c99;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  background: none;
  border: none;
  transition: color 0.15s, transform 0.22s ease;
  transform-origin: center;
}

/* Icon inherits scaling naturally */
.add-item-link .plus-icon {
  font-size: 1.2em; /* relative to .add-item-link */
  font-weight: bold;
  line-height: 1;
  transition: inherit;
  display: flex;
  align-items: center;
}

/* Text just inherits the link styles */
.add-item-text {
  text-align: center;
  font-size: inherit;
  transition: inherit;
  margin-top: 0px;
}

/* On hover: scale and color in sync */
.add-item-link:hover,
.add-item-link:focus {
  color: #a44a75;
  transform: scale(1.02);
  text-decoration: none;
}

#add-activity.add-item-text {
  margin-top: 0px;
}

.actions-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 32px 0;
}

.page-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 10px 0 0 0;
  flex-wrap: nowrap;
}

.page-actions button {
  flex: 1 1 0;
  min-width: 0;
  height: 38.5px;
  font-size: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  white-space: nowrap;
}

.icon {
  font-size: 1.2em;
  display: flex;
  align-items: center;
}

/* Responsive (mobile stack) */
@media (max-width: 515px) {
  .page-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .action-cancel {
    order: 3;
  }
  .action-draft {
    order: 1;
  }
  .action-publish {
    order: 2;
  }
  .page-actions button {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
    height: 38.5px;
  }
}

.add-item-link .plus-icon {
  font-size: 1.3em; /* or 1.3em, but NOT px! */
  font-weight: bold;
  transition: inherit; /* makes the transition smooth together */
}

#Phrases {
  margin-bottom: 10px;
}

#generateWithAI,
#showAiFormBtn,
#aiCount,
.aiActCount,
.aiActivityType {
  margin-bottom: 10px;
}

#Phrases {
  margin-bottom: 10px;
}

#generateWithAI,
#showAiFormBtn,
#aiCount,
#aiTopic,
#aiLevel,
.aiActCount,
.aiActTopic,
.aiActLevel,
.generate-ai-activities-btn {
  margin-bottom: 10px;
}

.showAiActivitiesFormBtn {
  margin-bottom: 0px;
}

.show-ai-activities-btn {
  margin-bottom: 10px;
  margin-top: 0px;
}

.aiActivitiesControls {
  margin-top: 0px;
}
