* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  height: 100vh;
  display: flex;
  color: #fff;
  overflow: hidden;
}

/* ==================== SIDEBAR CUSTOMIZATIONS ==================== */
/* 
 * Sidebar layout is handled by shared-sidebar-layout.css
 * This includes: positioning, width, toggle button, collapse animation, and main content margin
 * 
 * Required HTML structure:
 * <aside class="sidebar">
 *   <button class="sidebar-toggle-btn">...</button>
 *   <div class="sidebar-content">
 *     <!-- All sidebar content goes here -->
 *   </div>
 * </aside>
 */
.sidebar {
  background: #FFFFFF;
  border-right: 1px solid #E0E0E0;
}

/* ==================== SIDEBAR SECTIONS ==================== */
.sidebar-section {
  margin-bottom: 20px;
}

.section-label {
  font-size: 0.66rem;
  font-weight: 600;
  color: #666666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* ==================== SETTINGS ==================== */
.settings-group {
  margin-bottom: 12px;
}

.settings-label {
  font-size: 0.75rem;
  color: #666666;
  margin-bottom: 6px;
  display: block;
}

/* ==================== AXIS INPUTS (Grid Size) ==================== */
.axis-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.axis-input-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.axis-label {
  font-size: 0.75rem;
  color: #666666;
  font-weight: 500;
  min-width: 55px;
}

/* ==================== NUMBER STEPPER ==================== */

/* ==================== MODE TABS ==================== */
.mode-tabs {
  display: flex;
  background: #E8E8E8;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #666666;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.mode-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.mode-tab:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #333333;
}

.mode-tab.active {
  background: linear-gradient(135deg, #B900FF 0%, #832EC5 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(185, 0, 255, 0.3);
}

.mode-tab.active svg {
  color: #fff;
}

/* ==================== OPACITY PICKER ==================== */
.opacity-picker-wrapper {
  margin-top: 12px;
}

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

.opacity-slider-track {
  flex: 1;
  height: 6px;
  background: #E8E8E8;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.opacity-slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 50%;
  background: linear-gradient(135deg, #B900FF 0%, #832EC5 100%);
  border-radius: 3px;
  pointer-events: none;
}

.opacity-slider-thumb {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  background: white;
  border: 2px solid #832EC5;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  cursor: grab;
}

.opacity-slider-thumb:active {
  cursor: grabbing;
}

.opacity-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: #333333;
  min-width: 36px;
  text-align: center;
}

/* ==================== TOOLS GRID (Modes Section) ==================== */
/* Using shared/tools-card.css */

/* Geoboard-specific layout overrides */
.tools-grid {
    gap: 6px;
    margin-bottom: 12px;
}

#selectAllActionBtn {
    grid-column: span 1;
}

#clearBtn {
    grid-column: span 1;
}

#multiSelectToggle {
    grid-column: span 3;
}

/* ==================== TRANSFORM GRID ==================== */
.transform-section .tools-grid {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

/* ==================== MULTI-SELECT SECTION ==================== */
#multiSelectSection {
    display: none;
}

/* Multi-select button in main grid */
#multiSelectToggle {
    grid-column: span 2;
}
/* ==================== TRANSFORM SECTION ==================== */
.transform-section {
  border-top: none;
  padding-top: 0;
}

/* Grid Size Section at bottom */
.grid-size-section {
    padding-top: 8px;
}
/* ==================== SIDEBAR SPACER ==================== */
.sidebar-spacer {
  flex: 1;
}

/* ==================== ACTIONS SECTION (Bottom) ==================== */
.actions-section {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid #E0E0E0;
}

/* ==================== CLEAR BUTTON (Danger Style) ==================== */
.clear-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: #FFFFFF;
  border: 2px solid #EF4444;
  border-radius: 8px;
  color: #333333;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

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

.clear-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.clear-btn svg {
  width: 14px;
  height: 14px;
  color: #EF4444;
}

/* ==================== MAIN CONTENT ==================== */
/* Main content layout is handled by shared-sidebar-layout.css */
.main-content {
  /* Geoboard-specific overrides */
  align-items: center;
  justify-content: center;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
}

/* ==================== STATS DISPLAY ==================== */
#stats-display {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: row;
  gap: 12px;
  z-index: 1000;
  pointer-events: none;
}

.stat-item {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-radius: 8px;
  padding: 8px 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(131, 46, 197, 0.15);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: auto;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: #832EC5;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #333333;
  line-height: 1;
}

.stat-unit {
  font-size: 10px;
  font-weight: 500;
  color: #888888;
}

/* ==================== BOARD CONTAINER ==================== */
.board-container {
  position: relative;
  background: transparent;
  border-radius: 16px;
  padding: 0;
  
  /* Initial size: 70% of the window size */
  /* width: 70vmin; */
  /* height: 70vmin; */
  /* REMOVED: CSS dimensions conflict with JS dynamic sizing */
  
  /* Centering */
  display: flex;
  align-items: center;
  justify-content: center;
  margin: auto;
}

/* SVG Geoboard */
.geoboard {
  /* SVG should just fill the container */
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  
  /* Center within container if aspect ratios mismatch */
  margin: auto;
}

/* ==================== PEG STYLES ==================== */
.peg {
  /* fill: #FFFFFF; */
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5)) drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.4));
  cursor: pointer;
  transition: filter 100ms ease;
  pointer-events: auto;
}

.peg:hover {
  filter: drop-shadow(0 0 8px rgba(255, 199, 0, 0.6)) drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.4));
}

.peg.active,
.peg.origin {
  fill: #FFC700;
  filter: drop-shadow(0 0 12px rgba(255, 199, 0, 0.9));
}

.peg.hover {
  filter: drop-shadow(0 0 8px rgba(185, 0, 255, 0.6)) drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.4));
}

/* ==================== RUBBER BAND LINES ==================== */
.rubber-band {
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.3));
  cursor: pointer;
  transition: opacity 100ms ease, stroke-width 100ms ease;
}

.rubber-band:hover {
  opacity: 0.7;
  stroke-width: 14;
}

.rubber-band.selected {
  stroke-dasharray: 8 4;
  animation: dash 0.5s linear infinite;
}

/* ==================== SHAPES ==================== */
.shape {
  cursor: pointer;
  transition: opacity 100ms ease, filter 100ms ease;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.shape-group {
  will-change: auto;
  pointer-events: auto;
}

.shape-group.dragging {
  will-change: transform;
  pointer-events: none;
}

.shape-group.dragging .shape {
  transition: none;
  filter: drop-shadow(3px 3px 6px rgba(0, 0, 0, 0.4));
}

.shape:hover {
  opacity: 0.8;
  filter: drop-shadow(2px 2px 6px rgba(0, 0, 0, 0.4));
}

.shape-hit-area {
  fill: transparent;
  stroke: none;
  cursor: pointer;
  pointer-events: fill;
}

.shape.selected {
  stroke: #FFC700 !important;
  stroke-width: 10 !important;
  stroke-dasharray: 20 10;
  animation: dash 0.5s linear infinite;
  filter: drop-shadow(0 0 8px rgba(255, 199, 0, 0.6));
}

.shape-group {
  cursor: pointer;
}

/* ==================== AI PROMPT DOCK ==================== */
.ai-prompt-dock {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #E0E0E0;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 1200;
  min-width: 320px;
  max-width: 720px;
  width: min(80vw, 720px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ai-prompt-dock.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
}

.ai-prompt-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ai-prompt-input {
  flex: 5 1 0;
  padding: 10px 12px;
  border: 2px solid #E0E0E0;
  border-radius: 10px;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  color: #333;
  background: #FAFAFA;
  transition: all 0.2s ease;
}

.ai-prompt-input:focus {
  outline: none;
  border-color: #832EC5;
  background: #FFF;
  box-shadow: 0 0 0 3px rgba(131, 46, 197, 0.1);
}

.ai-generate-btn {
  flex: 1 1 0;
  padding: 10px 12px;
  background: linear-gradient(135deg, #B900FF 0%, #832EC5 100%);
  border: none;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(131, 46, 197, 0.25);
}

.ai-generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(131, 46, 197, 0.35);
  filter: brightness(1.05);
}

.ai-generate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.ai-generate-btn.loading .btn-text {
  display: none;
}

.ai-generate-btn.loading .spinner {
  display: block;
}

.ai-prompt-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 0;
}

.ai-error-msg {
  color: #EF4444;
  font-size: 0.75rem;
  font-weight: 500;
}

.ai-error-msg:empty {
  display: none;
}

.ai-toggle-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  border: none;
  background: linear-gradient(135deg, #B900FF 0%, #832EC5 100%);
  color: #fff;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(131, 46, 197, 0.35);
  transition: all 0.2s ease;
  z-index: 1300;
}

.ai-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(131, 46, 197, 0.4);
}

.ai-toggle-btn.active {
  background: #E8E8E8;
  color: #333333;
  border: 1px solid #E0E0E0;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

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

/* Path preview while drawing */
.path-preview {
  pointer-events: none;
  filter: drop-shadow(1px 1px 3px rgba(0, 0, 0, 0.3));
}

.cursor-line {
  pointer-events: none;
  stroke-width: 8;
  stroke-linecap: round;
  will-change: transform;
}

/* Drawing Preview Line */
.preview-line {
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 20 10;
  fill: none;
  opacity: 0.6;
  pointer-events: none;
}

/* Shape Preview */
.vertex-handle {
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.3));
  transition: r 0.1s ease, fill 0.1s ease;
  z-index: 1000;
}

.vertex-handle:hover {
  r: 10;
  stroke-width: 3;
}

@keyframes dash {
  to {
    stroke-dashoffset: -12;
  }
}

/* ==================== RESPONSIVE ==================== */
/* Note: Sidebar width and layout responsiveness is handled by shared-sidebar-layout.css */
@media (max-width: 1100px) {
  .section-label,
  .settings-label,
  .axis-label,
  .tool-btn span,
  .action-btn span,
  .clear-btn span,
  .mode-tab span {
    display: none;
  }
  
  .mode-tabs {
    flex-direction: column;
  }
  
  .mode-tab {
    justify-content: center;
    padding: 12px;
  }
  
  .axis-inputs {
    gap: 6px;
  }
  
  .axis-input-group {
    justify-content: center;
  }
  
  .color-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .color-btn {
    width: 28px;
    height: 28px;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
  }
  
  .undo-redo-group {
    flex-direction: column;
  }
  
  .clear-btn {
    justify-content: center;
  }
  
  .board-container {
    /* Let JS control the size */
    max-width: none;
  }
}

@media (max-width: 600px) {
  .board-container {
    /* Let JS control the size */
    max-width: none;
    padding: 16px;
    border-radius: 12px;
  }
  
  .color-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== FOCUS STATES ==================== */
button:focus-visible,
.color-btn:focus-visible,
.tool-btn:focus-visible {
  outline: 2px solid #832EC5;
  outline-offset: 2px;
}


/* Save Feature Styles */
.saves-section {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

/* Custom scrollbar for sessions list */
.sessions-list::-webkit-scrollbar {
    width: 6px;
}

.sessions-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.sessions-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    gap: 8px;
}

.empty-state svg {
    width: 40px;
    height: 40px;
    color: #CCCCCC;
    opacity: 0.5;
}

.empty-state span {
    font-size: 13px;
    color: #999999;
    text-align: center;
}

.session-tile {
    display: flex;
    align-items: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 12px;
}

.session-tile:hover {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
}

.session-tile.active {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.1);
}

.session-thumbnail {
    width: 48px;
    height: 48px;
    background: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid #eee;
}

.session-info {
    flex: 1;
    min-width: 0;
}

.session-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.session-meta {
    font-size: 0.75rem;
    color: rgba(51, 51, 51, 0.5);
    display: flex;
    gap: 8px;
}

.session-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
    position: relative;
}

.session-tile:hover .session-actions {
    opacity: 1;
}

.session-action-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 4px;
    color: rgba(51, 51, 51, 0.7);
    cursor: pointer;
    transition: all 0.2s;
}

.session-action-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    color: #000;
}

.session-action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.session-menu-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.06);
    border: none;
    border-radius: 4px;
    color: rgba(51, 51, 51, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.session-menu-btn:hover {
    background: rgba(0, 0, 0, 0.14);
    color: #111111;
}

.session-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    display: none;
    flex-direction: column;
    gap: 2px;
    min-width: 150px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    z-index: 5;
}

.session-menu.open {
    display: flex;
}

.session-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #333333;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease, color 0.2s ease;
}

.session-menu-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.session-menu-item.remove {
    color: #ef4444;
}

.session-menu-item.remove:hover {
    background: rgba(239, 68, 68, 0.12);
}

.session-tile.is-hidden {
    opacity: 0.5;
}

.session-tile.is-hidden .session-thumbnail {
    filter: grayscale(0.4);
}

.save-button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #B900FF 0%, #832EC5 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(131, 46, 197, 0.3);
    margin-top: auto; /* Push to bottom of flex container */
}

.save-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(131, 46, 197, 0.4);
    filter: brightness(1.1);
}

.save-button:active {
    transform: translateY(0);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* Modal Dialog */
.modal-dialog {
    width: 90%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.2s ease;
    overflow: hidden;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-overlay.visible .modal-dialog {
    transform: scale(1) translateY(0);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    margin: 0;
}

.modal-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: #333333;
    background: #FFFFFF;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.modal-input:focus {
    outline: none;
    border-color: #832EC5;
    box-shadow: 0 0 0 3px rgba(131, 46, 197, 0.15);
}

.modal-input::placeholder {
    color: #999999;
}

.modal-message {
    font-size: 14px;
    color: #666666;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 4px;
}

/* Modal Buttons */
.modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.modal-btn-cancel {
    background: #F5F5F5;
    color: #666666;
}

.modal-btn-cancel:hover {
    background: #E8E8E8;
}

.modal-btn-confirm {
    background: linear-gradient(135deg, #B900FF 0%, #832EC5 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(131, 46, 197, 0.3);
}

.modal-btn-confirm:hover {
    box-shadow: 0 4px 12px rgba(185, 0, 255, 0.4);
    transform: translateY(-1px);
}

.modal-btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* ==================== TEMPLATES UI ==================== */

/* Section Header Row */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.section-header-row .section-label {
    margin-bottom: 0;
    flex: 1;
}

/* Load Template Button */
.load-template-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: none;
    border: 1px solid rgba(131, 46, 197, 0.3);
    border-radius: 5px;
    color: #832EC5;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.load-template-btn:hover {
    background: rgba(131, 46, 197, 0.08);
    border-color: rgba(131, 46, 197, 0.5);
}

.load-template-btn svg {
    width: 12px;
    height: 12px;
}

/* Template Popup Styles */
.template-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.template-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.template-popup {
    width: 90%;
    max-width: 520px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.2s ease;
    overflow: hidden;
}

.template-overlay.visible .template-popup {
    transform: scale(1) translateY(0);
}

.template-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #E0E0E0;
}

.template-popup-title {
    font-size: 18px;
    font-weight: 600;
    color: #333333;
    margin: 0;
}

.template-popup-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: #F5F5F5;
    color: #666666;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.template-popup-close:hover {
    background: #E8E8E8;
    color: #333333;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 16px 20px 20px;
    max-height: 400px;
    overflow-y: auto;
}

.template-card {
    background: #FFFFFF;
    border: 1px solid #E8E8E8;
    border-radius: 10px;
    padding: 16px 12px 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
}

.template-card:hover {
    border-color: #D0D0D0;
    background: #FAFAFA;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.template-card-icon {
    font-size: 32px;
    line-height: 1;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 2px;
}

.template-card-desc {
    font-size: 11px;
    color: #888888;
}
