.create-container {
    background: var(--card);
    padding: 30px;
    border-radius: 16px;
    margin: 0 auto;
}

.palette-live-preview {
    display: flex;
    height: 300px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
}

.color-preview {
    flex-grow: 1;
    transition: background-color 0.3s;
}

.color-input-group {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.color-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* --- NEW Styles for Color Picker --- */
.color-input-wrapper input[data-coloris] {
    /* Hide the actual input element completely, but keep it functional */
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.color-swatch-label {
    /* Style the label as the circular swatch */
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s;
}

.color-swatch-label:hover {
    transform: scale(1.1);
}

.color-input-wrapper span {
    font-family: Inter;
    font-weight: 700;
    font-size: 10px;
}

.submit-button {
    display: block;
    width: 100%;
    padding: 15px;
    border-radius: 8px;
    border: none;
    background: var(--accent-color);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.submit-button:hover {
    filter: brightness(1.1);
}

/* --- Custom Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--card);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal-content {
    transform: scale(0.9);
}

.modal-content h3 {
    margin: 0 0 15px 0;
    font-size: 22px;
    color: var(--fg);
}

.modal-content p {
    margin: 0 0 25px 0;
    font-size: 16px;
    color: var(--muted);
    line-height: 1.6;
}

.modal-button {
    background: var(--accent-color);
    color: #fff;
    padding: 10px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: filter 0.2s;
}

.modal-button:hover {
    filter: brightness(1.1);
}

/* --- Styles for new Direction Dropdown --- */
.palette-options-grid {
    display: flex; /* Simple flex to hold controls if you add more later */
    gap: 20px;
}

/* Reusing styles from Gradient Maker */
.gm-option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 250px; /* Constrain width of the control */
}

.gm-option-group label {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    padding-left: 5px;
}

.dropdown-container { 
    position: relative; 
}
.dropdown-menu {
    position: absolute; 
    /* Use your existing dropdown menu styles */
    /* Example minimal styles: */
    background: var(--card);
    border-radius: 8px;
    box-shadow: var(--shadow);
    z-index: 100;
    min-width: 200px;
    padding: 8px 0;
    right: 0;
    top: calc(100% + 5px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(5px);
    transition: opacity 0.2s, transform 0.2s;
}
.dropdown-menu.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Styles for the mock select button */
.gm-option-group .select-mock {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--fg);
    font-weight: 700;
    font-size: 14px;
    height: 40px;
    box-sizing: border-box;
    width: 100%;
    cursor: pointer;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Dropdown item hover (from previous fix) */
.dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 15px; 
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--fg, #333);
    text-align: left;
}
.dropdown-item:hover,
.dropdown-item:focus {
    background-color: var(--hover-bg, #f0f0f0); 
    outline: none;
}


/* --- Styles for Modal Palette Preview --- */
#errorModal #modalPreviewPalette {
    display: flex; /* Make it a flex container */
    height: 60px;  /* Small, fixed height */
    border-radius: 8px;
    margin: 15px 0 20px 0; /* Space it out */
    border: 1px solid var(--border);
    overflow: hidden;
    background: #eee; /* Fallback */
}

/* This copies the *gradient* from the main preview,
  so we just need to make sure it's visible.
*/
#errorModal #modalPreviewPalette .color-preview,
#errorModal #modalPreviewPalette .gradient-color-step {
    flex-grow: 1 !important;
    transition: none !important;
}

#modalPreviewPalette {
    display: flex; /* Ensures color blocks line up horizontally */
    width: 100%;
    height: 60px; /* Example height */
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden; 
}

.modal-color-block {
    flex-grow: 1; /* Makes each block take up an equal amount of space */
    height: 100%;
}



.modal-content-copy {
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal-content-copy {
    transform: scale(0.95);
}


.quick-view-modal {
    /* These styles replace the generic .modal-content styles for this specific modal */
    background: var(--card); /* Fallback/Default background */
    border-radius: 16px;
    box-shadow: var(--shadow);
    
    /* Layout and Size */
    text-align: left;
    max-width: 500px; 
    width: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 500px;
    
    /* CRITICAL: This is the element that receives the dynamic background color from JS */
    transition: background-color 0.3s ease;
}


/* 2. Header and Footer (Need separate, fixed backgrounds) */
.quick-view-modal .modal-header,
.quick-view-modal .modal-footer {
    background: var(--chip); /* Use a standard secondary color */
    flex-shrink: 0; 
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border); 
}


.quick-view-modal .info-label,
.quick-view-modal .info-value {
    color: #FFFFFF; 
}

.quick-view-modal.is-light-bg h4,
.quick-view-modal.is-light-bg .info-label,
.quick-view-modal.is-light-bg .info-value {
    color: #1a1a1a;
}

/* --- A. Layout and Spacing --- */

.quick-view-modal .modal-body {
    /* Ensures content area fills available space and scrolls */
    padding: 20px; /* Base padding for the data rows */
    overflow-y: auto;
    flex-grow: 1; 
}

.quick-view-modal .info-row {
    /* Ensures data rows are consistently laid out */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    margin-bottom: 15px; /* Adds spacing between rows */
}

/* Removes the border from the last row for a cleaner look */
.quick-view-modal .info-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* --- B. Header/Footer Content Styles --- */

.quick-view-modal .modal-header {
    /* Ensures header content is structured */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.quick-view-modal h4 {
    /* Styles the Quick View title */
    margin: 0;
    font-size: 16px;
    color: var(--muted); /* Inherits base color from header/footer background */
}



/* Targets the modal container when it receives the 'is-light-bg' class. */
.quick-view-modal.is-light-bg {
    /* Set the default color for everything inside the body */
    color: #1a1a1a !important; 
}

/* Ensure all relevant text elements inherit the new dark color or are forced dark. */
.quick-view-modal.is-light-bg .info-label,
.quick-view-modal.is-light-bg .info-value,
.quick-view-modal.is-light-bg .copy-btn {
    color: #1a1a1a !important; 
}

/* Ensure the dividing line is dark and visible. */
.quick-view-modal.is-light-bg .info-row {
    border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}


.quick-view-modal.is-light-bg .modal-header h4,
.quick-view-modal.is-light-bg .close-btn {
    color: #1a1a1a !important; 
}

/* --- FINAL, HIGHLY SPECIFIC OVERRIDE FOR READABILITY --- */

/* Targets ALL text elements within the Quick View body when the background is light */
.quick-view-modal.is-light-bg .modal-body div {
    color: #1a1a1a !important; 
}

/* Targets the specific data value elements */
.quick-view-modal.is-light-bg .info-label,
.quick-view-modal.is-light-bg .info-value,
.quick-view-modal.is-light-bg .copy-btn {
    color: #1a1a1a !important; 
}

/* Targets the fixed header/footer elements */
.quick-view-modal.is-light-bg .modal-header h4,
.quick-view-modal.is-light-bg .close-btn {
    color: #1a1a1a !important; 
}

/* Row divider visibility */
.quick-view-modal.is-light-bg .info-row {
    border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}

.color-input-wrapper.palette-is-locked .color-swatch-label {
    opacity: 0.5; /* Dim the swatch */
    cursor: default !important; /* Change cursor */
}

/* --- ANIMATION KEYFRAMES --- */
@keyframes spacebar-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; } /* Slightly larger and dimmer */
    100% { transform: scale(1); opacity: 1; }
}

/* --- APPLY ANIMATION TO NEW BUTTON --- */
#spacebarHintBtn {
    /* Make the button visually distinct and ensure it can be animated */
    border-color: var(--accent-color) !important;
    color: var(--accent-color) !important;
    
    /* Apply the animation */
    animation: spacebar-pulse 2s infinite ease-in-out; 
}


/* --- Trending Palettes Section --- */
.trending-palettes-section {
    margin-top: 60px;
    border-top: 1px solid var(--border);
    padding-top: 40px;
}

.trending-palettes-section h3 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 25px;
    text-align: center;
}

/* Use the same grid layout as the index page */
.trending-palettes-section .palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}



.trending-palettes-section .palette-grid, 
#trending-palettes-grid { 
    display: grid; /* RESTORE */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* RESTORE */
    gap: 25px; /* RESTORE or keep previous value */
    /* position: relative; */ /* Can remove */
}

/* Apply sizing to items within trending grid */
 .trending-palettes-section .palette-card-link {
     width: calc(33.333% - 40px); 
     margin-bottom: 60px; 
     box-sizing: border-box; 
}

