/* ========================================= */
/* COLOR TOOL SPECIFIC STYLES              */
/* ========================================= */

/* Color Palette Items */
.color-item {
    margin-bottom: 1.5rem;
  }
  
  .color-main-swatch {
    height: 5.85rem;
    border-radius: var(--border-radius-lg);
    position: relative;
    padding: 1rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  
  .color-main-swatch:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
  
  .color-main-swatch.active {
    box-shadow: 0 0 0 2px var(--color-primary), var(--shadow-md);
  }
  
  .swatch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }
  
  .color-name {
    font-weight: 500;
    font-size: 0.875rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }
  
  .color-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.75rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }
  
  .swatch-controls {
    display: flex;
    gap: 0.5rem;
  }
  
  .edit-color-btn,
  .delete-color-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
  }
  
  .edit-color-btn:hover,
  .delete-color-btn:hover {
    background: rgba(255, 255, 255, 0.3);
  }
  
  .edit-color-btn svg,
  .delete-color-btn svg {
    width: 0.75rem;
    height: 0.75rem;
    color: inherit;
  }
  
  .shade-row {
    display: flex;
    height: 0.75rem;
    border-radius: var(--border-radius-md);
    overflow: hidden;
  }
  
  .shade-preview {
    flex: 1;
  }
  
  .add-color-btn {
    height: 5rem;
    border-radius: var(--border-radius-lg);
    border: 2px dashed var(--color-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
  }
  
  .add-color-btn:hover {
    background-color: var(--color-background-alt);
    border-color: var(--color-primary);
    color: var(--color-primary);
  }
  
  .add-color-btn svg {
    width: 1.5rem;
    height: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-light);
  }
  
  .add-color-btn:hover svg {
    color: var(--color-primary);
  }
  
  .color-palette-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
  }
  
  /* Color Preview Display */
  .shade-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
  }
  
  .preview-header {
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
  }
  
  .preview-header h3 {
    font-size: 1rem;
    font-weight: 500;
  }
  
  .shade-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .shade-display {
    height: 5rem;
    border-radius: var(--border-radius-md);
    position: relative;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
  }
  
  .shade-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .shade-name {
    font-weight: 500;
    font-size: 0.75rem;
  }
  
  .shade-value {
    font-family: 'Roboto Mono', monospace;
    font-size: 0.6875rem;
  }
  
  .copy-shade-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
  }
  
  .shade-display:hover .copy-shade-btn {
    opacity: 1;
  }
  
  .copy-shade-btn:hover {
    background: rgba(255, 255, 255, 0.3);
  }
  
  .copy-shade-btn svg {
    width: 0.75rem;
    height: 0.75rem;
  }
  
  .hsl-info {
    font-size: 0.6875rem;
    color: var(--color-text-light);
    font-family: 'Roboto Mono', monospace;
    display: flex;
    gap: 0.25rem;
  }
  
  .hsl-info span {
    color: var(--color-primary);
    font-weight: 500;
  }
  
  /* Mode Selector Styles */
  .color-mode-selector {
    position: relative;
    z-index: 50;
  }
  
  .color-mode-selector-btn {
    display: flex;
    align-items: center;
    background: linear-gradient(to right, var(--brand), var(--brand-light));
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 170px;
    height: 2.5rem;
  }
  
  .color-mode-selector-btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
  
  .color-mode-selector-btn:active {
    transform: translateY(0);
  }
  
  .mode-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 0.25rem;
    border-radius: var(--border-radius-md);
  }
  
  .mode-icon svg {
    width: 1rem;
    height: 1rem;
    color: white;
  }
  
  .mode-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    flex: 1;
  }
  
  .mode-title {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
  }
  
  .color-mode-version {
    font-size: 0.675rem;
    opacity: 0.9;
  }
  
  .mode-caret {
    width: 0.875rem;
    height: 0.875rem;
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
  }
  
  .color-mode-selector.open .mode-caret {
    transform: rotate(180deg);
  }
  
  /* Dropdown Panel */
  .mode-dropdown {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    width: 280px;
    min-width: 100%;
    background-color: var(--color-white);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--color-border);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    overflow: hidden;
    padding: 0.5rem;
    z-index: 1000;
  }
  
  .mode-dropdown:before {
    content: '';
    position: absolute;
    top: -6px;
    left: 24px;
    width: 12px;
    height: 12px;
    background: var(--color-white);
    border-left: 1px solid var(--color-border);
    border-top: 1px solid var(--color-border);
    transform: rotate(45deg);
  }
  
  .color-mode-selector.open .mode-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  
  /* Mode Options */
  .color-mode-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border-radius: var(--border-radius-md);
    margin-bottom: 0.25rem;
  }
  
  .color-mode-option:last-child {
    margin-bottom: 0;
  }
  
  .color-mode-option:hover {
    background-color: var(--color-background-alt);
  }
  
  .color-mode-option.active {
    background-color: rgba(217, 113, 78, 0.08);
  }
  
  .mode-option-content {
    display: flex;
    align-items: center;
    width: 100%;
  }
  
  .option-details {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
  
  .option-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.25rem;
  }
  
  .color-mode-option.active .option-title {
    color: var(--color-primary);
  }
  
  .option-desc {
    font-size: 0.7rem;
    color: var(--color-text-light);
    line-height: 1.3;
  }
  
  .option-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    margin-left: 0.5rem;
    background-color: var(--color-primary);
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    flex-shrink: 0;
  }
  
  .option-indicator svg {
    width: 0.875rem;
    height: 0.875rem;
    color: white;
  }
  
  .color-mode-option.active .option-indicator {
    opacity: 1;
  }
  
  /* Tab Button Styling */
  .color-tab-btn.active {
    background-color: var(--color-white);
    box-shadow: var(--shadow-sm);
  }
  
  .color-tab-btn.active .tab-icon {
    color: var(--color-primary);
  }
  
  /* Color Edit Modal */
  .color-edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
  }
  
  .modal-content {
    background-color: var(--color-white);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
  }
  
  .modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
  }
  
  .close-modal-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-light);
  }
  
  .close-modal-btn svg {
    width: 1.25rem;
    height: 1.25rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  .form-group {
    margin-bottom: 1rem;
  }
  
  .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
  }
  
  .color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  
  .color-input-wrapper input[type="color"] {
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    cursor: pointer;
  }
  
  .color-input-wrapper input[type="text"] {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    font-family: 'Roboto Mono', monospace;
  }
  
  .modal-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
  }
  
  .cancel-btn {
    padding: 0.5rem 1rem;
    background-color: var(--color-background-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    cursor: pointer;
  }
  
  .save-btn {
    padding: 0.5rem 1rem;
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    cursor: pointer;
  }
  
  /* Export Buttons */
  .export-tailwind-btn,
  .export-scss-btn {
    padding: 0.5rem 1rem;
    background-color: var(--color-background-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all 0.2s;
  }
  
  .export-tailwind-btn:hover,
  .export-scss-btn:hover {
    background-color: var(--color-border);
  }
  
  /* Color Chips in Color Picker */
  .palette-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }
  
  .color-chip {
    width: 2rem;
    height: 2rem;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    border: 1px solid var(--color-border);
    transition: transform 0.2s;
  }
  
  .color-chip:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
  }
  
  /* Accessibility Check Styles */
  .contrast-status {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
  }
  
  .contrast-status.pass {
    background-color: var(--color-success);
  }
  
  .contrast-status.fail {
    background-color: var(--color-error);
  }
  
  .contrast-status.warning {
    background-color: var(--color-warning);
  }
  
  /* Color View Containers */
  #color-preview-display {
    padding: 1.5rem;
  }
  
  .real-world-placeholder {
    padding: 3rem;
    text-align: center;
    color: var(--color-text-light);
  }
  
  /* Dark Mode Adjustments */
  [data-theme="dark"] .mode-dropdown,
  [data-theme="dark"] .mode-dropdown:before {
    background-color: var(--color-white);
    border-color: var(--color-border);
  }
  
  [data-theme="dark"] .color-mode-option:hover {
    background-color: var(--color-3);
  }
  
  [data-theme="dark"] .size-row {
    background-color: #323232;
  }
  
  /* Responsive Adjustments */
  @media (max-width: 640px) {
    .mode-dropdown {
      width: 250px;
    }
    
    .color-mode-option {
      padding: 0.625rem 0.875rem;
    }
    
    .option-title {
      font-size: 0.8rem;
    }
    
    .shade-container {
      grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
  }
/* ========================================= */
/* HORIZONTAL COLOR PREVIEW STYLES          */
/* ========================================= */

/* Container for the horizontal shades */
.horizontal-shades {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 0 !important;
  margin-top: 1rem;
  width: 100%;
  aspect-ratio: 5 / 1; /* Adjust ratio as needed: width/height */
  min-height: 200px; 
  max-height: 40vh; 
}

/* Individual shade items */
.horizontal-shade-item {
  flex: 1; /* Equal width for all color shades */
  height: 100%;
  margin: 0;
  padding: 0;
  transition: flex 0.3s ease; /* Smooth resize transition */
}

/* Optional: Hover effect to emphasize the current shade */
.horizontal-shade-item:hover {
  flex: 1.2; /* Slightly expand on hover */
}

/* Color display block */
.horizontal-shade-display {
  cursor: pointer;
  height: 100% !important;
  border-radius: 0 !important; /* Remove border radius for connected blocks */
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Position content at bottom */
  align-items: center;
  padding: 1rem 1rem 2rem 1rem;
  box-shadow: none !important; /* Remove individual shadows */
  position: relative;
  transition: all 0.3s ease;
}

.horizontal-shade-display .shade-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 0;
  width: 100%; /* Full width to accommodate different hex lengths */
  z-index: 1; /* Ensure text is above other elements */
}

/* Style for shade number */
.shade-number {
  font-weight: 500;
  font-size: clamp(0.75rem, 2vw, 1.15rem); 
  margin-bottom: 0.25rem;
}

/* Style for hex value */
.horizontal-shade-display .shade-value {
  font-family: 'Roboto Mono', monospace;
  font-size: clamp(0.6rem, 1.5vw, 0.795rem); 
  letter-spacing: 0.5px;
  word-break: break-all; 
}

/* Copy button positioning */
.horizontal-shade-display .copy-shade-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  /* Responsive sizing for the button */
  width: clamp(1.5rem, 2vw, 2rem);
  height: clamp(1.5rem, 2vw, 2rem);
}

.horizontal-shade-display:hover .copy-shade-btn {
  opacity: 1;
}

/* The first and last items should have rounded corners */
.horizontal-shade-item:first-child .horizontal-shade-display {
  border-top-left-radius: 8px !important;
  border-bottom-left-radius: 8px !important;
}

.horizontal-shade-item:last-child .horizontal-shade-display {
  border-top-right-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
}

/* Media query for medium-sized screens */
@media (max-width: 1024px) {
  .horizontal-shades {
    aspect-ratio: 3 / 1; /* Adjust for taller appearance on medium screens */
  }
}

/* Media query for smaller screens - adapt to 2 rows */
@media (max-width: 768px) {
  .horizontal-shades {
    flex-wrap: wrap !important;
    aspect-ratio: unset; /* Remove aspect ratio on smaller screens */
    height: auto;
  }
  
  .horizontal-shade-item {
    flex: 1 0 20%; /* Show 5 items per row on smaller screens */
    min-width: 80px;
    height: 120px; /* Fixed height for each item when wrapped */
  }
  
  /* Adjust border radius for wrapped items */
  .horizontal-shade-item:first-child .horizontal-shade-display,
  .horizontal-shade-item:nth-child(5n+1) .horizontal-shade-display {
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
  }
  
  .horizontal-shade-item:nth-child(5n) .horizontal-shade-display,
  .horizontal-shade-item:last-child .horizontal-shade-display {
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
  }
}

/* Very small screens - 3 items per row */
@media (max-width: 480px) {
  .horizontal-shade-item {
    flex: 1 0 33.333%; /* Show 3 items per row on very small screens */
    height: 100px;
  }
  
  /* Reset border radius settings */
  .horizontal-shade-item .horizontal-shade-display {
    border-radius: 0 !important;
  }
  
  /* Adjust border radius for the 3-column layout */
  .horizontal-shade-item:first-child .horizontal-shade-display,
  .horizontal-shade-item:nth-child(3n+1) .horizontal-shade-display {
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
  }
  
  .horizontal-shade-item:nth-child(3n) .horizontal-shade-display,
  .horizontal-shade-item:last-child .horizontal-shade-display {
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
  }
}

/* Compact view for when the container is narrow */
.horizontal-shades.compact-view {
  /* More compact display with smaller padding */
}

.horizontal-shades.compact-view .shade-number {
  font-size: 0.75rem;
}

.horizontal-shades.compact-view .shade-value {
  font-size: 0.625rem;
}

/* Animation for transitions */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.horizontal-shades {
  animation: fadeIn 0.3s ease-in-out;
}

/* Improved touch support for mobile devices */
@media (pointer: coarse) {
  .horizontal-shade-display .copy-shade-btn {
    opacity: 0.7;
    width: 2rem;
    height: 2rem;
  }
}  

/* This CSS modifies the color preview display to take full height of the content card */

/* Make the color preview container fill available height */
#color-preview-display {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  height: calc(100% - 0rem); /* Account for padding */
  min-height: 400px; /* Minimum height to ensure good appearance */
}

/* Adjust the preview header to take minimal space */
.preview-header {
  flex: 0 0 auto;
  margin-bottom: 1rem;
}

/* Make the shade container expand to fill remaining space */
.horizontal-shades {
  flex: 1;
  min-height: 0; /* Important for flex child to properly shrink */
  /* Remove fixed aspect ratio to allow flexible height */
  aspect-ratio: unset; 
  /* Maintain minimum height but allow it to grow */
  min-height: 200px;
  max-height: none; /* Remove max-height constraint */
  margin-bottom: 0; /* Remove bottom margin to avoid whitespace */
}

/* Ensure the individual shade items fill the height of their container */
.horizontal-shade-item {
  height: 100%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #color-preview-display {
    min-height: 350px; /* Slightly reduced minimum height for smaller screens */
  }
  
  .horizontal-shades {
    flex-wrap: wrap !important;
    min-height: 200px;
  }
  
  .horizontal-shade-item {
    flex: 1 0 20%; /* Show 5 items per row */
    min-width: 80px;
    /* Let height adjust automatically based on content container */
    height: auto;
    min-height: 100px;
  }
}

/* Very small screens adjustments */
@media (max-width: 480px) {
  #color-preview-display {
    min-height: 300px;
  }
  
  .horizontal-shade-item {
    flex: 1 0 33.333%; /* Show 3 items per row */
    min-height: 80px;
  }
}

/* Revised Color Picker Styles */

/* Color value wrapper for improved color picker */
.color-value-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0.25rem;
  position: relative;
}

/* Color picker input styling */
.color-picker-input {
  width: 0;
  height: 0;
  opacity: 0;
  position: absolute;
  pointer-events: none;
}

/* Container for color picker icon */
.color-picker-container {
  display: flex;
  align-items: center;
  position: relative;
}

/* Color picker icon button */
.color-picker-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: inherit;
  transition: background-color 0.15s ease;
  border-radius: var(--border-radius-sm);
}

.color-picker-icon:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.color-picker-icon svg {
  width: 16px;
  height: 16px;
}

/* Format selector styles */
.format-selector {
  position: relative;
  z-index: 5;
}

/* Format button */
.format-button {
  background: transparent;
  border: none;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 2px 8px;
  cursor: pointer;
  color: inherit;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: var(--border-radius-sm);
  transition: background-color 0.15s ease;
}

.format-button::after {
  content: '▼';
  font-size: 0.5rem;
  opacity: 0.7;
}

.format-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Format Button Cycling Styles */

/* Format button container */
.format-selector {
  position: relative;
  display: flex;
  align-items: center;
}

/* Format button styling */
.format-button {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: inherit;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 50px;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.format-button:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.format-button:active {
  transform: translateY(0) scale(0.98);
}

/* Format cycling animation - fade effect */
.format-button.format-cycling {
  background: rgba(255, 255, 255, 0.2);
  animation: formatFade 0.3s ease;
}

@keyframes formatFade {
  0% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.6;
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
  }
  100% { 
    opacity: 1;
    transform: scale(1);
    background: rgba(255, 255, 255, 0.2);
  }
}

/* Format button text animation */
.format-button .format-text {
  transition: all 0.2s ease;
}

.format-button.format-cycling .format-text {
  animation: textPulse 0.3s ease;
}

@keyframes textPulse {
  0% { opacity: 1; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* Format button icon - subtle indication */
.format-button svg {
  width: 12px;
  height: 12px;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.format-button:hover svg {
  opacity: 1;
  transform: translateX(2px);
}

.format-button.format-cycling svg {
  animation: iconBounce 0.3s ease;
}

@keyframes iconBounce {
  0% { transform: translateX(0); }
  50% { transform: translateX(3px) scale(1.1); }
  100% { transform: translateX(0); }
}

/* Code format selector styles */
.code-format-selector-container {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
}

.code-format-selector {
  display: flex;
  align-items: center;
}

.code-format-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
  padding: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: var(--border-radius-sm);
  overflow: hidden;
}

.code-format-btn:hover {
  color: var(--color-primary);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.code-format-btn:active {
  transform: translateY(0) scale(0.98);
}

/* Code format cycling animation - fade effect */
.code-format-btn.format-cycling {
  background: rgba(255, 255, 255, 0.1);
  animation: codeFormatFade 0.3s ease;
}

@keyframes codeFormatFade {
  0% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.6;
    transform: scale(0.96);
    background: rgba(255, 255, 255, 0.15);
  }
  100% { 
    opacity: 1;
    transform: scale(1);
    background: rgba(255, 255, 255, 0.1);
  }
}

.code-format-btn svg {
  opacity: 0.7;
  stroke: rgba(255, 255, 255, 0.9);
  transition: all 0.2s ease;
}

.code-format-btn:hover svg {
  opacity: 1;
  stroke: var(--color-primary);
  transform: translateX(2px);
}

.code-format-btn.format-cycling svg {
  animation: codeIconPulse 0.3s ease;
}

@keyframes codeIconPulse {
  0% { opacity: 0.7; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(3px) scale(1.1); }
  100% { opacity: 0.7; transform: translateX(0); }
}

/* Improved color value input */
.color-value-input {
  background-color: rgba(255, 255, 255, 0.1);
  border: none;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.85rem;
  color: inherit;
  min-width: 90px;
  flex: 1;
  transition: all 0.2s ease;
  padding: 2px 6px;
  border-radius: var(--border-radius-md);
}

.color-value-input:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.color-value-input:focus {
  outline: none;
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

/* Color value wrapper improvements */
.color-value-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

/* Dark mode adjustments */
[data-theme="dark"] .format-button {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text);
}

[data-theme="dark"] .format-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .code-format-btn,
[data-theme="light"] .code-format-btn {
  color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .code-format-btn svg,
[data-theme="light"] .code-format-btn svg {
  stroke: rgba(255, 255, 255, 0.9);
}

/* Responsive styles */
@media (max-width: 640px) {
  .color-value-wrapper {
    flex-wrap: wrap;
  }

  .color-value-input {
    width: 100%;
    margin-top: 4px;
    font-size: 0.7rem;
  }

  .format-selector {
    order: 3;
  }

  .format-button {
    font-size: 0.7rem;
    padding: 3px 6px;
    min-width: 45px;
  }
}

/* Tooltip for format cycling (optional enhancement) */
.format-button::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.format-button:hover::after {
  opacity: 1;
}

/* Animation for smooth format transitions */
@keyframes formatCycle {
  0% { 
    transform: scale(1) rotate(0deg); 
  }
  50% { 
    transform: scale(0.95) rotate(90deg); 
  }
  100% { 
    transform: scale(1) rotate(180deg); 
  }
}

.format-cycling {
  animation: formatCycle 0.3s ease;
}

/* Remove any leftover dropdown styles */
.format-dropdown {
  display: none !important;
}

/* Name display container with edit indicator */
.color-name-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0; /* Needed for text overflow */
}

.name-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-width: 0;
}

.color-name {
  font-weight: 500;
  font-size: 0.875rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Edit name indicator */
.edit-name-indicator {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background-color 0.2s ease;
  border-radius: var(--border-radius-sm);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  flex-shrink: 0; /* Prevent shrinking */
}

.edit-name-indicator svg {
  width: 14px;
  height: 14px;
}

/* Show edit indicator on hover of the whole name area */
.color-name-wrapper:hover .edit-name-indicator,
.name-display:hover .edit-name-indicator {
  opacity: 1;
}

.edit-name-indicator:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

/* Make the edit indicator more visible for dark backgrounds */
.color-main-swatch[data-dark-background] .edit-name-indicator:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.color-main-swatch[data-light-background] .edit-name-indicator:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

/* Pro feature disabled styling */
.edit-name-indicator.pro-feature-disabled {
  cursor: not-allowed;
}

.color-name-wrapper:hover .edit-name-indicator.pro-feature-disabled,
.name-display:hover .edit-name-indicator.pro-feature-disabled {
  opacity: 0.5;
}

.edit-name-indicator.pro-feature-disabled:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Edit input styling */
.color-name-edit {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: inherit;
  width: 100%;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.color-name-edit:focus {
  outline: none;
  border-color: currentColor;
  box-shadow: 0 0 0 1px currentColor;
}

/* Tooltip for edit indicator (optional) */
.edit-name-indicator::after {
  content: attr(aria-label);
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.6875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease 0.5s;
}

.edit-name-indicator:hover::after {
  opacity: 1;
}

/* Add/update these styles in color-styles.css */

/* Make it clear that the swatch is clickable */
.color-main-swatch {
  cursor: pointer;
  transition: all 0.2s ease;
}

/* But make specific interactive elements show appropriate cursors */
.edit-name-indicator {
  cursor: pointer;
}

.color-value-input {
  cursor: text;
}

.color-picker-icon {
  cursor: pointer;
}

.format-button {
  cursor: pointer;
}

.delete-color-btn {
  cursor: pointer;
}

/* Visual feedback for the swatch */
.color-main-swatch:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.color-main-swatch.active {
  box-shadow: 0 0 0 2px var(--color-primary), var(--shadow-md);
  transform: translateY(-1px);
}

/* Ensure interactive elements don't inherit the swatch hover effect */
.edit-name-indicator:hover,
.color-value-input:hover,
.color-picker-icon:hover,
.format-button:hover,
.delete-color-btn:hover {
  transform: none;
}

/* Contrast Button Styles */
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* This positions elements at opposite ends */
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.preview-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
}

.contrast-button {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--border-radius-sm);
  transition: background-color 0.2s ease;
  width: 28px;
  height: 28px;
}

.contrast-button:hover {
  background-color: var(--color-background-alt);
}

.contrast-button svg {
  width: 16px;
  height: 16px;
  color: var(--color-text);
}

/* Dark mode adjustments */
[data-theme="dark"] .contrast-button:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Focus state for accessibility */
.contrast-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary);
}

/* Download Button Styles */
.download-button {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--border-radius-2xl);
  transition: background-color 0.2s ease;
  width: 28px;
  height: 28px;
}

.download-button:hover {
  background-color: var(--color-background-alt);
  border-radius: var(--border-radius-2xl);
}

.download-button svg {
  width: 16px;
  height: 16px;
  color: var(--color-text);
}

/* Dark mode adjustments for download button */
[data-theme="dark"] .download-button:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Focus state for accessibility */
.download-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary);
}

/* Button Container Styles */
.button-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto; /* Push buttons to the right */
}

/* Adjustment Value Display Styles */
.adjustment-value {
  background: var(--color-background-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-md);
  padding: 4px 8px;
  font-family: 'Roboto Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text);
  min-width: 32px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

/* Style positive values differently */
.adjustment-value:not(:empty) {
  background: var(--color-background-alt);
}

/* Adjust the adjustment row layout to accommodate the value display */
.adjustment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}

.adjustment-label {
  flex: 1;
  font-size: 14px;
  color: var(--color-text);
}

.adjustment-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Dark mode adjustments for adjustment values */
[data-theme="dark"] .adjustment-value {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
}

/*Contrats*/
/* ===========================================
   CONTRAST CHECKER STYLES
   ========================================= */

/* Variables for contrast checker */
:root {
  /* UI colors */
  --ui-success: #4CAF50;
  --ui-error: #F44336;
  --ui-warning: #FDB813;
  --ui-info: #3B82F6;
  
  /* Text colors */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Spacing */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  
  /* Border radius */
  --radius-2: 0.25rem;  /* 4px */
  --radius-3: 0.375rem; /* 6px */
  --radius-4: 0.5rem;   /* 8px */
  --radius-5: 0.625rem; /* 10px */
  --radius-6: 0.75rem;  /* 12px */
  --radius-7: 1rem;     /* 16px */
  
  /* Z-index layers */
  --z-elevate: 1;
  --z-dropdown: 10;
  --z-sticky: 100;
  --z-fixed: 200;
  --z-modal: 1000;
  --z-tooltip: 9999;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;

  /* Dark mode specific variables */
  --dark-bg-primary: #1E1E1E;
  --dark-bg-secondary: #2D2D2D;
  --dark-bg-tertiary: #363636;
  --dark-border: #3a3a3a;
  --dark-text-primary: #f3f4f6;
  --dark-text-secondary: #9ca3af;
}

/* ===========================================
   CONTRAST BUTTON STYLES
   ========================================= */

.contrast-button {
  background: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  width: 28px;
  height: 28px;
  margin-left: auto;
  transition: background-color var(--transition-fast);
}

.contrast-button:hover {
  background-color: var(--gray-100);
}

.contrast-button svg {
  width: 16px;
  height: 16px;
  color: var(--gray-700);
}

/* Dark mode styles for contrast button */
[data-theme="dark"] .contrast-button {
  background: var(--dark-bg-tertiary);
}

[data-theme="dark"] .contrast-button:hover {
  background-color: var(--dark-bg-secondary);
}

[data-theme="dark"] .contrast-button svg {
  color: var(--dark-text-primary);
}

/* ===========================================
   CONTRAST MODAL STYLES
   ========================================= */

.contrast-modal {
  /* Inherits overlay styles from design system */
  display: none;
}

.contrast-modal.show {
  display: flex;
  /* Other properties inherited from design system */
}

.modal-content {
  background: white;
  max-width: 1200px;
  width: 95%;
  height: auto;
  max-height: 90vh;
  min-height: 600px;
  margin: auto;
  border-radius: var(--radius-7);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--gray-100);
  position: sticky;
  top: 0;
  background: white;
  z-index: var(--z-sticky);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: var(--gray-900);
}

.close-modal {
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
  border-radius: 50%;
  line-height: 0;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
}

.close-modal:hover {
  background: var(--gray-100);
}

/* Dark mode modal styles */
[data-theme="dark"] .modal-content {
  background: var(--dark-bg-primary);
  border: 1px solid var(--dark-border);
}

[data-theme="dark"] .modal-header {
  background: var(--dark-bg-primary);
  border-bottom: 1px solid var(--dark-border);
}

[data-theme="dark"] .modal-header h2 {
  color: var(--dark-text-primary);
}

[data-theme="dark"] .close-modal {
  color: var(--dark-text-secondary);
}

[data-theme="dark"] .close-modal:hover {
  background: var(--dark-bg-tertiary);
}

/* Contrast Layout */
.contrast-layout {
  display: flex;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

/* ===========================================
   SIDEBAR STYLES
   ========================================= */

.sidebar {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--gray-100);
  padding: var(--space-8) var(--space-6);
  overflow-y: auto;
  background: white;
  position: sticky;
  left: 0;
  z-index: var(--z-elevate);
  max-height: calc(90vh - 56px);
}

.sidebar-section {
  margin-bottom: var(--space-8);
}

.sidebar-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  margin: 0 0 var(--space-6) 0;
}

.guidelines-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.guideline {
  padding: 6px 0;
  color: var(--gray-500);
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.guideline.active {
  color: var(--gray-900);
  font-weight: 500;
}

.guideline:hover {
  color: var(--gray-800);
}

.filter-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-list label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  color: var(--gray-500);
  font-size: 0.875rem;
  padding: 4px 0;
  transition: color var(--transition-fast);
}

.filter-list label:hover {
  color: var(--gray-800);
}

.filter-list input[type="radio"] {
  accent-color: var(--brand, #D9714E);
}

.filter-note {
  font-size: 0.75rem;
  color: var(--gray-500);
  line-height: 1.5;
  margin-top: var(--space-8);
  padding-top: var(--space-4);
  border-top: 1px solid var(--gray-100);
}

/* Dark mode sidebar styles */
[data-theme="dark"] .sidebar {
  background: var(--dark-bg-primary);
  border-right: 1px solid var(--dark-border);
}

[data-theme="dark"] .sidebar-section h3 {
  color: var(--dark-text-secondary);
}

[data-theme="dark"] .guideline {
  color: var(--dark-text-secondary);
}

[data-theme="dark"] .guideline.active {
  color: var(--dark-text-primary);
}

[data-theme="dark"] .guideline:hover {
  color: var(--dark-text-primary);
}

[data-theme="dark"] .filter-list label {
  color: var(--dark-text-secondary);
}

[data-theme="dark"] .filter-list label:hover {
  color: var(--dark-text-primary);
}

[data-theme="dark"] .filter-note {
  color: var(--dark-text-secondary);
  border-top: 1px solid var(--dark-border);
}

/* ===========================================
   GRID CONTAINER STYLES - UPDATED
   ========================================= */

.grid-container {
  flex: 1;
  padding: var(--space-4);
  overflow: auto;
  position: relative;
  max-height: calc(90vh - 112px);
  display: flex;
  justify-content: center; /* Center the grid for better appearance */
  width: 100%; /* Ensure the container takes full width */
  background: white;
}

/* Updated Contrast Grid */
.contrast-grid {
  display: grid;
  /* Responsive grid columns that adapt to container width */
  grid-template-columns: minmax(3.5rem, 1fr) repeat(13, minmax(3.5rem, 1fr));
  gap: 0.25rem;
  width: 100%; /* Always take full width of container */
  min-height: min-content;
  padding-bottom: 1rem;
}

/* Grid Cell Styles - Updated for better responsiveness */
.grid-cell {
  min-width: 3.5rem; /* Minimum width for cells */
  width: 100%; /* Take full width of grid cell */
  height: 0; /* Height will be determined by aspect ratio */
  padding-bottom: 100%; /* Creates square aspect ratio */
  position: relative;
  border-radius: var(--radius-5);
  color: var(--gray-900);
  background: var(--gray-50);
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform var(--transition-fast), border-radius var(--transition-fast);
}

/* Inner content for grid cells */
.grid-cell > span {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  padding: var(--space-2);
  white-space: nowrap;
}

.grid-cell.header {
  background: var(--gray-100);
  font-weight: 600;
  position: sticky;
  z-index: var(--z-sticky);
}

.grid-cell.empty {
  background: linear-gradient(
    -45deg,
    rgba(0, 0, 0, 0.06) 25%,   
    transparent 25%,
    transparent 50%,
    rgba(0, 0, 0, 0.06) 50%,
    rgba(0, 0, 0, 0.06) 75%,
    transparent 75%
  );
  background-size: 5rem 5rem;     
  background-color: white;
  border: 1px solid var(--gray-200);     
  opacity: 1;
  transition: all var(--transition-fast);
}

.grid-cell.contrast {
  cursor: pointer;
  transition: all var(--transition-fast);
}

.grid-cell.contrast:hover {
  transform: scale(1.05);
  z-index: var(--z-elevate);
  box-shadow: var(--shadow-md);
}

/* Dark mode grid styles */
[data-theme="dark"] .grid-container {
  background: var(--dark-bg-primary);
}

[data-theme="dark"] .grid-cell {
  color: var(--dark-text-primary);
}

[data-theme="dark"] .grid-cell.header {
  background: var(--dark-bg-secondary);
}

[data-theme="dark"] .grid-cell.empty {
  background: linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.08) 25%,   
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.08) 75%,
    transparent 75%
  );
  background-size: 5rem 5rem;     
  background-color: var(--dark-bg-primary);
  border: 1px solid var(--dark-border);
}

/* ===========================================
   TOOLTIP STYLES
   ========================================= */

.contrast-tooltip {
  position: fixed;
  background: white;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-6);
  padding: var(--space-6);
  max-width: 280px;
  font-size: 0.875rem;
  z-index: var(--z-tooltip);
  user-select: text;
  pointer-events: auto;
  display: none;
  color: var(--gray-800);
}

.contrast-tooltip .tooltip-header {
  margin-bottom: var(--space-4);
  font-weight: 600;
  color: var(--gray-900);
}

.contrast-tooltip .color-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-3);
}

.contrast-tooltip .color-preview {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 3rem;
  border: 1px solid var(--gray-200); 
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05); 
}

.contrast-tooltip .hex-code {
  font-family: monospace;
  cursor: pointer;
  color: var(--gray-500);
  transition: color var(--transition-fast);
}

.contrast-tooltip .hex-code:hover {
  color: var(--gray-900);
}

.contrast-tooltip .divider {
  margin-top: 1.2rem;
  border-top: 1px solid var(--gray-100);
  padding-top: var(--space-4);
}

.contrast-tooltip .contrast-display {
  display: flex;
  align-items: center;
}

.contrast-tooltip .contrast-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gray-900);
}

.contrast-tooltip .content-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 1.8rem;
  border-radius: var(--radius-2);
  margin-right: var(--space-3);
}

.contrast-tooltip .decorative-element {
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
}

.contrast-tooltip .text-icon {
  font-size: 1rem;
}

.contrast-tooltip .pass-icon {
  margin-left: var(--space-4);
  margin-top: 5px;
}

.contrast-tooltip .fail-icon {
  color: var(--ui-error);
  font-size: 1.2em;
  margin-left: var(--space-4);
}

/* Arrow styles for tooltip */
.contrast-tooltip.arrow-top:before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent white transparent;
}

.contrast-tooltip.arrow-bottom:before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 10px 10px 0 10px;
  border-style: solid;
  border-color: white transparent transparent transparent;
}

/* Dark mode tooltip styles */
[data-theme="dark"] .contrast-tooltip {
  background: var(--dark-bg-secondary);
  border: 1px solid var(--dark-border);
  color: var(--dark-text-primary);
}

[data-theme="dark"] .contrast-tooltip .tooltip-header {
  color: var(--dark-text-primary);
}

[data-theme="dark"] .contrast-tooltip .color-preview {
  border: 1px solid var(--dark-border);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .contrast-tooltip .hex-code {
  color: var(--dark-text-secondary);
}

[data-theme="dark"] .contrast-tooltip .hex-code:hover {
  color: var(--dark-text-primary);
}

[data-theme="dark"] .contrast-tooltip .divider {
  border-top: 1px solid var(--dark-border);
}

[data-theme="dark"] .contrast-tooltip .contrast-value {
  color: var(--dark-text-primary);
}

[data-theme="dark"] .contrast-tooltip.arrow-top:before {
  border-color: transparent transparent var(--dark-bg-secondary) transparent;
}

[data-theme="dark"] .contrast-tooltip.arrow-bottom:before {
  border-color: var(--dark-bg-secondary) transparent transparent transparent;
}

/* ===========================================
   RESPONSIVE STYLES - UPDATED
   ========================================= */

@media (max-width: 1024px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .sidebar {
    width: 240px;
  }

  .contrast-grid {
    grid-template-columns: minmax(3.2rem, 1fr) repeat(13, minmax(3.2rem, 1fr));
    gap: 0.15rem;
  }
  
  .grid-cell {
    min-width: 3.2rem;
  }
  
  .grid-cell > span {
    font-size: 0.7rem;
  }
}

@media (max-width: 768px) {
  .modal-content {
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin: 0;
  }

  .contrast-layout {
    flex-direction: column;
    height: calc(100vh - 56px);
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--gray-100);
    padding: var(--space-4) var(--space-6);
    max-height: 30vh;
    overflow-y: auto;
  }

  [data-theme="dark"] .sidebar {
    border-bottom: 1px solid var(--dark-border);
  }

  .grid-container {
    flex: 1;
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--space-3);
    max-height: calc(70vh - 56px);
  }

  .contrast-grid {
    grid-template-columns: minmax(3rem, 1fr) repeat(13, minmax(3rem, 1fr));
    gap: 0.15rem;
  }

  .grid-cell {
    min-width: 3rem;
  }
  
  .grid-cell > span {
    font-size: 0.7rem; 
  }

  .grid-cell.header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
  }

  .grid-cell.header:first-child {
    left: 0;
    z-index: var(--z-fixed);
  }
}

@media (max-width: 480px) {
  .contrast-grid {
    grid-template-columns: minmax(2.8rem, 1fr) repeat(13, minmax(2.8rem, 1fr));
    gap: 0.1rem;
  }
  
  .grid-cell {
    min-width: 2.8rem;
    border-radius: var(--radius-3);
  }
  
  .grid-cell > span {
    font-size: 0.65rem;
    padding: var(--space-1);
  }
  
  .grid-cell.empty {
    background-size: 3rem 3rem; 
  }
}

/* Extra small screens */
@media (max-width: 350px) {
  .contrast-grid {
    grid-template-columns: minmax(2.4rem, 1fr) repeat(13, minmax(2.4rem, 1fr));
  }
  
  .grid-cell {
    min-width: 2.4rem;
  }
  
  .grid-cell > span {
    font-size: 0.6rem;
  }
  
  .grid-cell.empty {
    background-size: 2.5rem 2.5rem; 
  }
}

/* Extra styling for height responsiveness */
@media (max-height: 800px) {
  .modal-content {
    margin: var(--space-4) auto;
  }
  
  .contrast-layout {
    min-height: 0;
  }
  
  .grid-container {
    max-height: calc(100vh - 112px);
  }
  
  .sidebar {
    max-height: calc(100vh - 112px);
  }
}

/* Improve accessibility for keyboard navigation */
.guideline:focus,
.filter-list label:focus-within,
.close-modal:focus,
.contrast-button:focus {
  outline: 2px solid var(--brand, #D9714E);
  outline-offset: 2px;
}

/* Animation for smooth transitions */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.contrast-modal.show .modal-content {
  animation: fadeIn 0.3s ease-out;
}

/* Focus visible styles for better accessibility */
.grid-cell.contrast:focus-visible {
  outline: 2px solid var(--brand, #D9714E);
  outline-offset: 2px;
  transform: scale(1.05);
}

/* z-index inherited from design system */

/* ========================================= */
/* ADVANCED COLOR OPTIONS STYLES             */
/* ========================================= */

.aco-advanced-options-wrapper {
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.aco-advanced-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  color: var(--color-text);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.875rem;
  text-align: left;
}

.aco-advanced-toggle-btn svg {
  transition: transform 0.3s ease;
}

.aco-advanced-toggle-btn.expanded svg {
  transform: rotate(180deg);
}

.aco-advanced-options-container {
  padding: 1rem;
  background-color: var(--color-background-alt);
  border-radius: var(--border-radius-md);
  margin-top: 0.5rem;
}

.aco-advanced-option {
  margin-bottom: 1.5rem;
}

.aco-advanced-option:last-child {
  margin-bottom: 0;
}

.aco-color-option-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.aco-color-option-label {
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.aco-advanced-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

/* Toggle Switch Styles */
.aco-prefix-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.aco-toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.aco-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.aco-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-border);
  transition: .3s;
  border-radius: 22px;
}

.aco-toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .aco-toggle-slider {
  background-color: var(--color-primary);
}

input:focus + .aco-toggle-slider {
  box-shadow: 0 0 1px var(--color-primary);
}

input:checked + .aco-toggle-slider:before {
  transform: translateX(18px);
}

.aco-toggle-label {
  font-size: 0.875rem;
  color: var(--color-text);
}

.aco-hint-text-smaller {
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 0.25rem;
}

/* PREFIX INPUT STYLES - FIXED */
.aco-prefix-input {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.aco-prefix-input .prefix-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding-right: 0.75rem;
  color: var(--color-text);
}

.aco-prefix-input .text-input {
  flex: 1;
  min-width: 0;
}

.aco-prefix-input input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================= */
/* SEMANTIC COLOR OPTIONS STYLES             */
/* ========================================= */

/* Semantic Colors Styling */
.aco-semantic-colors-container {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  display: none;
}

.aco-semantic-colors-container.visible {
  margin-bottom: 2.5rem;
  display: block;
}

.aco-semantic-color-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0rem;
  border-radius: var(--border-radius-sm);
  transition: background-color 0.2s;
}

.aco-semantic-color-header {
  display: flex;
  flex: 1;
  justify-content: space-between;
  align-items: center;
}

.aco-semantic-color-label {
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  display: flex;
  align-items: center;
}

.aco-semantic-color-label .aco-tooltip-icon {
  margin-left: 0.25rem;
  width: 0.875rem;
  height: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
  cursor: help;
  transition: color 0.2s;
}

.aco-semantic-color-label .aco-tooltip-icon:hover {
  color: var(--color-text);
}

.aco-semantic-color-label .aco-tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: rgba(0, 0, 0, 0.8);
  color: #fff;
  text-align: center;
  border-radius: 4px;
  padding: 5px 8px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s, visibility 0.3s;
  font-weight: normal;
  font-size: 0.75rem;
  pointer-events: none;
}

.aco-semantic-color-label .aco-tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

.aco-semantic-color-label:hover .aco-tooltip-text {
  visibility: visible;
  opacity: 1;
}

.aco-semantic-color-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
}

.aco-semantic-colors-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.aco-semantic-colors-title {
  font-size: 0.875rem;
  font-weight: 500;
}

.aco-current-theme-indicator {
  font-size: 0.75rem;
  color: var(--color-text-light);
}

.aco-theme-name {
  font-weight: 500;
  text-transform: capitalize;
}

.aco-semantic-color-preview {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.aco-semantic-color-preview:hover {
  transform: scale(1.1);
}

.aco-semantic-color-edit {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  color: var(--color-text-light);
  transition: color 0.2s ease;
}

.aco-semantic-color-edit svg {
  width: 1rem;
  height: 1rem;
}

.aco-semantic-color-edit:hover {
  color: var(--color-text);
}

.aco-transparency-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
}

.aco-transparency-btn {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background-color: var(--color-background);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s, color 0.2s;
}

.aco-transparency-btn:hover {
  background-color: var(--color-primary);
  color: var(--color-text-light);
}

.aco-transparency-btn svg {
  width: 0.75rem;
  height: 0.75rem;
}

.aco-transparency-value {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  min-width: 2rem;
  text-align: center;
}

/* Real-time Color Picker Modal with Blur Effect */
.aco-semantic-color-picker-modal {
  position: absolute;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.65);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.4); 
  border-radius: var(--border-radius-xl);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  min-width: 300px;
  max-width: 340px;
  width: 320px;
  padding: 1rem 1rem 2rem 1rem;
  transform: scale(0.95) translateY(-10px);
  opacity: 0;
  transition: all 0.2s ease-out;
  pointer-events: none;
}

.aco-semantic-color-picker-modal.show {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

.aco-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(209, 213, 219, 0.2);
}

.aco-modal-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

.aco-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.aco-modal-close:hover {
  color: var(--color-text);
  background-color: rgba(0,0,0,0.05);
}

.aco-modal-close svg {
  width: 1rem;
  height: 1rem;
}

.aco-color-selector-dropdown {
  width: 100%;
  margin-bottom: 1rem;
}

.aco-color-selector-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  display: block;
}

.aco-color-dropdown {
  width: 100%;
  padding: 0.375rem 2rem 0.375rem 0.75rem; 
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  background-color: var(--color-background);
  color: var(--color-text);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
  min-height: 2rem; 
  height: 2rem; 
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center; 
  background-repeat: no-repeat;
  background-size: 1rem; 
  appearance: none; 
  -webkit-appearance: none;
  -moz-appearance: none;
}

.aco-color-dropdown:hover,
.aco-color-dropdown:focus {
  border-color: var(--color-primary);
  outline: none;
}

/* Updated shade grid styles with proper alignment */
.aco-shade-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 0.5rem;
  align-items: start;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
}

/* Wrapper for each shade item and its label */
.aco-shade-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  width: 100%;
  min-width: 0; /* Allow shrinking */
}

/* Add margin-top to second row items */
.aco-shade-wrapper:nth-child(n+7) {
  margin-top: 0.55rem;
}

/* Shade item styles with consistent sizing */
.aco-shade-item {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aco-shade-item:hover {
  transform: scale(1.1);
  border-color: rgba(var(--color-primary-rgb, 217, 113, 78), 0.5);
}

.aco-shade-item.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb, 217, 113, 78), 0.4);
  transform: scale(1.1);
}

.aco-shade-item.custom-color {
  background: linear-gradient(45deg, 
    #ff0000 0%, #ff0000 14.28%, 
    #ff8c00 14.28%, #ff8c00 28.56%, 
    #ffd700 28.56%, #ffd700 42.84%, 
    #9acd32 42.84%, #9acd32 57.12%, 
    #00bfff 57.12%, #00bfff 71.4%, 
    #8a2be2 71.4%, #8a2be2 85.68%, 
    #ff1493 85.68%, #ff1493 100%);
  color: white;
  font-weight: 600;
  font-size: 1.2rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.aco-shade-item.custom-color:hover {
  transform: scale(1.1);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.6);
}

.aco-shade-item.custom-color.selected {
  border-color: white;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
}

/* Shade label styles with consistent sizing */
.aco-shade-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--color-text-light);
  text-align: center;
  line-height: 1;
  height: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Custom color picker styles */
.aco-custom-color-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Visual feedback for real-time changes */
.aco-shade-item:active {
  transform: scale(0.95);
}

.aco-shade-item.applying {
  animation: pulse 0.3s ease-in-out;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Responsive modal positioning */
@media (max-width: 768px) {
  .aco-semantic-color-picker-modal {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) scale(0.95);
    max-width: 300px;
    width: calc(100vw - 2rem);
  }
  
  .aco-semantic-color-picker-modal.show {
    transform: translate(-50%, -50%) scale(1);
  }
  
  .aco-shade-grid {
    gap: 0.375rem;
    max-width: 260px;
  }
  
  .aco-shade-item {
    width: 1.75rem;
    height: 1.75rem;
  }
  
  .aco-shade-label {
    font-size: 0.6rem;
    height: 0.6rem;
  }
}

/* Dark theme adjustments */
[data-theme="dark"] .aco-semantic-color-picker-modal {
  background: rgba(30, 30, 30, 0.65); /* Dark mode glass effect */
  border-color: rgba(255, 255, 255, 0.15); /* Bright, subtle border for contrast */
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .aco-modal-header {
  border-bottom-color: rgba(55, 65, 81, 0.2);
}

[data-theme="dark"] .aco-color-dropdown {
  background-color: #2a2a2a;
  border-color: #444;
  color: #e0e0e0;
}

[data-theme="dark"] .aco-modal-close:hover {
  background-color: rgba(255,255,255,0.1);
}

[data-theme="dark"] .aco-shade-label {
  color: #a1a1aa;
}


