/* ===== COLOR CUSTOMIZATION PANEL ===== */

/* Panel container */
.gh-color-panel {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

/* Toggle button */
.gh-color-toggle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #549E4B, #4F9153);
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(84, 158, 75, 0.3);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gh-color-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 18px rgba(84, 158, 75, 0.4);
}

.gh-color-toggle:focus {
  outline: 3px solid #F6753D;
  outline-offset: 2px;
}

/* Panel content */
.gh-color-settings {
  position: absolute;
  top: 60px;
  right: 0;
  width: 320px;
  max-width: calc(100vw - 40px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 20px;
  transform: translateY(-10px) scale(0.95);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid #e2e8f0;
}

.gh-color-settings.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

/* Panel header */
.gh-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f1f5f9;
}

.gh-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.gh-panel-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gh-panel-close:hover {
  background: #e2e8f0;
  color: #334155;
}

/* Color groups */
.gh-color-group {
  margin-bottom: 20px;
}

.gh-color-group h4 {
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Color input container */
.gh-color-input {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.gh-color-input:hover {
  background: #f8fafc;
}

/* Color picker wrapper */
.gh-color-picker-wrapper {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.gh-color-picker-wrapper:hover {
  border-color: #549E4B;
}

.gh-color-picker {
  width: 100%;
  height: 100%;
  border: none;
  cursor: pointer;
  background: none;
}

/* Remove default color picker styles */
.gh-color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}

.gh-color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
  border: none;
  border-radius: 6px;
}

/* Color label and info */
.gh-color-info {
  flex: 1;
  min-width: 0;
}

.gh-color-label {
  font-weight: 500;
  color: #374151;
  margin-bottom: 4px;
  font-size: 13px;
}

.gh-color-value {
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  font-size: 11px;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

/* Contrast checker */
.gh-contrast-check {
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  text-align: center;
  font-weight: 500;
  transition: all 0.2s ease;
}

.gh-contrast-check.good {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.gh-contrast-check.warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.gh-contrast-check.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Action buttons */
.gh-panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid #f1f5f9;
}

.gh-action-btn {
  padding: 10px 16px;
  border: 2px solid;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.gh-action-btn.primary {
  background: #549E4B;
  border-color: #549E4B;
  color: white;
}

.gh-action-btn.primary:hover {
  background: #4F9153;
  border-color: #4F9153;
  transform: translateY(-1px);
}

.gh-action-btn.secondary {
  background: white;
  border-color: #d1d5db;
  color: #374151;
}

.gh-action-btn.secondary:hover {
  border-color: #9ca3af;
  background: #f9fafb;
  transform: translateY(-1px);
}

.gh-action-btn.danger {
  background: white;
  border-color: #ef4444;
  color: #ef4444;
}

.gh-action-btn.danger:hover {
  background: #ef4444;
  color: white;
  transform: translateY(-1px);
}

/* Preset themes */
.gh-preset-themes {
  margin-bottom: 20px;
}

.gh-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.gh-preset-theme {
  width: 100%;
  height: 60px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.gh-preset-theme:hover {
  border-color: #549E4B;
  transform: scale(1.05);
}

.gh-preset-theme.active {
  border-color: #549E4B;
  box-shadow: 0 0 0 2px rgba(84, 158, 75, 0.2);
}

.gh-preset-colors {
  display: flex;
  height: 100%;
}

.gh-preset-color {
  flex: 1;
  height: 100%;
}

.gh-preset-name {
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  text-align: center;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 4px;
  padding: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .gh-color-panel {
    top: 15px;
    right: 15px;
  }
  
  .gh-color-toggle {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
  
  .gh-color-settings {
    width: 280px;
    max-width: calc(100vw - 30px);
    padding: 16px;
  }
  
  .gh-panel-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .gh-preset-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .gh-color-settings {
    width: 260px;
    right: -10px;
  }
  
  .gh-color-input {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .gh-color-picker-wrapper {
    width: 100%;
    height: 36px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .gh-color-settings {
    border: 3px solid black;
  }
  
  .gh-color-picker-wrapper {
    border: 2px solid black;
  }
  
  .gh-action-btn {
    border-width: 3px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .gh-color-toggle,
  .gh-color-settings,
  .gh-color-input,
  .gh-color-picker-wrapper,
  .gh-action-btn,
  .gh-preset-theme {
    transition: none !important;
  }
  
  .gh-color-settings.is-open {
    transform: none;
  }
}

/* Focus management for accessibility */
.gh-color-panel :focus-visible {
  outline: 3px solid #F6753D;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link for screen readers */
.gh-skip-to-content {
  position: absolute;
  top: -40px;
  left: 6px;
  background: #549E4B;
  color: white;
  padding: 8px;
  text-decoration: none;
  border-radius: 4px;
  z-index: 10001;
  font-weight: 600;
  opacity: 0;
  transition: all 0.2s ease;
}

.gh-skip-to-content:focus {
  top: 6px;
  opacity: 1;
}

/* Loading and saved states */
.gh-saving {
  position: relative;
  overflow: hidden;
}

.gh-saving::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
  animation: gh-shimmer 1.5s infinite;
}

@keyframes gh-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.gh-saved {
  background: #dcfce7 !important;
  border-color: #16a34a !important;
  color: #166534 !important;
}

/* Tooltip for accessibility */
.gh-tooltip {
  position: relative;
  display: inline-block;
}

.gh-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 10002;
}

.gh-tooltip:hover::after,
.gh-tooltip:focus::after {
  opacity: 1;
  visibility: visible;
  bottom: calc(100% + 5px);
}