/* Custom Color Modal Styles - Google Calendar inspired */

/* Backdrop */
.custom-color-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.custom-color-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Container */
.custom-color-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  width: 90%;
  max-width: 480px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

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

/* Modal Content */
.custom-color-content {
  padding: 24px;
}

.custom-color-content h3 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 600;
  color: #202124;
}

.custom-color-desc {
  margin: 0 0 24px 0;
  font-size: 14px;
  color: #5f6368;
  line-height: 1.5;
}

/* Color Spectrum */
.color-spectrum-container {
  margin-bottom: 16px;
}

.color-spectrum {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 8px;
  cursor: crosshair;
  background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,1)),
              linear-gradient(to right, rgba(255,255,255,1), #ff0000);
  overflow: hidden;
  outline: none;
}

.color-spectrum:focus {
  box-shadow: 0 0 0 2px #1a73e8;
}

.spectrum-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
}

/* Hue Slider */
.hue-slider-container {
  margin-bottom: 20px;
}

.hue-slider {
  position: relative;
  width: 100%;
  height: 16px;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(to right,
    #ff0000 0%,
    #ffff00 17%,
    #00ff00 33%,
    #00ffff 50%,
    #0000ff 67%,
    #ff00ff 83%,
    #ff0000 100%
  );
  outline: none;
}

.hue-slider:focus {
  box-shadow: 0 0 0 2px #1a73e8;
}

.hue-handle {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
}

/* Color Input Row */
.color-input-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.color-preview {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #dadce0;
  flex-shrink: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.hex-input-container {
  flex: 1;
}

.hex-input-container label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #5f6368;
  margin-bottom: 4px;
}

.hex-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Roboto Mono', 'Courier New', monospace;
  color: #202124;
  transition: all 0.2s ease;
  outline: none;
}

.hex-input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.hex-input.error {
  border-color: #d93025;
  background: #fce8e6;
}

.hex-input::placeholder {
  color: #9aa0a6;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Action Buttons */
.custom-color-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #e8eaed;
}

.custom-color-actions button {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.btn-cancel {
  background: transparent;
  border: 1px solid #dadce0;
  color: #5f6368;
}

.btn-cancel:hover {
  background: #f8f9fa;
  border-color: #c6c6c6;
}

.btn-cancel:focus {
  box-shadow: 0 0 0 2px rgba(95, 99, 104, 0.2);
}

.btn-save {
  background: #1a73e8;
  border: 1px solid #1a73e8;
  color: #ffffff;
}

.btn-save:hover {
  background: #1765cc;
  border-color: #1765cc;
}

.btn-save:focus {
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.3);
}

.btn-save:active,
.btn-cancel:active {
  transform: scale(0.98);
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .custom-color-modal {
    width: 95%;
    max-width: none;
  }
  
  .custom-color-content {
    padding: 20px;
  }
  
  .color-spectrum {
    height: 180px;
  }
  
  .custom-color-actions {
    flex-direction: column-reverse;
  }
  
  .custom-color-actions button {
    width: 100%;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .custom-color-modal {
    background: #2d2e30;
  }
  
  .custom-color-content h3 {
    color: #e8eaed;
  }
  
  .custom-color-desc {
    color: #9aa0a6;
  }
  
  .hex-input {
    background: #3c4043;
    border-color: #5f6368;
    color: #e8eaed;
  }
  
  .hex-input:focus {
    border-color: #8ab4f8;
    box-shadow: 0 0 0 2px rgba(138, 180, 248, 0.2);
  }
  
  .hex-input.error {
    border-color: #f28b82;
    background: #5c2b29;
  }
  
  .color-preview {
    border-color: #5f6368;
  }
  
  .btn-cancel {
    border-color: #5f6368;
    color: #9aa0a6;
  }
  
  .btn-cancel:hover {
    background: #3c4043;
    border-color: #80868b;
  }
  
  .btn-save {
    background: #8ab4f8;
    border-color: #8ab4f8;
    color: #202124;
  }
  
  .btn-save:hover {
    background: #aecbfa;
    border-color: #aecbfa;
  }
  
  .custom-color-actions {
    border-top-color: #5f6368;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .custom-color-modal {
    border: 2px solid currentColor;
  }
  
  .spectrum-handle,
  .hue-handle {
    border-width: 4px;
  }
  
  .hex-input:focus,
  .color-spectrum:focus,
  .hue-slider:focus {
    box-shadow: 0 0 0 3px currentColor;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .custom-color-backdrop,
  .custom-color-modal,
  .custom-color-actions button {
    transition: none;
  }
}
