/* Color Picker - Minimalist Dark Theme */

/* Container */
.color-app-container {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  padding-bottom: 100px;
  padding-top: 0;
}

/* Header */
/* Custom margin adjustments for color picker */
.app-header {
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

/* Picker Section */
.picker-section {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-top: 1rem;
}

.color-preview {
  width: 120px;
  height: 120px;
  border-radius: 50%; /* Circle for modern look */
  border: 4px solid #333;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s, transform 0.2s;
  flex-shrink: 0;
}

.color-preview.changing {
  transform: scale(1.05);
}

.control-group {
  display: flex;
  gap: 20px;
  /* width: 100%; Remove full width to fit in row */
  justify-content: center;
  align-items: center;
}

.input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: center;
}

.input-wrapper label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

#colorInput {
  -webkit-appearance: none;
  appearance: none;
  width: 50px;
  height: 50px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background: none;
  overflow: hidden;
}

#colorInput::-webkit-color-swatch-wrapper {
  padding: 0;
}

#colorInput::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
  border: 2px solid #555;
}

/* New Wrapper for Icon Overlay */
.color-picker-wrapper {
  position: relative;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.droplet-icon {
  position: absolute;
  pointer-events: none;
  font-size: 1.2rem;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.5));
  opacity: 0.8;
}

#hexInput {
  width: 120px;
  padding: 12px;
  text-align: center;
  background: transparent;
  border: 2px solid #333;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  transition: var(--transition-fast);
}

#hexInput:focus {
  outline: none;
  border-color: var(--game-accent-light);
}

/* Formats Section */
.formats-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: transparent; /* No card bg */
}

.format-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid #222;
}

.format-item:last-child {
  border-bottom: none;
}

.label {
  color: var(--text-muted);
  font-size: 0.9rem;
  width: 50px;
}

code {
  flex: 1;
  text-align: right;
  margin-right: 15px;
  color: var(--text-secondary);
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
}

.copy-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.6;
  transition: opacity 0.2s;
  color: var(--text-secondary);
}

.copy-icon:hover {
  opacity: 1;
  color: var(--text-primary);
}

/* Palette Section */
.palette-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.palette-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.palette-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: 1px solid #444;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

.palette-btn:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

.palette-display {
  display: flex;
  height: 40px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid #333;
}

.palette-color {
  flex: 1;
  cursor: pointer;
  transition: transform 0.2s;
}

.palette-color:hover {
  transform: scaleY(1.1);
}

/* History Section */
.history-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.history-section {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  min-height: 30px;
  width: 100%;
}

/* Reuses .palette-btn styling so it sits visually with the palette controls.
   Uses visibility (not display) when empty so the layout doesn't jump
   when colors are added or cleared. */
.history-clear {
  align-self: center;
  flex: 0 0 auto;
  padding: 6px 16px;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: 4px;
}

.history-clear:hover {
  border-color: var(--error-color);
  color: var(--error-color);
  background: rgba(255, 85, 85, 0.05);
}

.history-clear.is-invisible {
  visibility: hidden;
  pointer-events: none;
}

.history-color {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #333;
  transition: transform 0.2s;
}

.history-color:hover {
  transform: scale(1.2);
  border-color: #fff;
}

/* Mobile Media Queries */
@media (max-width: 640px) {
  .control-group {
    flex-direction: column;
  }
  .picker-section {
    flex-direction: column;
  }
}
