
/***********************************************************************************
* Navigation
***********************************************************************************/

.color-list-nav-bar {
    display: flex;
    gap: 10px;
    justify-content: space-between; /* Evenly distribute items across available space */
    align-items: center; /* Vertically center items */
    position: relative;
    margin-top: 20px;
    margin-bottom: 10px;
    justify-content: flex-start; /* Prevent items from spreading out */
    flex-wrap: wrap; /* Allows wrapping if needed */
    background-color: color-mix(in srgb, var(--theme-palette-color-7) 80%, transparent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid color-mix(in srgb, var(--theme-palette-color-6) 80%, transparent);
    border-radius: 8px;
    padding: 10px;
    z-index: calc(var(--z-index-ui) + 10);
}

.color-list-nav-bar-cell {
    flex-shrink: 0; /* Prevents shrinking */
    display: flex; /* Enable flexbox */
    align-items: center; /* Vertically center content */
    justify-content: center; /* Horizontally center content */
    height: 50px;
    padding: 2px;
    /* border: 1px solid red; */
    text-align: center;
    overflow: hidden;
    white-space: nowrap; /* Prevent wrapping */
}

/***********************************************************************************
* Main Button
***********************************************************************************/
.color-list-main-button {
    display: flex;
    background: color-mix(in srgb, var(--theme-palette-color-1) 80%, transparent);
    color: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent);
    border: none;
    border-radius: 8px;
    width: 160px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

.color-list-main-button:hover {
    background-color: color-mix(in srgb, var(--theme-palette-color-2) 80%, transparent);
}

/***********************************************************************************
* Search Field in Header
***********************************************************************************/
.color-list-nav-bar-cell.search {
    flex-grow: 1;
    flex-shrink: 1; /* allow it to shrink on small screens */
    min-width: 200px; /* fallback size for tight spaces */
    justify-content: flex-start;
}

.color-list-search-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    height: 40px;
    position: relative;
}

input[type="text"] {
    height: 40px;
    padding: 8px 12px;
    font-size: 16px;
    line-height: normal;
    border: 1px solid #ddd;
    border-radius: 8px;
    vertical-align: middle;
}

#colorListSearch {
    flex: 1;
    min-width: 100px;
    height: 100%;
    padding: 8px 12px;
    font-size: 16px;
    line-height: normal;
    border: 1px solid color-mix(in srgb, var(--theme-palette-color-5) 100%, transparent);
    border-radius: 8px;
    box-sizing: border-box;
}

#clearColorListSearch {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  font-size: 14px; /* Bigger default size */
  font-weight: bold;
  color: #e74c3c; /* Strong red */
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: none;
  transition: transform 0.2s ease, color 0.2s ease;
  transform-origin: center; /* Ensures scaling happens evenly */
}

#clearColorListSearch:hover {
  transform: translateY(-50%) scale(1.2); /* Grows without moving */
}

/***********************************************************************************
* Randomizer Button in Header
***********************************************************************************/
#colorListRandomizerButton {
    display: flex;
    background: color-mix(in srgb, var(--theme-palette-color-1) 80%, transparent);
    color: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent);
    border: none;
    border-radius: 8px;
    width: 120px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

#colorListRandomizerButton:hover {
    background-color: color-mix(in srgb, var(--theme-palette-color-2) 80%, transparent);
}

/***********************************************************************************
* Main Content
***********************************************************************************/

/* Main Content Container */
.color-list-content-container {
    position: relative;
    display: grid;
    gap: 10px; /* Space between rows */
}

/***********************************************************************************
* Rows
***********************************************************************************/
.color-list-content-row {
    display: grid;
    grid-template-columns: 20% 48% 14% 6% 6% 6%; /* Adjust column widths */
    align-items: center;
    background-color: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Add shadow to each color-list-content-row */
    border: 1px solid #ddd; /* Thin border around each color-list-content-row */
    border-radius: 8px; /* Rounded corners for each color-list-content-row */
    padding: 10px;
    overflow: hidden; /* Ensure rounded corners work */
}

.color-list-content-row-header {
    position: sticky;
    top: 120px; /* Adjust this value based on your nav bar's height + spacing */
    z-index: calc(var(--z-index-ui) + 20);
}

/* Header Row */
.color-list-content-row .color-list-content-row-header {
    font-weight: bold;
    background-color: color-mix(in srgb, var(--theme-palette-color-6) 100%, transparent);
    border-bottom: 2px solid #ccc;
}

.color-list-nav-bar.scrolled,
.color-list-content-row-header.scrolled {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    background-color: color-mix(in srgb, var(--theme-palette-color-7) 75%, transparent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); /* Optional: add subtle shadow */
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Remove alternating colors */
.color-list-content-row:nth-child(even) {
    background-color: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent); /* Remove the background color for even color-list-content-rows */
}

/* Optional: Ensure all color-list-content-rows have a uniform background color */
.color-list-content-row {
    background-color: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent); /* Set a uniform white background for all color-list-content-rows */
}

/* Row Hover Effect */
.color-list-content-row:hover {
    background-color: color-mix(in srgb, var(--theme-palette-color-6) 100%, transparent);
    transition: background-color 0.3s ease;
}

/***********************************************************************************
* Header for Rows
***********************************************************************************/
/* Header Cell */
.color-list-content-row-header .color-list-content-cell {
    display: flex;
    align-items: center; /* Vertically align title and arrows */
    justify-content: center; /* Horizontally center everything */
    cursor: pointer;
    position: relative;
    gap: 10px; /* Add space between the title and arrows */
}

/* Header Title */
.color-list-content-row-header .color-list-content-cell .header-title {
    margin-right: 5px; /* Add space between the title and arrows */
    font-weight: bold;
}

/* Sort Icon Container */
.color-list-content-row-header .color-list-content-cell .color-list-sort-icon {
    display: flex;
    flex-direction: column; /* Stack arrows vertically */
    align-items: center; /* Center-align arrows */
    font-size: 18px; /* Adjust arrow size */
    line-height: 1; /* Compact the spacing between arrows */
}

/* Default Arrow Colors */
.color-list-content-row-header .color-list-content-cell .color-list-sort-up,
.color-list-content-row-header .color-list-content-cell .color-list-sort-down {
    color: color-mix(in srgb, var(--theme-palette-color-6) 100%, transparent);
}

/* Highlight Active Arrows */
.color-list-content-row-header .color-list-content-cell.sort-asc .color-list-sort-up {
    color: color-mix(in srgb, var(--theme-palette-color-1) 100%, transparent); /* Highlight the up arrow */
}

.color-list-content-row-header .color-list-content-cell.sort-desc .color-list-sort-down {
    color: color-mix(in srgb, var(--theme-palette-color-1) 100%, transparent); /* Highlight the down arrow */
}

/***********************************************************************************
* Individual Cells
***********************************************************************************/
.color-list-content-cell {
    padding: 12px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis; /* Truncate long text */
    white-space: nowrap; /* Prevent wrapping */
    /* border: 1px solid red; */
}

.color-list-hex,
.color-list-rgb {
    display: inline-block;
    padding: 6px 12px;
    margin: 4px auto;
    border: 1px solid color-mix(in srgb, var(--theme-palette-color-5) 100%, transparent);
    border-radius: 8px;
    font-size: 16px;
    background-color: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent);
    user-select: none;

    /* Keep your existing ones */
    position: relative;
    text-align: center;
    font-weight: bold;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.color-list-hex:hover,
.color-list-rgb:hover {
    background-color: color-mix(in srgb, var(--theme-palette-color-7) 100%, transparent);
    border-color: 1px solid color-mix(in srgb, var(--theme-palette-color-5) 100%, transparent);
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}
/***********************************************************************************
* Color/EyeDropper
***********************************************************************************/
#colorListPickerButton {
    background: color-mix(in srgb, var(--theme-palette-color-1) 80%, transparent);
    color: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent);
    border: none;
    border-radius: 8px;
    width: 120px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

#colorListPickerButton:hover {
    background-color: color-mix(in srgb, var(--theme-palette-color-2) 80%, transparent);
}

.color-list-content-row.highlight {
    outline: 3px solid #ff6600;
    border-radius: 6px;
    transition: outline 0.3s ease;
}

/***********************************************************************************
* Toast Banner/Notification
***********************************************************************************/
.color-list-toast-banner {
    position: relative;
    margin: 20px 0;
    height: 50px;
    line-height: 50px;
    background-color: color-mix(in srgb, var(--pxlb-color-success-background) 100%, transparent);
    color: color-mix(in srgb, var(--pxlb-color-success-text) 100%, transparent);
    padding: 14px 24px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    z-index: calc(var(--z-index-floating) + 1100); /* Slightly above Color List Nav Bar */
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Make sure it doesn't block clicks */
}

.color-list-toast-banner.show {
    opacity: 1;
    pointer-events: auto; /* Enable click events when visible */
}

.color-list-toast-banner-close-button {
    position: absolute;
    right: 20px;
    background: transparent;
    border: none;
    color: inherit;
    font-weight: bold;
    font-size: 20px;
    cursor: pointer;
}

/***********************************************************************************
* Info Button
***********************************************************************************/
#colorListInfoButton {
    display: flex;
    background: color-mix(in srgb, var(--theme-palette-color-1) 80%, transparent);
    color: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent);
    border: none;
    border-radius: 8px;
    width: 120px;
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}

#colorListInfoButton:hover {
    background-color: color-mix(in srgb, var(--theme-palette-color-2) 80%, transparent);
}

/***********************************************************************************
 * Info Modal/Popup
***********************************************************************************/
/* Overlay */
#colorListInfoPopupBackground {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--theme-palette-color-7) 70%, transparent);
    z-index: calc(var(--z-index-popup-background) + 1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Popup Wrapper */
#colorListInfoPopupWrapper {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    max-width: 90vw;
    max-height: 90vh;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: calc(var(--z-index-popup) + 10);
}

/* Popup Content */
#colorListInfoPopup {
    background-color: color-mix(in srgb, var(--theme-palette-color-7) 100%, transparent);
    border: 1px solid var(--theme-palette-color-1);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}

/* Close Button */
#colorListInfoPopupCloseButtonContainer {
    position: absolute;
    top: -18px;
    right: -18px;
    z-index: calc(var(--z-index-popup) + 20);
}

#colorListInfoPopupCloseButton {
    background-color: color-mix(in srgb, var(--theme-palette-color-1) 100%, transparent);
    fill: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent); /* Icon color */
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease;
    z-index: calc(var(--z-index-popup) + 30);
}

/* Close Button SVG */
#colorListInfoPopupCloseButton svg {
    width: 24px; /* Set the width of the SVG icon */
    height: 24px; /* Set the height of the SVG icon */
    transition: transform 0.3s ease; /* Add transition to the SVG for smooth rotation */
}

/* Hover Effect for Close Button */
#colorListInfoPopupCloseButton:hover {
    background-color: color-mix(in srgb, var(--theme-palette-color-2) 100%, transparent);
}

#colorListInfoPopupCloseButton:hover svg {
    transform: rotate(90deg); /* Rotate by 90 degrees, adjust as needed */
}

/***********************************************************************************
* Swatch
***********************************************************************************/
.color-list-swatch-container {
    position: relative;
    display: inline-block;
    width: 100%;
    height: 80px;
}

.color-list-swatch-container,
.color-list-swatch-container * {
    box-sizing: content-box !important;
}

.color-list-swatch-container:hover .color-list-expand-button {
    opacity: 1;
}

/* Swatch Column */
.color-list-swatch {
    position: relative;
    width: 100%;
    height: 80px;
    border-radius: 8px;
    border: 1px solid color-mix(in srgb, var(--theme-palette-color-5) 100%, transparent);
}

/***********************************************************************************
* Expand Button inside Swatch Container
***********************************************************************************/
.color-list-expand-button {
    position: absolute;
    top: 50%;
    right: 40px;
    transform: translateY(-50%) scale(1); /* Default scale */
    background: none;
    border: none;
    border-radius: 8px;
    color: white;
    width: 50px;
    height: 50px;
    font-size: 30px;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease, background 0.3s ease; /* Smooth scaling and opacity transition */
    cursor: pointer;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.3);
}

.color-list-expand-button:hover {
    background: none;
    transform: translateY(-50%) scale(1.2); /* Slightly larger scale */
}

/***********************************************************************************
 * Full Color Preview (Swatch expanded to full Viewport)
***********************************************************************************/
.color-list-modal {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: calc(var(--z-index-mount-everest-peak) + 1);
}

.color-list-modal-content {
    width: 100%;
    height: 100%;
    background-color: transparent;
    position: relative;
}

.color-list-modal-close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 60px;
    color: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent);
    cursor: pointer;
    background: transparent;
    border: none;
}

.color-list-modal-close-button:hover {
    color: color-mix(in srgb, var(--theme-palette-color-7) 100%, transparent);
    transform: scale(1.2); /* Slightly larger scale */
}

/***********************************************************************************
 * Randomizer → Popup with random Swatch/Color
***********************************************************************************/
/* Overlay */
#randomColorListPopupBackground {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--theme-palette-color-7) 90%, transparent);
    z-index: calc(var(--z-index-popup-background) + 1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Popup Wrapper */
#randomColorListPopupWrapper {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    max-width: 90vw;
    max-height: 90vh;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: calc(var(--z-index-popup) + 10);
}

/* Popup Content */
#randomColorListPopup {
    background-color: color-mix(in srgb, var(--theme-palette-color-7) 100%, transparent);
    border: 1px solid var(--theme-palette-color-1);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}

#randomColorListHex,
#randomColorListRgb {
    display: inline-block;
    padding: 6px 14px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 10px;
    background-color: #f2f2f2;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

#randomColorListHex:hover,
#randomColorListRgb:hover {
    background-color: #e6e6e6;
    border-color: #aaa;
    transform: scale(1.05);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Close Button */
#randomColorListPopupCloseButtonContainer {
    position: absolute;
    top: -18px;
    right: -18px;
    z-index: calc(var(--z-index-popup) + 20);
}

#randomColorListPopupCloseButton {
    background-color: color-mix(in srgb, var(--theme-palette-color-1) 100%, transparent);
    fill: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent); /* Icon color */
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease;
    z-index: calc(var(--z-index-popup) + 30);
}

/* Close Button SVG */
#randomColorListPopupCloseButton svg {
    width: 24px; /* Set the width of the SVG icon */
    height: 24px; /* Set the height of the SVG icon */
    transition: transform 0.3s ease; /* Add transition to the SVG for smooth rotation */
}

/* Hover Effect for Close Button */
#randomColorListPopupCloseButton:hover {
    background-color: color-mix(in srgb, var(--theme-palette-color-2) 100%, transparent);
}
#randomColorListPopupCloseButton:hover svg {
    transform: rotate(90deg); /* Rotate by 90 degrees, adjust as needed */
}

/***********************************************************************************
 * Tip/Notification → Press Space Bar for random Swatch/Color
***********************************************************************************/
#colorListRandomizerNotification {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translate(-50%, 100%); /* Start off-screen */
    max-width: 800px;
    min-width: 600px;
    background-color: color-mix(in srgb, var(--pxlb-color-info-background) 100%, transparent);
    color: var(--color-info-text);
    padding: 2em 2.5em;
    gap: 1.25em;
    text-align: center;
    border: 1px solid var(--pxlb-color-info-text);
    border-radius: 20px 20px 0 0; /* Only top corners rounded */
    transition: transform 0.4s ease;
    z-index: calc(var(--z-index-notification) + 10);
}

/* Show state: slides up */
#colorListRandomizerNotification.show {
    transform: translate(-50%, 0);
}

#colorListRandomizerNotification p {
    margin: 0;
    font-size: 1.25rem; /* or try 1.125rem if too large */
    line-height: 1.4;
}

/* Close Button */
#colorListRandomizerNotificationCloseButtonContainer {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%); /* Center vertically */
    z-index: calc(var(--z-index-popup) + 20);
}

#colorListRandomizerNotificationCloseButton {
    background-color: color-mix(in srgb, var(--pxlb-color-info-text) 50%, transparent);
    fill: color-mix(in srgb, var(--theme-palette-color-8) 100%, transparent); /* Icon color */
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease;
    z-index: calc(var(--z-index-popup) + 30);
}

/* Close Button SVG */
#colorListRandomizerNotificationCloseButton svg {
    width: 24px; /* Set the width of the SVG icon */
    height: 24px; /* Set the height of the SVG icon */
    transition: transform 0.3s ease; /* Add transition to the SVG for smooth rotation */
}

/* Hover Effect for Close Button */
#colorListRandomizerNotificationCloseButton:hover {
    background-color: color-mix(in srgb, var(--pxlb-color-info-text) 100%, transparent);
}
#colorListRandomizerNotificationCloseButton:hover svg {
    transform: rotate(90deg); /* Rotate by 90 degrees, adjust as needed */
}

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

