body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
  box-sizing: border-box;
}

body,
html,
button,
select,
input {
  font-family: "Playpen Sans", cursive;
}

/* Editor page: flex column so main-container fills exactly what remains after the header */
.editor-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Main container for the layout */
.main-container {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Left section: Color palette */
.palette-section {
  width: 20%; /* Take up 20% of the window width */
  padding: 10px;
  box-sizing: border-box;
  border-right: 1px solid #ccc;
  overflow-y: auto; /* Scroll if palette section exceeds the window height */
}

.palette-section h3 {
  text-align: center;
}

.palette-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  /*width: 350px;  /* Adjust width to fit 5 color pickers in one row */
  /*margin-bottom: 20px;*/
}

#generatePatternButton {
  background-color: mediumpurple;
  color: white;
}

.fill-modal-button {
  background-color: #f0f0f0;
  border: none;
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease;
}

.fill-modal-button:hover {
  background-color: #e0e0e0;
}

.fill-modal-button:active {
  background-color: #ccc;
}

/*.palette-container input[type="color"],*/
.palette-container div.swatch {
  width: 60px;
  height: 60px;
  margin: 5px;
  cursor: pointer;
  border: 2px solid transparent; /* No border unless active */
  flex-shrink: 0; /* Prevent shrinking */
}

.palette-container div.swatch {
  padding: 4px;
  box-sizing: border-box; /* Ensures that padding and borders are included in the width/height */
  background-color: #f0f0f0; /* To give a similar background look */

  /* Disable text selection */
  user-select: none;
}

#addSwatchButton {
  width: 60px;
  height: 60px;
  margin: 5px;
  cursor: pointer;
  padding: 4px;
  box-sizing: border-box; /* Ensures that padding and borders are included in the width/height */
  flex-shrink: 0; /* Prevent shrinking */
}

#addSwatchButton button {
  width: 100%;
  height: 100%;
  font-size: 1.5rem;
}

div.swatch svg {
  border: 1px solid #777777;
  box-sizing: border-box;
  cursor: pointer;
}

.palette-container input[type="color"].active,
.palette-container div.swatch.active {
  border: 2px solid #000; /* Highlight the active palette */
}

#bgColorPicker {
  border: 1px solid #777777;
  cursor: pointer;
  padding: 2px;
  background-color: #ffffff;
}

#bgColorPicker svg {
  cursor: pointer;
}

/* Right section: SVG canvas */
.canvas-section {
  width: 80%; /* Take up 80% of the window width */
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  position: relative;
}

#paintCanvas {
  /*width: 100%; /* Ensure the canvas fills its container * /
            max-width: 500px; /* Limit the maximum size * /
            margin: 0 auto;*/
  width: 100%;
  height: 100%;
  max-height: 90%; /* Limit the height so there's some padding */
  max-width: 90%; /* Limit the width so there's some padding */
  overflow: hidden;
  border: 1px solid black;
  position: relative;
}

.spinner-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  position: absolute; /* Position spinner over the content */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7); /* Overlay background */
  z-index: 10; /* Ensure spinner is on top */
}

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid #ccc;
  border-top-color: #337ab7; /* Spinner color */
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

#loadingSpinner .spinner {
  width: 80px;
  height: 80px;
  border-width: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

svg {
  /*width: 1500px;
            height: 4200px;*/
  width: 100%; /* Scale SVG to fill the canvas */
  height: 100%; /*auto; /* Maintain aspect ratio */
  display: block; /* Remove inline block gaps */
  /*border: 1px solid #000;*/
  cursor: default;
}

svg.grab {
  cursor: grab; /* Grab cursor when Ctrl is held down */
}

svg.grabbing {
  cursor: grabbing; /* Grabbing cursor when dragging */
}

.help-button {
  background-color: #d3d3d3;
  border: none;
  border-radius: 5px;
  padding: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease;
}

.help-button:hover {
  background-color: #e0e0e0;
}

.help-button-mobile {
  display: none;
}

/* Cozy Corner Controls */

#uploadButton {
  border: 2px dotted grey;
  border-radius: 10px;
  padding-bottom: 5px;
}

#cozyCornerControls {
  display: flex;
  justify-content: center;
}

#cozyCornerControls button i {
  font-size: 1.15rem;
}

#backgroundControls {
  display: none; /* Hidden by default */
  flex-direction: column;
  position: absolute;
  bottom: 0px;
  right: 0px;
  background-color: #fff;
  padding-top: 10px;
  padding-bottom: 10px;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  width: 100%;
}

#backgroundControlsInstructions {
  text-align: center;
  margin-bottom: 10px;
  font-size: 1.25rem;
}

#backgroundControlsButtons {
  display: flex;
}

#backgroundControls button {
  background-color: #4caf50;
  color: white;
  border: none;
  width: 50%;
  padding: 10px;
  border-radius: 5px;
  cursor: pointer;
  margin-left: 5px;
  margin-right: 5px;
  font-size: 1rem;
}

/* Zoom and Pan button styles */
.controls {
  position: absolute;
  bottom: 10px;
  left: 10px;
  /*display: flex;
            flex-direction: column;*/
  display: grid;
  grid-template-columns: repeat(3, 40px);
  grid-template-rows: repeat(3, 40px);
  gap: 3px;
}

.control-button {
  background-color: #4caf50;
  color: white;
  border: 1px solid white;
  /*margin: 3px;*/
  width: 40px;
  height: 40px;
  cursor: pointer;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.control-button:hover {
  background-color: #45a049;
}

/* Zoom buttons styles */
#zoomIn,
#zoomOut {
  grid-column: span 3;
}

.undo-button {
  display: block;
  position: absolute;
  bottom: 10px;
  left: 140px;
}

.undo-button:disabled {
  background-color: #a5d6a7;
}

#printFooter {
  display: none;
}

/* Modal overlay (dark background) */
.modal-overlay {
  display: none; /* Hidden by default */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7); /* Dark semi-transparent background */
  z-index: 1000;
}

/* Modal container */
.modal {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  width: 80%;
  max-width: 600px;
  height: 60%;
  border-radius: 10px;
  padding: 40px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  z-index: 1001;
}

/* Close button for the modal */
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: #333;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Iframe in the modal - support */
.modal iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Toggle switch container */
.toggle-container {
  margin-top: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#designNameToggle {
  border-top: 1px solid #e0e0e0;
  padding-top: 4px;
}

.name-eye-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  color: #666;
  font-size: 1em;
  flex-shrink: 0;
}

.name-eye-btn:hover {
  color: #333;
}

.toggle-container label {
  font-size: 0.9em;
  color: #333;
  margin-right: 10px; /* Space between label and switch */
  font-weight: 500; /* Slightly bolder text */
  display: block;
}

/* Toggle switch CSS */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle-switch input {
  /*opacity: 0;
        width: 0;
        height: 0;*/
  display: none; /* Hide the checkbox */
}

.slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #4caf50;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* View toggle (Front / Back / future 3D) — premium segmented control */
.view-toggle {
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #9370db;
  background: #f3eef9;
}

.view-toggle input[type="radio"] {
  display: none;
}

.view-toggle label.view-toggle__label {
  margin-right: 0;
  padding: 6px 18px;
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 600;
  color: #9370db;
  background: transparent;
  transition: background-color 0.2s ease, color 0.2s ease;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 5px;
}

.view-toggle input[type="radio"]:checked + .view-toggle__label {
  background: #9370db;
  color: #fff;
}

.view-toggle label.view-toggle__label:hover {
  background: #e0d4f5;
}

.view-toggle input[type="radio"]:checked + .view-toggle__label:hover {
  background: #8360c9;
}

.view-toggle input[type="radio"]:disabled + .view-toggle__label {
  opacity: 0.35;
  cursor: not-allowed;
}

.view-toggle input[type="radio"]:disabled + .view-toggle__label:hover {
  background: transparent;
}

/* Toggle items here are used for the template selector */
.template-picker-btn {
  width: 100%;
  padding: 10px 12px;
  background: #f0f0f0;
  border: none;
  border-left: 4px solid #4caf50;
  border-radius: 6px;
  font-size: 1.05em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background-color 0.2s;
}

.template-picker-btn:hover {
  background: #e8e8e8;
}

.template-sheet-item {
  display: flex;
  align-items: center;
  padding: 14px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border: 2px solid transparent;
  font-size: 1em;
}

.template-sheet-item:hover {
  background-color: #f5f5f5;
}

.template-sheet-item:active {
  background-color: #e8f5e9;
}

.template-sheet-item.selected {
  background-color: #e8f5e9;
  border-color: #4caf50;
}

.template-sheet-item i {
  margin-right: 12px;
  color: #4caf50;
  font-size: 1.2em;
}

.toggle-buttons {
  /* display: flex; */
  border: 2px solid #ccc;
  border-radius: 30px;
  overflow: hidden;
  width: max-content;
}

.toggle-buttons input[type="radio"] {
  display: none; /* Hide the radio buttons */
}

.toggle-button {
  padding: 10px 0px;
  cursor: pointer;
  background-color: #ccc;
  color: #fff;
  border: none;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
  width: 100%;
  /*flex: 1; /* Make the buttons equal in width */
  text-align: center;
}

/* Style for the active button */
input[type="radio"]:checked + .toggle-button {
  background-color: #2196f3; /* Active button color */
  color: white;
}

/* Optional hover effect */
.toggle-button:hover {
  background-color: #bbb;
}

/* ---------------------------------------------------------------------------
   Scene mode — multi-nutcracker editing
   --------------------------------------------------------------------------- */

#svgCanvas.scene-mode {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.scene-slot {
  flex: 1;
  position: relative;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.scene-slot:hover {
  border-color: #ccc;
}

.scene-slot-active {
  border-color: mediumpurple;
  box-shadow: 0 0 8px rgba(147, 112, 219, 0.4);
}

.scene-slot svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Sidebar scene config panel */
.scene-config {
  border: 2px dotted grey;
  border-radius: 10px;
  padding: 8px;
  margin-top: 10px;
}

.scene-slot-list-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  margin: 4px 0;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 0.85em;
  border-left: 3px solid transparent;
}

.scene-slot-list-item button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 1em;
}

/* Template picker grid (shown in reusable modal) */
.scene-template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.scene-template-card {
  padding: 12px;
  border: 2px solid #ccc;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 0.9em;
  transition: border-color 0.2s, background 0.2s;
}

.scene-template-card:hover {
  border-color: mediumpurple;
  background: lavender;
}

/* Bottom sheet is mobile-only; hide it entirely on desktop */
.bottom-sheet-overlay {
  display: none;
}

/* Mobile overrides for the editor */
@media (max-width: 768px) {
  .controls,
  #eyedropper-button,
  #templatePickerBtn,
  .mmm-container,
  .mmm-order-container {
    display: none !important;
  }

  .undo-button {
    bottom: 10px;
    left: 10px;
    font-size: 1.25rem;
  }

  .help-button {
    display: none;
  }

  .help-button-mobile {
    display: block;
    bottom: 10px;
    right: 10px;
    font-size: 1.25rem;
    position: absolute;
    background-color: #4caf50;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    cursor: pointer;
  }

  #backgroundControlsInstructions {
    font-size: 1rem;
  }

  #backgroundControls button {
    font-size: 0.85rem;
  }

  .canvas-section {
    flex-grow: 1;
    height: calc(
      100dvh - 52px - 52px
    ); /* Viewport minus header minus palette */
  }

  .palette-section {
    width: 100%;
    height: 52px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #ddd;
    border-top: 1px solid #ccc;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2; /* Above the canvas section which has position: relative */
  }

  .palette-container {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto; /* Allow scrolling horizontally if there are too many colors */
    -webkit-overflow-scrolling: touch; /* Enable smooth scrolling on iOS */
    flex: 1;
    min-width: 0;
    justify-content: flex-start;
  }

  .palette-section h3 {
    display: none;
  }

  .palette-container div.swatch {
    width: 38px;
    height: 38px;
    margin: 0 5px;
    padding: 2px;
  }

  /* Hide the inline add-swatch button on mobile (static one lives outside) */
  #addSwatchButton {
    display: none;
  }

  /* Vertical divider between color swatches and action buttons */
  .palette-container + .palette-bar-button::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 4px;
    bottom: 4px;
    width: 1px;
    background-color: #bbb;
  }

  .palette-container + .palette-bar-button {
    position: relative;
    margin-left: 12px;
  }

  /* Palette bar action buttons (group paint, settings) */
  .palette-bar-button {
    background-color: #4caf50;
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    min-width: 38px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background-color 0.2s ease;
  }

  .palette-bar-button:active {
    background-color: #45a049;
  }

  .palette-bar-button.active {
    background-color: #2e7d32;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
  }

  .palette-bar-button.inactive {
    background-color: #9e9e9e;
  }

  /* Hide group paint toggle from settings modal on mobile (it's in the palette bar) */
  #groupPaintToggle {
    display: none !important;
  }

  /* Bottom sheet overlay */
  .bottom-sheet-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition:
      opacity 0.3s ease,
      visibility 0.3s ease;
  }

  .bottom-sheet-overlay.open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
  }

  /* Bottom sheet panel */
  .bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    padding: 12px 20px 24px;
    max-height: 60dvh;
    overflow-y: auto;
    z-index: 999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  }

  .bottom-sheet-overlay.open .bottom-sheet {
    transform: translateY(0);
  }

  .bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    margin: 0 auto 12px;
  }

  .bottom-sheet-title {
    text-align: center;
    margin: 0 0 16px;
    font-size: 1.1em;
    color: #333;
  }

  /* Modal overlay */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
  }

  /* Modal content */
  .modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 400px;
    z-index: 1001;
  }

  .close-button {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 5px 10px;
    font-size: 1.2rem;
    cursor: pointer;
    float: right;
  }

  .close-button:hover {
    background-color: #e53935;
  }

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

  .settings-template-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    margin-top: 8px;
    margin-bottom: 12px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-left: 4px solid #4caf50;
    border-radius: 6px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.2s;
  }

  .settings-template-btn:hover {
    background: #e8e8e8;
  }

  /* Center the items in the settings modal */
  .toggle-container {
    justify-content: center;
  }

  /* Scene carousel navigation */
  .scene-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
  }

  .scene-nav-arrow {
    pointer-events: auto;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .scene-nav-arrow:active {
    background: rgba(0, 0, 0, 0.5);
  }

  .scene-nav-prev { left: 8px; }
  .scene-nav-next { right: 8px; }

  .scene-nav-dots {
    pointer-events: auto;
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
  }

  .scene-nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    padding: 0;
    cursor: pointer;
  }

  .scene-nav-dot.active {
    background: mediumpurple;
  }

  .scene-indicator-badge {
    pointer-events: none;
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 0.75em;
    padding: 2px 10px;
    border-radius: 10px;
    white-space: nowrap;
  }
}

/* Mobile portrait: carousel mode — only active slot visible */
@media (max-width: 768px) and (orientation: portrait) {
  #svgCanvas.scene-mode .scene-slot.scene-slot-hidden {
    display: none;
  }

  #svgCanvas.scene-mode .scene-slot-active svg {
    width: 100%;
    height: 100%;
  }

  /* Preview Scene button */
  .scene-preview-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 11;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 0.8em;
    cursor: pointer;
  }

  .scene-preview-btn:active {
    background: rgba(0, 0, 0, 0.7);
  }

  /* Preview mode: show all slots in a grid, non-interactive */
  #svgCanvas.scene-mode.scene-preview-mode {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }

  #svgCanvas.scene-mode.scene-preview-mode .scene-slot {
    display: block !important;
    flex: 0 1 45%;
    max-height: 48%;
    border-color: transparent;
  }

  #svgCanvas.scene-mode.scene-preview-mode .scene-slot svg {
    width: 100%;
    height: 100%;
  }

  /* Preview overlay with back button */
  .scene-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 12;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 20px;
    pointer-events: none;
  }

  .scene-preview-back-btn {
    pointer-events: auto;
    background: mediumpurple;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 24px;
    font-size: 0.95em;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

/* Mobile landscape: use desktop-style side-by-side layout */
@media (max-width: 768px) and (orientation: landscape) {
  #svgCanvas.scene-mode {
    display: flex;
    gap: 6px;
    align-items: stretch;
    height: 100%;
  }

  #svgCanvas.scene-mode .scene-slot {
    flex: 1;
    display: block !important;
  }

  .scene-nav {
    display: none !important;
  }

  .scene-preview-btn {
    display: none !important;
  }
}

/* Print menu popover */
.print-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  z-index: 1100;
  min-width: 170px;
  overflow: hidden;
}
.print-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 0.95em;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
}
.print-menu-item:hover {
  background: #e8f5e9;
}

/* Unified print container — hidden on screen, shown only when printing */
#printContainer {
  display: none;
}

@media print {
  /* ——— Design mode: print SVG in place (materials already loaded) ——— */

  body[data-print-mode="design"] > *:not(.main-container):not(#printContainer) {
    display: none !important;
  }

  body[data-print-mode="design"] .main-container {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  /* Collapse palette but keep SVG pattern defs in the render tree —
     display:none would break url(#…) paint-server resolution */
  body[data-print-mode="design"] .palette-section {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
  }

  body[data-print-mode="design"] .canvas-section,
  body[data-print-mode="design"] #paintCanvas,
  body[data-print-mode="design"] #svgCanvas {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: none !important;
    background: none !important;
  }

  body[data-print-mode="design"] .controls,
  body[data-print-mode="design"] .undo-button,
  body[data-print-mode="design"] #loadingSpinner,
  body[data-print-mode="design"] #backgroundControls,
  body[data-print-mode="design"] .scene-nav,
  body[data-print-mode="design"] .scene-preview-overlay {
    display: none !important;
  }

  body[data-print-mode="design"] #svgCanvas svg {
    position: fixed !important;
    top: 0.4in;
    left: 0.5in;
    width: calc(100% - 1in) !important;
    height: calc(100% - 1in) !important;
    max-height: none !important;
    object-fit: contain;
  }

  /* Show only the footer from printContainer */
  body[data-print-mode="design"] #printContainer {
    display: block !important;
  }
  body[data-print-mode="design"] #printSvgSlot {
    display: none !important;
  }
  body[data-print-mode="design"] #printFooter {
    display: block !important;
    position: fixed;
    bottom: 0.15in;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 9pt;
    color: #888;
    font-family: "Playpen Sans", cursive;
  }

  /* ——— Coloring page mode: print from #printContainer ——— */

  body[data-print-mode="coloring"] > *:not(#printContainer) {
    display: none !important;
  }

  body[data-print-mode="coloring"] #printContainer {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 0.4in 0.5in 0.3in;
    text-align: center;
  }

  body[data-print-mode="coloring"] #printSvgSlot {
    width: 100%;
    height: calc(100% - 24pt);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body[data-print-mode="coloring"] #printSvgSlot svg {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
  }

  body[data-print-mode="coloring"] #printFooter {
    display: block !important;
    text-align: center;
    font-size: 9pt;
    color: #888;
    font-family: "Playpen Sans", cursive;
    padding-top: 4pt;
  }

  /* ——— Side-by-side notes for coloring mode ——— */

  body[data-print-mode="coloring"][data-print-paint-list] #printSvgSlot {
    width: 38% !important;
    justify-content: flex-start !important;
  }

  body[data-print-mode="coloring"][data-print-paint-list] #printSvgSlot svg {
    max-width: 100% !important;
  }

  body[data-print-mode="coloring"][data-print-paint-list] #printPaintList {
    display: block !important;
    position: fixed;
    top: 0.4in;
    left: 42%;
    right: 0.3in;
    color: #333;
    font-family: system-ui, -apple-system, sans-serif;
  }

  body[data-print-mode="coloring"][data-print-paint-list] .print-notes-block h2 {
    font-size: 13pt;
    font-weight: 700;
    margin: 0 0 8pt;
    color: #333;
  }

  body[data-print-mode="coloring"][data-print-paint-list] .print-notes-line {
    border-bottom: 0.5pt solid #ccc;
    height: 20pt;
  }

  /* ——— Side-by-side paint list (same page as design) ——— */

  /* When paint list is included, constrain SVG to left side of page */
  body[data-print-mode="design"][data-print-paint-list] #svgCanvas svg {
    left: 0.25in !important;
    width: 38% !important;
  }

  /* Paint list on the right side */
  body[data-print-mode="design"][data-print-paint-list] #printPaintList {
    display: block !important;
    position: fixed;
    top: 0.4in;
    left: 42%;
    right: 0.3in;
    color: #333;
    font-family: system-ui, -apple-system, sans-serif;
    overflow: hidden;
  }

  body[data-print-mode="design"][data-print-paint-list] #printPaintList h2 {
    font-size: 13pt;
    font-weight: 700;
    margin: 0 0 6pt;
    color: #333;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-paint-items {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-paint-items li {
    display: flex;
    align-items: center;
    gap: 5pt;
    padding: 2.5pt 0;
    font-size: 8.5pt;
    color: #333;
    border-bottom: 0.5pt solid #eee;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-paint-swatch {
    display: inline-block;
    width: 10pt;
    height: 10pt;
    border-radius: 2pt;
    border: 0.5pt solid #ccc;
    flex-shrink: 0;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-paint-approx {
    color: #999;
    font-size: 7.5pt;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-paint-legend {
    margin-top: 6pt;
    font-size: 7.5pt;
    color: #999;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-paint-checkbox {
    display: inline-block;
    width: 8pt;
    height: 8pt;
    border: 0.75pt solid #999;
    border-radius: 1.5pt;
    flex-shrink: 0;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-paint-footer {
    margin-top: 8pt;
    font-size: 8pt;
    color: #888;
    font-family: "Playpen Sans", cursive;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-notes-block {
    margin-top: 10pt;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-notes-block h2 {
    font-size: 11pt;
    font-weight: 700;
    margin: 0 0 6pt;
    color: #333;
  }

  body[data-print-mode="design"][data-print-paint-list] .print-notes-line {
    border-bottom: 0.5pt solid #ccc;
    height: 16pt;
  }

  /* Hide the modal overlay during print */
  .reusable-modal {
    display: none !important;
  }
}

/* ——— Print interstitial (on-screen styles) ——— */

.print-interstitial-intro {
  font-size: 0.9em;
  color: #555;
  margin-bottom: 0.75em;
  text-align: center;
}

.print-interstitial-controls {
  margin-top: 1em;
  padding-top: 1em;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.print-interstitial-check {
  font-size: 0.9em;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.print-interstitial-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #4caf50;
}

.print-interstitial-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  background: #4caf50;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.print-interstitial-btn:hover {
  background: #43a047;
}

.print-interstitial-toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
}

/* Modal styling */
.color-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  overflow-y: scroll;
}

.modal-content {
  background-color: white;
  /*margin: 15% auto;*/
  padding: 20px;
  border: 1px solid #888;
  width: 420px;
  max-width: calc(100vw - 32px);
  position: absolute;
  top: 50%;
  left: 50%;
  height: 60%;
  overflow-y: auto;
  transform: translate(-50%, -50%);
  text-align: center;
}
/* Modal title */
.modal-title {
  font-size: 1.5em;
  font-weight: bold;
  text-align: center;
  margin-bottom: 20px;
  color: #4caf50;
  letter-spacing: 0.05em; /* Slight letter spacing for a polished look */
  margin-top: 0px;
}

/* Optional: Add a subtle underline or border below the title */
.modal-title::after {
  content: "";
  display: block;
  /*width: 50px;*/
  height: 2px;
  background-color: #4caf50; /* Light gray underline */
  margin: 10px auto 0; /* Centered and spaced below the title */
}

/* Fill Picker Tabs */
.fill-picker-tabs {
  display: flex;
  border-bottom: 2px solid #eee;
  margin-bottom: 12px;
  gap: 4px;
}

.fill-picker-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 0.9em;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.fill-picker-tab:hover {
  color: #555;
}

.fill-picker-tab.active {
  color: #4caf50;
  border-bottom-color: #4caf50;
}

.fill-picker-tab-content {
  display: none;
}

.fill-picker-tab-content.active {
  display: block;
}

/* Back button inside inline pattern creator */
.pattern-creator-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  margin-bottom: 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f8f8f8;
  color: #555;
  font-size: 0.85em;
  cursor: pointer;
  transition: background-color 0.15s;
}

.pattern-creator-back:hover {
  background: #eee;
}

/* Context bar: fills currently in use on the design */
.context-bar { margin-bottom: 12px; padding: 8px 10px; background: #f5f5f5; border-radius: 8px; }
.context-bar-label { font-size: 0.75em; color: #888; margin-bottom: 4px; }
.context-bar-fills { display: flex; gap: 4px; overflow-x: auto; }
.context-bar-swatch {
  width: 28px; height: 28px; min-width: 28px;
  border: 1px solid #ccc; border-radius: 4px;
  cursor: pointer; transition: border-color 0.15s;
}
.context-bar-swatch:hover { border-color: #333; }
.context-bar-swatch svg { width: 100%; height: 100%; display: block; }

/* User Palette */
.user-palette-section .modal-section-header { justify-content: space-between; }
.user-palette-add-group {
  display: flex; align-items: center; gap: 6px;
}
.user-palette-preview {
  width: 26px; height: 26px; min-width: 26px;
  border: 1px solid #ccc; border-radius: 4px;
  display: inline-block;
}
.user-palette-preview svg { width: 100%; height: 100%; display: block; }
.user-palette-save-btn {
  background: #4caf50; color: #fff; border: none; border-radius: 50%;
  width: 26px; height: 26px; cursor: pointer;
  font-size: 18px; font-weight: bold;
  padding: 0; line-height: 26px; text-align: center;
  transition: background-color 0.15s;
}
.user-palette-save-btn:hover { background: #388e3c; }
.user-palette-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.user-palette-swatch {
  width: 32px; height: 32px; min-width: 32px;
  border: 1px solid #ccc; border-radius: 4px;
  cursor: pointer; transition: border-color 0.15s;
}
.user-palette-swatch { position: relative; }
.user-palette-swatch:hover { border-color: #333; }
.user-palette-swatch svg { width: 100%; height: 100%; display: block; }
.user-palette-delete {
  position: absolute; top: -6px; right: -6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #e53935; color: #fff; border: none;
  font-size: 11px; line-height: 16px; text-align: center;
  cursor: pointer; padding: 0;
  opacity: 0; transition: opacity 0.15s;
}
.user-palette-swatch:hover .user-palette-delete { opacity: 1; }
@media (max-width: 768px) {
  .user-palette-delete { opacity: 0.8; }
}
.user-palette-empty {
  font-size: 0.8em; color: #888; padding: 10px 0; line-height: 1.5;
}
.user-palette-title-group {
  white-space: nowrap;
}
.user-palette-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%; position: relative;
  background: #ccc; color: #555; font-size: 9px; font-weight: bold;
  cursor: pointer; margin-left: 3px; vertical-align: middle;
  font-style: normal; line-height: 1; outline: none;
}
.user-palette-tooltip {
  display: none; position: absolute; top: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); width: 220px; padding: 8px 10px;
  background: #333; color: #fff; font-size: 11px; font-weight: normal;
  line-height: 1.4; border-radius: 6px; z-index: 10;
  white-space: normal; text-align: left;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.user-palette-tooltip::before {
  content: ''; position: absolute; top: -5px; left: 50%;
  transform: translateX(-50%); border: 5px solid transparent;
  border-top: none; border-bottom-color: #333;
}
.user-palette-info.show .user-palette-tooltip { display: block; }

/* Section Headers */
.modal-section-header {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-section-header i {
  margin-right: 10px;
}

/* Section background to lightly differentiate each */
.modal-section {
  border: 2px solid #f9f9f9;
  padding: 15px;
  margin-bottom: 20px;
  border-radius: 8px;
}

.modal-premium-section {
  border: 3px solid #9370db; /* Strong mediumpurple border */
  /*background: linear-gradient(135deg, #ede7f6 60%, #d1c4e9 100%);*/
  background: #d1c4e93b 60%;
  box-shadow: 0 4px 16px rgba(147, 112, 216, 0.25);
  padding: 18px;
  border-radius: 12px;
  position: relative;
  /*animation: premiumPulse 2s 3; /*infinite*/
}

@keyframes premiumPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(147, 112, 216, 0.4);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(30, 27, 36, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(147, 112, 216, 0);
  }
}

/* Subtle dividers between sections */
.modal-divider {
  border: none;
  border-top: 1px solid #ddd; /* Light gray divider */
  margin: 20px 0;
}

.brand-filters {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.85em;
}

.brand-filter {
  cursor: pointer;
}

.close {
  color: #aaa;
  float: right;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
}

.color-box {
  display: inline-block;
  width: 30px;
  height: 30px;
  margin: 5px;
  cursor: pointer;
  border: 2px solid #fff;
}

.color-box:hover {
  border-color: #000;
}

.materials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 48px);
  gap: 4px;
  justify-content: center;
  padding: 8px;
  background-color: lavender;
  border-radius: 10px;
}

.materials-grid .color-box {
  width: 48px;
  height: 48px;
  margin: 0;
}

.materials-section-header {
  font-size: 0.85em;
  font-weight: bold;
  margin-top: 10px;
  color: #555;
}

.materials-loading {
  font-size: 0.85em;
  color: #888;
  text-align: center;
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.materials-spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.materials-paging {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
}

.materials-show-more {
  padding: 4px 16px;
  font-size: 0.8em;
  background: lavender;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  color: #555;
}

.materials-show-more:hover {
  background: #d8d0f0;
}

.materials-separator {
  border: none;
  border-top: 1px solid #ddd;
  margin: 12px 0 4px;
}

#materialPreview {
  grid-column: 1 / -1;
  text-align: center;
  margin: 8px 0;
}

.material-preview-container {
  display: inline-block;
}

.material-preview-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.85em;
  color: #555;
}

.material-preview-bar input[type="range"] {
  width: 80px;
}

.hidden {
  display: none;
}

/* Search input */
/* Unified search bar */
.unified-search-container {
  padding: 0 0 12px;
  text-align: center;
}

#unifiedSearch {
  width: 90%;
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 20px;
  font-size: 0.95em;
  outline: none;
  transition: border-color 0.2s;
}

#unifiedSearch:focus {
  border-color: #4caf50;
}

/* Unified search results */
.unified-results-section {
  margin-bottom: 16px;
}

.unified-results-header {
  font-size: 0.85em;
  font-weight: bold;
  color: #555;
  margin-bottom: 6px;
  text-align: left;
  padding-left: 4px;
}

.unified-results-header.collapsible {
  cursor: pointer;
  user-select: none;
}

.unified-results-header .results-count {
  font-weight: normal;
  color: #999;
}

.unified-results-header .collapse-icon {
  transition: transform 0.15s;
}

.unified-results-section.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.unified-results-section.collapsed .unified-color-grid,
.unified-results-section.collapsed .materials-grid {
  display: none;
}

.unified-color-grid {
  text-align: center;
}

.unified-material-upsell {
  text-align: center;
  padding: 12px 0;
  color: #888;
  font-size: 0.9em;
}

.unified-material-upsell a {
  color: #4caf50;
  font-weight: 600;
}

.unified-generate-cta {
  text-align: center;
  padding: 16px 0 4px;
  color: #888;
}

.unified-generate-cta p {
  margin-bottom: 8px;
  font-size: 0.9em;
}

.unified-no-results {
  text-align: center;
  padding: 20px 0;
  color: #888;
}

.unified-no-results-hint {
  font-size: 0.9em;
  margin-bottom: 8px !important;
}

.unified-any-color-tools {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.unified-no-results p {
  margin-bottom: 12px;
}

@keyframes highlight-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.6); }
  50%  { box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

.highlight-pulse {
  animation: highlight-pulse 0.8s ease-out 2;
}

/* Reusable modal, TODO convert everything else to use this eventually */
.reusable-modal {
  display: none;
  position: fixed;
  z-index: 1100;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
}
/* Modal content */
.reusable-modal-content {
  background-color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 20px;
  border: 1px solid #888;
  border-radius: 10px;
  width: 365px;
  max-width: calc(100vw - 32px);
  text-align: center;
  max-height: 60dvh;
  overflow-y: auto;
}
.reusable-modal-content p {
  margin: 0.75em 0;
}
.reusable-modal-content ul {
  text-align: left;
  padding-left: 1.5em;
  margin: 0.5em 0;
}
/* Styles for the modal buttons */
.reusable-modal-button {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-size: 15px;
  cursor: pointer;
  margin: 10px;
  transition: background-color 0.3s ease;
}

/* Affirmative button (e.g., "Yes", "Confirm") */
.reusable-modal-button-affirmative {
  background-color: #4caf50; /* Green */
  color: white;
}

.reusable-modal-button-affirmative:hover {
  background-color: #45a049;
}

/* Negative button (e.g., "No", "Cancel") */
.reusable-modal-button-negative {
  background-color: #e57373; /* Red */
  color: white;
}

.reusable-modal-button-negative:hover {
  background-color: #d32f2f;
}

/* Close button */
.reusable-close-btn {
  color: red;
  float: right;
  font-size: 28px;
  font-weight: bold;
}
.reusable-close-btn:hover,
.reusable-close-btn:focus {
  color: darkred;
  text-decoration: none;
  cursor: pointer;
}

#generateThemeButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

#themePromptInput {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 16px;
}

.color-swatch {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 8px;
  border: 1px solid #000;
  vertical-align: middle;
}

/* Paint checklist affiliate links */
.paint-checklist {
  list-style: none;
  padding: 0;
  margin: 0.5em 0;
  clear: both;
}

.paint-checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #eee;
  font-size: 0.95em;
}

.paint-checklist li:last-child {
  border-bottom: none;
}

.paint-label {
  flex: 1;
  min-width: 0;
}

.paint-buy-link {
  padding: 2px 8px;
  font-size: 0.75em;
  font-weight: 600;
  color: #fff;
  background-color: #f0960e;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.paint-buy-link:hover {
  background-color: #d4820a;
}

.paint-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15);
  vertical-align: middle;
  flex-shrink: 0;
}

.paint-approx-inline {
  color: #999;
  font-size: 0.85em;
  white-space: nowrap;
}

.affiliate-disclosure {
  margin-top: 0.75em;
  font-size: 0.7em;
  color: #888;
  text-align: center;
}

.paint-report-link {
  font-size: 0.75em;
  color: #999;
  text-align: center;
  margin-top: 4px;
}

.paint-report-link a {
  color: #4caf50;
  text-decoration: none;
}

.paint-report-link a:hover {
  text-decoration: underline;
}

.paint-checklist-legend {
  margin-top: 0.5em;
  font-size: 0.75em;
  color: #999;
  text-align: center;
}

/* Pattern modal specific styles (legacy — standalone modal no longer used) */
/* .pattern-modal and .pattern-modal-content are unused now that the pattern
   creator is inline within the unified fill picker. Kept for reference only. */

div#materialSelection {
  display: flex;
  flex-direction: column;
  align-items: center;
}

div#patternForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-svg {
  width: 100%;
  margin: 16px 0;
  border: 3px solid black;
  border-radius: 5px;
}

/* .pattern-modal-close removed — pattern creator now uses Back button */

.premium-cta {
  background: linear-gradient(135deg, #4caf50, #43a047);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  transition:
    transform 0.2s,
    background 0.3s;
}

.premium-cta:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, #43a047, #388e3c);
}

.premium-cta:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.cta-subtext {
  display: block;
  font-size: 0.75em;
  margin-top: 4px;
  color: #e8f5e9; /* Light green to blend with theme */
  opacity: 0.9;
}

.premium-cta .icon {
  font-size: 1.2em;
}

.premium-cta .pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.4);
  }
  70% {
    box-shadow: 0 0 0 20px rgba(76, 175, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
  }
}

/* ---------------------------------------------------------------------------
   Morgan's Morphing Masks — button + picker modal
   --------------------------------------------------------------------------- */

.mmm-container {
  margin: 6px 0;
}

.mmm-mobile-btn {
  background: #7c4dff !important;
  color: #fff !important;
  border-color: #651fff !important;
}

.mmm-picker-btn {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1c4e9;
  border-radius: 8px;
  background: linear-gradient(135deg, #f3e5f5, #ede7f6);
  color: #4a148c;
  font-weight: 600;
  font-size: 0.85em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, box-shadow 0.2s;
}

.mmm-picker-btn:hover {
  background: linear-gradient(135deg, #e8d5f5, #d1c4e9);
  box-shadow: 0 1px 4px rgba(124, 77, 255, 0.2);
}

.mmm-picker-btn i {
  font-size: 1.1em;
}

/* Picker modal content */
.mmm-picker-intro {
  color: #555;
  font-size: 0.9em;
  line-height: 1.5;
  margin: 0 0 12px;
}

.mmm-piece-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.mmm-piece-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-size: 0.95em;
}

.mmm-piece-row:hover {
  background: #f5f0ff;
  border-color: #d1c4e9;
}

.mmm-piece-row input[type="checkbox"] {
  accent-color: #7c4dff;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.mmm-piece-row i {
  color: #7c4dff;
  width: 20px;
  text-align: center;
}

.mmm-piece-label {
  font-weight: 500;
  color: #333;
  flex: 1;
}

.mmm-piece-price {
  color: #7c4dff;
  font-weight: 600;
  font-size: 0.85em;
  white-space: nowrap;
}

.mmm-order-only-tag {
  font-size: 0.7em;
  background: #e0e0e0;
  color: #666;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.mmm-piece-hint {
  font-size: 0.75em;
  color: #aaa;
  font-style: italic;
  white-space: nowrap;
}

.mmm-piece-wrapper {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}

/* Head options panel (mode + color) */
.mmm-head-options {
  padding: 8px 12px 10px;
  border-top: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mmm-mode-row {
  display: flex;
  gap: 6px;
}

.mmm-mode-btn {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid #d1c4e9;
  border-radius: 6px;
  background: #fff;
  color: #555;
  font-size: 0.8em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.mmm-mode-btn:hover {
  border-color: #b39ddb;
  background: #f5f0ff;
}

.mmm-mode-btn.selected {
  border-color: #7c4dff;
  background: #ede7f6;
  color: #4a148c;
  font-weight: 600;
}

.mmm-option-label {
  font-size: 0.8em;
  font-weight: 600;
  color: #666;
  display: block;
  margin-bottom: 3px;
}

.mmm-color-section {
  margin-top: 2px;
}

.mmm-color-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mmm-color-btn {
  width: 52px;
  height: 52px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.mmm-color-btn:hover {
  border-color: #b39ddb;
}

.mmm-color-btn.selected {
  border-color: #7c4dff;
  box-shadow: 0 0 0 2px rgba(124, 77, 255, 0.3);
}

.mmm-color-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 5px;
}

.mmm-piece-wrapper:hover {
  border-color: #d1c4e9;
}

.mmm-piece-wrapper .mmm-piece-row {
  border: none;
  border-radius: 0;
}

/* Contextual "Get your masks" button in sidebar */
.mmm-order-container {
  margin: 4px 0 6px;
}

.mmm-order-btn {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid #d1c4e9;
  border-radius: 8px;
  background: #f5f0ff;
  color: #7c4dff;
  font-weight: 600;
  font-size: 0.82em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s, box-shadow 0.2s;
}

.mmm-order-btn:hover {
  background: #ede7f6;
  box-shadow: 0 1px 4px rgba(124, 77, 255, 0.2);
}

/* Order modal */
.mmm-order-modal h3 {
  color: #4a148c;
  font-size: 1em;
  margin: 0 0 10px;
}

.mmm-order-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.mmm-order-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
}

.mmm-order-item-row .mmm-order-item-name {
  flex: 1;
  font-weight: 500;
  color: #333;
  font-size: 0.95em;
}

.mmm-order-item-row .mmm-order-item-name i {
  color: #7c4dff;
  width: 20px;
  text-align: center;
  margin-right: 6px;
}

.mmm-order-item-row .mmm-order-item-price {
  color: #7c4dff;
  font-weight: 600;
  font-size: 0.9em;
}

.mmm-order-finish-select {
  padding: 5px 8px;
  border: 1px solid #d1c4e9;
  border-radius: 6px;
  font-size: 0.85em;
  color: #333;
  background: #fff;
  cursor: pointer;
}

.mmm-order-total {
  text-align: right;
  font-size: 1.05em;
  color: #4a148c;
  padding: 8px 0;
  border-top: 1px solid #eee;
}

.mmm-order-checkout-btn {
  display: block;
  text-align: center;
  padding: 10px 20px;
  background: #7c4dff;
  color: #fff !important;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95em;
  text-decoration: none;
  transition: background 0.2s;
  margin-top: 4px;
}

.mmm-order-checkout-btn:hover {
  background: #651fff;
  text-decoration: none !important;
}

.mmm-order-divider {
  text-align: center;
  color: #aaa;
  font-size: 0.85em;
  margin: 16px 0;
  position: relative;
}

.mmm-order-divider::before,
.mmm-order-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #e0e0e0;
}

.mmm-order-divider::before { left: 0; }
.mmm-order-divider::after { right: 0; }

.mmm-order-learn-more {
  display: block;
  text-align: center;
  color: #7c4dff;
  font-weight: 500;
  font-size: 0.9em;
  text-decoration: none;
  padding: 8px;
}

.mmm-order-learn-more:hover {
  text-decoration: underline;
}

.mmm-order-learn-more i {
  margin-right: 4px;
}

/* (cart/order UI moved to /morgans-morphing-masks page) */
