/* Material Design Color Picker for BookGrill */

.color-picker-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--text-white);
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.color-picker-fab:hover { transform: scale(1.1); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4); }
.color-picker-fab:active { transform: scale(1.05); }
.color-picker-fab svg { width: 24px; height: 24px; }

.color-picker-panel {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: var(--bg-tertiary);
  border-top: 2px solid var(--border-primary);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  padding: 24px;
  z-index: 1000;
  transition: bottom 0.3s ease;
  max-height: 80vh;
  overflow-y: auto;
}
.color-picker-panel.active { bottom: 0; }

.color-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.color-picker-header h3 { margin: 0; padding: 0; font-size: 20px; color: var(--text-primary); }

.color-picker-close {
  width: 32px; height: 32px;
  border: none; background: transparent;
  color: var(--text-primary); font-size: 32px; line-height: 1;
  cursor: pointer; transition: color 0.2s ease; padding: 0;
}
.color-picker-close:hover { color: var(--accent-primary); }

.color-swatches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
  max-width: 500px;
}

.color-swatch {
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid transparent; cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch:focus { outline: 2px solid var(--text-white); outline-offset: 2px; }
.color-swatch.selected { border-color: var(--text-white); box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3); }
.color-swatch.selected::after {
  content: '\2713'; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); color: white;
  font-size: 24px; font-weight: bold; text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}

.color-reset-btn {
  padding: 12px 24px; background: transparent;
  border: 1px solid var(--border-primary); border-radius: 6px;
  color: var(--text-primary); font-size: 16px; cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.color-reset-btn:hover { background: var(--accent-primary); color: var(--text-white); border-color: var(--accent-primary); }

.color-picker-backdrop {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.5); z-index: 998; opacity: 0; transition: opacity 0.3s ease;
}
.color-picker-backdrop.active { display: block; opacity: 1; }

@media only screen and (max-width: 768px) {
  .color-picker-fab { bottom: 16px; right: 16px; width: 48px; height: 48px; }
  .color-picker-fab svg { width: 20px; height: 20px; }
  .color-picker-panel { padding: 20px 16px; }
  .color-swatches { gap: 12px; max-width: 100%; }
  .color-swatch { width: 44px; height: 44px; }
}

@media only screen and (max-width: 480px) {
  .color-picker-panel { padding: 16px; }
  .color-swatches { grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 10px; }
  .color-reset-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .color-picker-fab, .color-picker-panel, .color-swatch, .color-picker-backdrop { transition: none !important; }
}
