/* =============================================
   FONT & COLOR SWITCHER COMPONENT
   Lindsey's Little Pet Care
   Version 3.0 - Grouped Font Selection
   ============================================= */

/* =============================================
   NAVBAR ICON BUTTON
   ============================================= */

.font-switcher-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.2s ease, transform 0.2s ease;
  color: #fff;
  margin-right: 12px;
}

.font-switcher-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.font-switcher-btn .icon-text {
  font-size: 16px;
  font-weight: 700;
  font-family: Georgia, serif;
  letter-spacing: -0.5px;
}

/* =============================================
   MODAL OVERLAY
   ============================================= */

.font-modal-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* =============================================
   MODAL CONTAINER
   ============================================= */

.font-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  min-width: 360px;
  min-height: 300px;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: auto;
  resize: both;
}

.font-modal.active {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

/* When modal has been dragged, switch from centered to absolute positioning */
.font-modal.dragged {
  transform: none;
  max-width: none;
  max-height: none;
}

.font-modal.dragged.active {
  transform: none;
}

.font-modal.dragging {
  transition: none;
  user-select: none;
}

/* =============================================
   MODAL HEADER
   ============================================= */

.font-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  cursor: grab;
  touch-action: none;
  border-radius: 16px 16px 0 0;
}

.font-modal-header:active {
  cursor: grabbing;
}

.font-modal.dragging .font-modal-header {
  cursor: grabbing;
}

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

.font-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.font-modal-popout,
.font-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: background-color 0.2s ease;
}

.font-modal-popout:hover,
.font-modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}

/* =============================================
   MODAL TABS
   ============================================= */

.font-modal-tabs {
  display: flex;
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.font-modal-tab {
  flex: 1;
  padding: 14px 20px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.font-modal-tab:hover {
  color: #374151;
  background: #f9fafb;
}

.font-modal-tab.active {
  color: #f88e24;
  border-bottom-color: #f88e24;
}

/* =============================================
   TAB CONTENT
   ============================================= */

.font-tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.font-tab-content.active {
  display: flex;
}

/* =============================================
   FONT GROUPS PANEL
   ============================================= */

.font-groups-container {
  flex: 1;
  overflow-y: auto;
  max-height: 350px;
}

.font-group-section {
  border-bottom: 1px solid #e5e7eb;
}

.font-group-section:last-child {
  border-bottom: none;
}

.font-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #f9fafb;
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none;
}

.font-group-header:hover {
  background: #f3f4f6;
}

.font-group-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.font-group-name {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 10px;
}

.font-group-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: #f88e24;
  color: #fff;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
}

.font-group-elements {
  font-size: 12px;
  color: #6b7280;
  margin-left: 38px;
}

.font-group-current {
  display: flex;
  align-items: center;
  gap: 8px;
}

.font-group-current-name {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.font-group-expand-icon {
  width: 20px;
  height: 20px;
  color: #9ca3af;
  transition: transform 0.2s ease;
}

.font-group-section.expanded .font-group-expand-icon {
  transform: rotate(180deg);
}

.font-group-section.expanded .font-group-header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

/* =============================================
   FONT SELECTION PANEL (Expanded)
   ============================================= */

.font-selection-panel {
  display: none;
  padding: 16px 24px;
  background: #fff;
}

.font-group-section.expanded .font-selection-panel {
  display: block;
}

.font-group-search {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.font-group-search:focus {
  border-color: #f88e24;
  box-shadow: 0 0 0 3px rgba(248, 142, 36, 0.1);
}

.font-group-categories {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.font-category-pill {
  padding: 5px 12px;
  border: none;
  background: #e5e7eb;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #4b5563;
}

.font-category-pill:hover {
  background: #d1d5db;
}

.font-category-pill.active {
  background: #f88e24;
  color: #fff;
}

.font-options-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px 0;
}

/* ===== QUICK PICKS ===== */
.font-quick-picks {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.font-quick-picks-label,
.font-all-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.font-quick-picks-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.font-quick-btn {
  padding: 8px 14px;
  border: 2px solid #e5e7eb;
  background: #fff;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #374151;
}

.font-quick-btn:hover {
  border-color: #f88e24;
  background: #fff7ed;
}

.font-quick-btn.selected {
  border-color: #f88e24;
  background: #f88e24;
  color: #fff;
}

/* ===== ALL FONTS GRID ===== */
.font-buttons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.font-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  border: 2px solid #e5e7eb;
  background: #fff;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.font-btn:hover {
  border-color: #f88e24;
  background: #fff7ed;
  transform: translateY(-1px);
}

.font-btn.selected {
  border-color: #f88e24;
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(248, 142, 36, 0.15);
}

.font-btn-name {
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  margin-bottom: 2px;
}

.font-btn-category {
  font-size: 10px;
  color: #9ca3af;
  text-transform: capitalize;
}

/* =============================================
   LIVE PREVIEW PANEL
   ============================================= */

.live-preview-panel {
  padding: 16px 24px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-top: 1px solid #e5e7eb;
}

.live-preview-title {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.live-preview-content {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.preview-display {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-color-heading);
}

.preview-heading {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-color-heading);
}

.preview-body {
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 10px;
  color: var(--text-color-primary);
}

.preview-ui-elements {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.preview-button {
  padding: 6px 14px;
  background: #f88e24;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: default;
}

.preview-nav-item {
  font-size: 12px;
  color: #5271ff;
  text-decoration: none;
  cursor: default;
}

.preview-input {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 12px;
  width: 100px;
}

/* =============================================
   COLOR GRID (Tab 2)
   ============================================= */

.color-grid-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  max-height: 450px;
}

.color-group-tabs-section {
  margin-bottom: 12px;
}

.color-tabs-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin-bottom: 4px;
}

.color-group-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.color-group-tab {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  color: #374151;
  transition: all 0.15s ease;
}

.color-group-tab:hover {
  background: #f3f4f6;
}

.color-group-tab.active {
  border-color: #f88e24;
  background: #fff7ed;
  color: #f88e24;
  font-weight: 600;
}

.color-group-info {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 12px;
}

.color-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e5e7eb;
}

.color-section-title:first-child {
  margin-top: 0;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.color-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  background: #f9fafb;
}

.color-item:hover {
  background: #f3f4f6;
  transform: translateY(-2px);
}

.color-item.selected {
  border-color: #f88e24;
  background: #fff7ed;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-bottom: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border: 2px solid #fff;
}

.color-name {
  font-size: 10px;
  font-weight: 500;
  color: #374151;
  text-align: center;
  line-height: 1.2;
}

.color-value {
  font-size: 9px;
  color: #9ca3af;
  font-family: monospace;
}

/* =============================================
   MODAL FOOTER
   ============================================= */

.font-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: #f9fafb;
}

.current-selections {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selection-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  font-size: 10px;
  color: #374151;
}

.selection-badge-label {
  color: #9ca3af;
}

.selection-badge-value {
  font-weight: 600;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-reset-btn {
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #374151;
}

.font-reset-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* =============================================
   ICONS TAB
   ============================================= */

.icon-tab-header {
  padding: 16px 24px 0;
  background: #fff;
}

.icon-search {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.icon-search:focus {
  border-color: #f88e24;
  box-shadow: 0 0 0 3px rgba(248, 142, 36, 0.1);
}

.icon-category-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.icon-category-pill {
  padding: 5px 12px;
  border: none;
  background: #e5e7eb;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #4b5563;
}

.icon-category-pill:hover {
  background: #d1d5db;
}

.icon-category-pill.active {
  background: #f88e24;
  color: #fff;
}

.icon-count {
  font-size: 11px;
  color: #9ca3af;
  padding-bottom: 8px;
}

.icon-grid-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px 16px;
  max-height: 450px;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.icon-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px 8px 12px;
  text-align: center;
  background: #fff;
  transition: all 0.2s ease;
}

.icon-card:hover {
  border-color: #f88e24;
  background: #fff7ed;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}

.icon-card-preview {
  width: 64px;
  height: 64px;
  margin: 0 auto 8px;
  color: #f88e24;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  padding: 0;
}

.icon-card-preview svg {
  width: 100%;
  height: 100%;
}

.icon-card-preview .icon-card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  border-radius: 0 !important;
}

/* Branding assets get dark background for logo/paw visibility */
.icon-card--branding .icon-card-preview {
  width: 64px;
  height: 64px;
  background: #1a1a1a;
  border-radius: 0;
  padding: 0;
  overflow: visible;
}

/* Downloaded/iconsax icons get white background with black line rendering */
.icon-card--file-light .icon-card-preview {
  width: 64px;
  height: 64px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0;
  padding: 0;
  overflow: visible;
}

.icon-card--file-light .icon-card-preview img {
  filter: brightness(0);
}

.icon-card-name {
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
  line-height: 1.3;
}

.icon-card-meta {
  font-size: 10px;
  color: #9ca3af;
  margin-bottom: 8px;
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: 5px;
}

.icon-file-type {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: #374151;
  color: #d1d5db;
}

.icon-file-type[data-ext] { background: #374151; }


.icon-card-actions {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.icon-copy-btn {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.icon-copy-btn:hover {
  border-color: #f88e24;
  background: #fff7ed;
  color: #f88e24;
}

.icon-copy-btn.copied {
  background: #f88e24;
  color: #fff;
  border-color: #f88e24;
}

.icon-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #9ca3af;
  font-size: 14px;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 640px) {
  .font-modal {
    width: 95%;
    max-height: 95vh;
  }
  
  .font-group-header {
    padding: 12px 16px;
  }
  
  .font-selection-panel {
    padding: 12px 16px;
  }
  
  .font-buttons-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .font-quick-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  
  .color-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .live-preview-panel {
    padding: 12px 16px;
  }
  
  .preview-display {
    font-size: 20px;
  }
  
  .preview-heading {
    font-size: 14px;
  }
  
  .current-selections {
    width: 100%;
    justify-content: center;
  }
  
  .font-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }
  
  .font-reset-btn {
    width: 100%;
    text-align: center;
  }

  .icon-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .icon-tab-header {
    padding: 12px 16px 0;
  }

  .icon-grid-container {
    padding: 12px 16px 16px;
  }
}

@media (max-width: 480px) {
  .font-group-current-name {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .font-group-elements {
    display: none;
  }
  
  .color-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }
  
  .color-item {
    padding: 8px 4px;
  }
  
  .color-swatch {
    width: 30px;
    height: 30px;
  }

  .icon-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }

  .icon-card {
    padding: 12px 6px 8px;
  }

  .icon-card-preview {
    width: 56px;
    height: 56px;
  }

  .icon-card--branding .icon-card-preview,
  .icon-card--file-light .icon-card-preview {
    width: 64px;
    height: 64px;
  }

  .icon-card-name {
    font-size: 11px;
  }

  .icon-copy-btn {
    font-size: 9px;
    padding: 2px 6px;
  }
}
