/* =========================================
   Font Picker Overlay (Choose a Font)
   ========================================= */

:root {
  --fp-bg-offwhite: #f7f2ec;
  --fp-surface: #ffffff;
  --fp-surface-soft: #fcf7f1;
  --fp-border-subtle: #e0d6cb;
  --fp-border-strong: #d1c3b4;
  --fp-accent: #3e2723;
  --fp-accent-soft: #f1e2d5;
  --fp-muted: #6b5a4a;
  --fp-text-main: #2f2620;
  --fp-shadow-strong: 0 18px 45px rgba(20, 10, 5, 0.4);
}

/* Full-screen overlay (no blur) */
.font-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 10, 6, 0.55); /* no backdrop-filter */
  padding: 1.5rem;
}

.font-picker-overlay.hidden {
  display: none;
}

/* Modal shell */
.font-picker-modal {
  width: min(900px, 100%);
  max-height: 90vh;
  background: var(--fp-bg-offwhite);
  border-radius: 16px;
  box-shadow: var(--fp-shadow-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--fp-text-main);
  font-family: "Inter", "Poppins", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== Header ===== */

.font-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(120deg, #3e2723, #5d4037);
  color: #fff;
}

.font-picker-header-titles {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.font-picker-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.font-picker-sub {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.85;
}

/* Close button */
.font-picker-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.font-picker-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.font-picker-close-btn:focus-visible {
  outline: 2px solid #ffe0b2;
  outline-offset: 2px;
}

/* ===== Top Text Input Section ===== */

.font-picker-text-input-bar {
  padding: 0.85rem 1.25rem 1rem;
  background: var(--fp-surface-soft);
  border-bottom: 1px solid var(--fp-border-subtle);
}

.font-picker-text-input-bar label {
  font-size: 0.98rem !important;
  font-weight: 600;
  color: var(--fp-text-main);
  margin-bottom: 0.4rem !important;
}

/* Row already has inline flex styles from markup */
.font-picker-text-input-row {
  max-width: 480px;
}

/* Input appearance */
.font-picker-text-input {
  border-radius: 10px !important;
  border: 1px solid var(--fp-border-strong) !important;
  font-size: 1rem !important;
  background: #fffdfa;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.font-picker-text-input::placeholder {
  color: #9c8f81;
  font-size: 0.95rem;
}

.font-picker-text-input:focus {
  border-color: #8d6e63 !important;
  box-shadow: 0 0 0 2px rgba(141, 110, 99, 0.25);
  background: #ffffff;
  outline: none;
}

/* Add Text button */
.font-picker-add-text-btn {
  font-weight: 600;
  border-radius: 10px !important;
  border: none;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.font-picker-add-text-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.font-picker-add-text-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
}

.font-picker-add-text-btn:focus-visible {
  outline: 2px solid #ffe0b2;
  outline-offset: 2px;
}

/* ===== Filter Bar (Mood / Theme + Serif/Sans) ===== */

.font-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.85rem 1.25rem 1rem;
  background: #f2e7dd;
  border-bottom: 1px solid var(--fp-border-subtle);
}

/* Mood/Theme group as a card */
.font-filter-bar .filter-group:first-child {
  padding: 0.6rem 0.75rem 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--fp-border-subtle);
  background: linear-gradient(145deg, #fdf7f1, #f7e6d7);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 220px;
}

/* Serif/Sans group horizontally stacked */
.font-filter-bar .filter-group:nth-child(2) {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  min-width: auto;
}

/* Shared label styling */
.filter-label {
  font-size: 0.98rem;
  font-weight: 700;
  color: #5a4336;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

/* Extra emphasis for Mood/Theme specifically */
.filter-label[for="group-list-wrapper"],
.filter-label[for="edit-group-list-wrapper"] {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.filter-label::before {
  content: '';
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #d7b196;
}

/* Mood / Theme list wrappers (both IDs) feel like cards */
.group-list-wrapper,
#group-list-wrapper,
#edit-group-list-wrapper {
  max-height: none;
  overflow: visible;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--fp-border-subtle);
  background: linear-gradient(145deg, var(--fp-surface), var(--fp-surface-soft));
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  margin-top: 0.15rem;
}

/* Chips inside Mood/Theme */
.group-list-wrapper button,
.group-list-wrapper .mood-chip,
#group-list-wrapper button,
#group-list-wrapper .mood-chip,
#edit-group-list-wrapper button,
#edit-group-list-wrapper .mood-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0.15rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #f7ebe0;
  font-size: 0.82rem;
  color: var(--fp-text-main);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.group-list-wrapper button:hover,
.group-list-wrapper .mood-chip:hover,
#group-list-wrapper button:hover,
#group-list-wrapper .mood-chip:hover,
#edit-group-list-wrapper button:hover,
#edit-group-list-wrapper .mood-chip:hover {
  background: #efd3bc;
  border-color: #d7b196;
  transform: translateY(-0.5px);
}

.group-list-wrapper button.active,
.group-list-wrapper .mood-chip.active,
#group-list-wrapper button.active,
#group-list-wrapper .mood-chip.active,
#edit-group-list-wrapper button.active,
#edit-group-list-wrapper .mood-chip.active {
  background: #d7b196;
  border-color: #a86b4b;
  color: #241813;
}

/* Serif/Sans checkboxes */
.filter-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--fp-muted);
}

.filter-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #6d4c41;
}

/* ===== Font List Section ===== */

.font-list-section {
  flex: 1;
  min-height: 0; /* ensures proper flex scroll behavior */
  padding: 0.75rem 1.25rem 1rem;
  background: var(--fp-surface);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.list-wrapper {
  flex: 1;
  border-radius: 12px;
  border: 1px solid var(--fp-border-subtle);
  background: linear-gradient(145deg, #fdf7f1, #f8eee3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Actual list of fonts */
.font-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}

/* Zebra striping for readability */
.font-list li {
  padding: 0.6rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(224, 214, 203, 0.75);
  transition: background 0.15s ease, transform 0.1s ease;
}

.font-list li:nth-child(odd) {
  background: #ffffff;
}

.font-list li:nth-child(even) {
  background: #f8efe6;
}

.font-list li:hover {
  background: #e3d2c3;
  transform: translateY(-1px);
}

.font-list li:last-child {
  border-bottom: none;
}

/* Optional helpers if you have title + preview inside rows */
.font-row-heading {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--fp-text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.font-row-meta {
  font-size: 0.78rem;
  color: #8b7a6b;
}

.font-row-preview {
  font-size: 1.05rem;
  color: var(--fp-text-main);
}

/* Selected row */
.font-list li.is-selected {
  background: #d7b196;
  border-bottom-color: #c29475;
}

/* ===== Footer ===== */

.font-picker-footer {
  padding: 0.65rem 1.25rem 0.8rem;
  background: #f1e3d4;
  border-top: 1px solid var(--fp-border-subtle);
  font-size: 0.78rem;
  color: #5d5146;
}

.font-picker-footer small {
  line-height: 1.5;
}

/* =========================================
   Professional Text Edit Modal
   ========================================= */

.text-modal {
  position: absolute;
  z-index: 2000;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  padding: 0;
  width: 320px;
  overflow: hidden;
  font-family: "Inter", "Poppins", sans-serif;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.text-modal-header {
  background: #3e2723;
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-modal-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.close-btn:hover {
  opacity: 0.8;
}

.text-modal-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.format-btn {
  flex: 1;
  background: #c19a6b;
  border: none;
  color: #fff;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  font-weight: 600;
}

.format-btn:hover {
  background: #b08968;
  transform: translateY(-1px);
}

.format-btn.active {
  background: #6b4f4f;
}

.color-group input[type="color"] {
  flex: 1;
  height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
}

/* =========================================
   MicroModal Base Styles
   ========================================= */

.modal__overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.5);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal__container {
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  background: #f9f9f9;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  position: relative;
  transform: translateY(-15px);
  transition: all 0.25s ease;
}

.micromodal-slide[aria-hidden="false"] .modal__overlay {
  opacity: 1;
}

.micromodal-slide[aria-hidden="false"] .modal__container {
  transform: translateY(0);
}

.modal__header {
  background: #444;
  color: #fff;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.modal__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 500;
}

.modal__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.modal__close:hover {
  opacity: 0.8;
}

.modal__content {
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}
