/* --- Palette Grid View --- */
.palette-grid {
    display: grid; /* RESTORE */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* RESTORE */
    gap: 25px; /* RESTORE or keep previous value */
    margin-top: 30px; 
    /* position: relative; */ /* Can remove */
}

.palette-card-link {
    text-decoration: none;
    color: inherit;
    display: block; 
    /* --- REMOVE MASONRY SIZING --- */
    /* width: calc(33.333% - 17px); */ /* REMOVE */
    /* margin-bottom: 25px; */ /* REMOVE */
    /* box-sizing: border-box; */ /* Can remove if not needed otherwise */
    /* --- END REMOVE --- */
}



.palette-card {
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    /* Use flexbox to control the inner sections */
    display: flex;
    flex-direction: column;
    height: 100%; /* Make card fill the link's space */
}



.color-strip {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: copy;
    transition: flex-grow 0.3s ease;
    flex-direction: column;
}

.color-strip:hover {
    flex-grow: 1.5; /* Slightly expand on hover */
}

.color-strip-overlay.is-light-bg .color-hex-hover {
    color: rgba(0, 0, 0, 0.8);
    background: rgba(255, 255, 255, 0.3);
}


.palette-card-link:hover .palette-card {
    transform: translateY(-8px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.color-hex-hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.2);
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none; /* This prevents the label from blocking mouse events */
}


/* --- Palette Detail View --- */
/* --- Palette Detail View --- */
.palette-detail-view {
    display: flex;
    /* Default to COLUMN (horizontal rows) for mobile */
    flex-direction: column; 
    height: 80vh; 
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
}

/* NEW: Media query for tablets and desktops (768px and wider) */
@media (min-width: 768px) {
    .palette-detail-view {
        /* Switch to ROW (vertical columns) on larger screens */
        flex-direction: row; 
    }
}

.color-section {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: copy;
    transition: flex-grow 0.3s ease;
    flex-direction: column;
}

.shades-btn-wrapper {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    opacity: 0;
    transition: all 0.2s ease-in-out;
    z-index: 10; /* Ensures it's on top */
}

/* Simplified button (no absolute positioning) */
.view-shades-btn {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease-in-out;
}

/* --- Styles for View Shades Tooltip --- */
.tooltip {
    background: hsl(250, 3%, 0%);
    border-radius: 6px;
    color: white;
    display: block;
    font-size: 13px;
    opacity: 0;
    padding: 7px 10px;
    position: absolute; /* Positioned relative to the wrapper */
    left: 50%;
    bottom: 110%; /* 100% (height of button) + 10% gap */
    transform-origin: 50% 130%;
    transform: translateX(-50%) scale(0.9);
    transition: opacity 0.15s ease,transform 0.15s ease;
    z-index: 99999;
    white-space: nowrap;
    text-align: center;
    pointer-events: none;
    max-width: 200px;
    line-height: 1.2;
}

/* Show tooltip when hovering the wrapper */
.shades-btn-wrapper:hover .tooltip {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* Tooltip arrow */
.tooltip:after {
    border-radius: 2px 0 0;
    content: "";
    height: 8px;
    width: 8px;
    margin-left: -4px;
    position: absolute;
    left: 50%;
    transform: rotate(-135deg);
    background: hsl(250, 3%, 0%);
    bottom: -4px;
}

/* Tooltip arrow */
.tooltip:after {
    border-radius: 2px 0 0;
    content: "";
    height: 8px;
    width: 8px;
    margin-left: -4px;
    position: absolute;
    left: 50%;
    transform: rotate(-135deg);
    background: hsl(250, 3%, 0%);
    bottom: -4px;
}

.color-section:hover .shades-btn-wrapper {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.color-section:hover .view-shades-btn {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.view-shades-btn:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Light BG version */
.color-section.is-light-bg .view-shades-btn {
    background: rgba(255, 255, 255, 0.3);
    color: #000;
}
.color-section.is-light-bg .view-shades-btn:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* This is the wrapper for the original content (hex, name, button) */
.color-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: opacity 0.2s ease;
}

/* This container holds the shades and is hidden by default */
.shades-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column; /* This makes the shades horizontal strips */
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease 0.1s;
}

/* When active, show the shades... */
.color-section.shades-active .shades-container {
    opacity: 1;
    pointer-events: auto;
}

/* ...and hide the original content */
.color-section.shades-active .color-content {
    opacity: 0;
    pointer-events: none;
}

/* When in shades mode, make the active section fill the view... */
.palette-detail-view.in-shades-mode .color-section.shades-active {
    flex-grow: 10; /* Expand */
}

/* ...and hide the other sections */
.palette-detail-view.in-shades-mode .color-section.shades-hidden {
    flex-grow: 0;
    /* This will collapse them in either flex-direction (row or column) */
    flex-basis: 0px; 
    overflow: hidden;
    opacity: 0;
}

.back-to-palette-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}
.back-to-palette-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* --- NEW: Individual Shade Strip --- */
.shade-strip {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: copy;
    transition: flex-grow 0.2s ease;
    position: relative;
}
.shade-strip:hover {
    flex-grow: 1.5; /* Slight expand on hover */
}

.shade-hex {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.2s;
}

.shade-strip:hover .shade-hex {
    opacity: 1;
}

/* Light BG version for shades */
.shade-strip.is-light-bg .shade-hex {
    color: #000;
    background: rgba(255, 255, 255, 0.3);
}

/* --- NEW: Shade Marker Dot --- */
/* --- NEW: Shade Marker Dot --- */
.shade-marker {
    position: absolute;
    right: 25px;
    width: 8px;
    height: 8px;
    background-color: #000; /* Default: black dot */
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    opacity: 1; /* Always visible */
    display: none;
}

/* Show hex on the base color strip */
.shade-strip.is-base-color .shade-hex {
    opacity: 1;
}

/* White dot for light backgrounds */
.shade-strip.is-light-bg .shade-marker {
    background-color: #FFF;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

/* Show hex AND marker on the base color strip, even without hover */
.shade-strip.is-base-color .shade-hex,
.shade-strip.is-base-color .shade-marker {
    opacity: 1;
}


/* Make back button readable on light shades */
.shade-strip.is-light-bg:first-child .back-to-palette-btn {
    background: rgba(255, 255, 255, 0.4);
    color: #000;
}
.shade-strip.is-light-bg:first-child .back-to-palette-btn:hover {
    background: rgba(255, 255, 255, 0.6);
}

.color-name {
    font-size: 16px;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Inter';
    letter-spacing: -0.05em;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.color-section:hover {
    flex-grow: 1.5; /* Slightly expand on hover */
}

.color-hex {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    
    /* Make it hidden by default and add a smooth transition */
    
    transition: opacity 0.3s ease-in-out;
}

.color-section .color-hex,
.color-section .color-name {
    color: #FFFFFF;
}


.color-section.is-light-bg .color-hex,
.color-section.is-light-bg .color-name {
    color: #1a1a1a;
    text-shadow: none; /* Remove shadow on light backgrounds */
}

/* Show the hex code when hovering over the parent color section */
.color-section:hover .color-hex {
    opacity: 1;
}

.back-link {
    font-weight: 700;
    color: var(--accent-color);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 20px;
}

/* --- Copy Feedback Tooltip --- */
.copy-feedback {
    position: absolute;
    /* This combination perfectly centers the element */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    
    background-color: var(--fg);
    color: var(--bg);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    animation: fade-in-out 1.5s ease;
}

@keyframes fade-in-out {
    0% { opacity: 0; transform: translateY(10px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-10px); }
}

/* --- Styles for Palette Card Footer & Like Button --- */
.palette-card {
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure this transition is present */
}

.palette-colors {
    height: 260px;
    display: flex;
    cursor: pointer;
    overflow: hidden; /* Prevent wobble expanding outside rounded corners */
}

.palette-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--card);
    /* Pushes the footer to the bottom */
    margin-top: auto; 
}

.like-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--chip);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: background-color 0.2s;
}

.like-button:hover {
    background-color: var(--bg);
}

.heart-icon {
    width: 18px !important;
    height: 18px !important;
    stroke: var(--accent-color); /* Uses the dynamic accent color */
    stroke-width: 2;
    fill: none;
    transition: fill 0.2s ease, stroke 0.2s ease;
}

.like-button.liked .heart-icon {
    fill: var(--accent-color);
    stroke: var(--accent-color);
}

.like-count {
    font-weight: 700;
    font-size: 13px;
    color: var(--fg);
}

.palette-age {
    font-size: 13px;
    color: var(--muted);
}

/* --- Styles for Palette Detail Info Panel --- */

.color-info-grid {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    text-align: center;
}

.color-info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    cursor: copy;
}

.color-info-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
}

.color-info-hex {
    font-weight: 700;
    font-size: 10px;
    color: var(--fg);
}

.color-info-rgb {
    font-size: 14px;
    color: var(--muted);
}


/* --- Styles for Combined Detail Info Panel --- */
.palette-detail-info {
    background: var(--card);
    padding: 20px 30px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.detail-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.footer-actions {
    display: flex;
    gap: 10px;
}

.detail-action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: Inter;
    text-decoration: none;
}

.detail-action-btn:hover {
    background: var(--chip);
}

.detail-action-btn:hover {
    background: var(--chip);
}


.palette-filters {
    display: flex;
    justify-content: space-between; /* This pushes the new button to the right */
    align-items: center; /* This keeps them vertically aligned */
    gap: 10px;
    background: var(--chip);
    padding: 6px;
    border-radius: 20px;
}

/* This new rule groups the "Newest" and "Trending" buttons together */
.palette-filters > div {
    display: flex;
    gap: 10px;
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 8px 16px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-family: Inter;
}

.filter-btn.active {
    background: var(--card);
    color: var(--fg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* --- Styles for Tags on Detail Page --- */
.detail-tags-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

.tag-chip {
    background: var(--chip);
    color: var(--fg);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    font-family: Inter;
}

/* --- Tags on Palette Card --- */
.card-tags {
    display: flex;
    flex-wrap: nowrap; /* <-- This is the changed line */
    gap: 8px;
    padding: 10px 15px;
    background: var(--card);
    /* This combination ensures consistent height */
    min-height: 40px; 
    box-sizing: border-box; 
    overflow: hidden;
    align-items: center;
}

.card-tag {
    background: var(--chip);
    color: var(--muted);
    font-size: 8px;
    font-weight: 700;
    padding: 3px 3px;
    border-radius: 20px;
    text-decoration: none;

    transition: background-color 0.2s;
}

.card-tag:hover {
    background: var(--bg);
    color: var(--fg);
}

/* --- Similar Palettes Section --- */
.similar-palettes-section {
    margin-top: 50px;
}

.similar-palettes-section h3 {
    font-size: 35px;
    font-weight: 900;
    margin-bottom: 25px;
    text-align: center;
    letter-spacing: -0.05em;
}


#similar-palettes-grid {
     display: grid; /* RESTORE */
     grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* RESTORE */
     gap: 20px; /* RESTORE or keep previous value */
     /* position: relative; */ /* Can remove */
}

#similar-palettes-grid .similar-palette-card {

    box-sizing: border-box;
}


.similar-palette-card {
    text-decoration: none;
    color: inherit;
    display: block;
}

.similar-palette-card .palette-colors {
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;

    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.similar-palette-card:hover .palette-colors {
    transform: translateY(-5px);
}

.similar-palette-card .color-strip {
    flex-grow: 1;
}

.similar-palette-footer {
    display: flex;
    justify-content: space-between; /* This is the key change */
    align-items: center;
    padding-top: 10px;
}


.similar-palette-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--fg);
    /* Prevent long titles from breaking the layout */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px; /* Add space between title and likes */
}

.similar-palette-likes {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.similar-palette-likes .heart-icon {
    width: 16px;
    height: 16px;
    fill: var(--muted);
    stroke: none;
}

a.detail-action-btn {
    display: inline-block;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* --- Palette Action Bar (Detail View) --- */
.palette-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--card);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.action-bar-hint {
    font-size: 14px;
    color: var(--muted);
    font-weight: 700;
}

.action-buttons-group {
    display: flex;
    gap: 8px;
    border-left: 2px solid var(--border);
    padding-left: 15px;
    margin-left: 15px;
}

.action-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg);
    font-weight: 700;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
    font-family: Inter;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none; /* <-- ADD THIS LINE */
}

.action-btn:hover {
    background-color: var(--chip);
}


/* 1. Reset the browser's default focus outline on click/tab/focus */
.action-btn:focus,
.action-btn:focus-visible {
    outline: none; 
    box-shadow: none;
    /* Often, the double border is the box-shadow being applied on focus/active */
}

/* 2. Fix issues caused by the button briefly being 'active' (pressed state) */
.action-btn:active {
    border: 1px solid var(--border); /* Ensure the border remains single thickness */
    transform: scale(0.98); /* Optional: A slight press effect */
}


/* Hide the hint on smaller screens to save space */
@media (max-width: 768px) {
    .action-bar-hint {
        display: none;
    }
}

/* --- Styles for Quick View Modal --- */

/* The crucial overlay styles that make it a pop-up */
.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);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal-content {
    transform: scale(0.95);
}

/* --- Styles for Quick View Modal --- */
.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);
    border-radius: 16px;
    box-shadow: var(--shadow);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal-overlay.hidden .modal-content {
    transform: scale(0.95);
}

/* MODIFIED: This is the key to fixing the layout */
.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;
}

/* NEW: Class for when the background is light */
.quick-view-modal.is-light-bg .modal-header h4,
.quick-view-modal.is-light-bg .info-value {
        color: var(--muted);
}
.quick-view-modal.is-light-bg .info-label,
.quick-view-modal.is-light-bg .close-btn {
    color: #666; /* Muted dark text */
}
.quick-view-modal.is-light-bg .copy-btn {
    color: #007bff; /* A standard blue for links */
}

.quick-view-modal .modal-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quick-view-modal .modal-header h4 {
    margin: 0;
    font-size: 16px;
    color: var(--muted);
}

.quick-view-modal .modal-header h4,
.quick-view-modal .info-value {
    color: var(--muted);
}
.quick-view-modal .info-label,
.quick-view-modal .close-btn {
    color: var(--muted);
}

.quick-view-modal .copy-btn {
    color: #FFFFFF; /* White copy button */
}

.quick-view-modal .info-row {
    border-bottom-color: rgba(255, 255, 255, 0.15); /* Light border */
}


.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--muted); /* Standard muted color */
    cursor: pointer;
}

.quick-view-modal .modal-body {
    /* Layout: Ensures elements stack vertically */
    display: flex;
    flex-direction: column;
    
    /* Spacing: Keep original padding */
    padding: 10px 20px 20px 20px;
    gap: 15px; /* Spacing between info rows */
    
    /* CRITICAL SCROLLING/GROWTH PROPERTIES */
    flex-grow: 1;           /* Tells the body to fill all available vertical space */
    max-height: 100%;       /* Constrains the body's height to the parent modal */
    overflow-y: auto;       /* Enables scrolling ONLY when content exceeds the max-height */
}

/* NEW: Add this rule to hide the scrollbar */
.quick-view-modal .modal-body::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

.quick-view-modal.is-light-bg .info-row {
    border-bottom-color: rgba(0, 0, 0, 0.1); /* Dark border */
}



/* 3. Dynamic Text Colors (These rules now ONLY apply to the body) */
/* Default for dark backgrounds */
.quick-view-modal .modal-body .info-value { color: #FFFFFF; }
.quick-view-modal .modal-body .info-label { color: rgba(255, 255, 255, 0.7); }
.quick-view-modal .modal-body .copy-btn { color: #FFFFFF; }
.quick-view-modal .modal-body .info-row { border-bottom-color: rgba(255, 255, 255, 0.15); }
/* Override for light backgrounds */
.quick-view-modal.is-light-bg .modal-body .info-value { color: #1a1a1a; }
.quick-view-modal.is-light-bg .modal-body .info-label { color: #666; }
.quick-view-modal.is-light-bg .modal-body .copy-btn { color: #007bff; }
.quick-view-modal.is-light-bg .modal-body .info-row { border-bottom-color: rgba(0, 0, 0, 0.1); }

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid;
    padding-bottom: 15px;
}
.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 4px;
}

.info-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--fg);
}

.info-row:hover .copy-btn {
    opacity: 1;
}


.copy-btn {
    background: none;
    border: none;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-family: Inter;
}



/* 1. Header and Footer Styling */
.quick-view-modal .modal-header,
.quick-view-modal .modal-footer {
    background: var(--chip); /* Set a fixed background */
    flex-shrink: 0; /* Prevent header/footer from shrinking */
}



.quick-view-modal .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}

.swatch-container {
    display: flex;
    height: 40px; /* Set the height of the bar */
    border-radius: 8px;
    overflow: hidden;
}

.color-swatch-item {
    flex-grow: 1; /* Make each color take up equal space */
    cursor: pointer;
    position: relative; /* Needed for positioning the dot */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.2s;
}

.color-swatch-item.active {
    border-color: var(--accent-color);
}

/* Add a subtle darken effect on hover */
.color-swatch-item:hover {
    filter: brightness(0.9);
}

/* This creates the black dot using a pseudo-element */
.color-swatch-item::before {
    content: '';
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #000;
    
    /* Hide the dot by default */
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

/* Show the dot when the swatch is hovered over OR is the active one */
.color-swatch-item:hover::before,
.color-swatch-item.active::before {
    opacity: 1;
}

/* We no longer need the border to show the active state */
.color-swatch-item.active {
    border-color: transparent;
}

.color-strip-overlay:hover {
    flex-grow: 2.5; /* Adjust this value to control the intensity of the wobble */
}

/* --- Styles for Lazy Load Loader --- */
#palette-loader {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

#palette-loader.hidden {
    display: none;
}

/* Reusing the loader style from the holidays page */
#palette-loader .loader {
    border: 5px solid var(--border);
    border-top: 5px solid var(--accent-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* Ensure the overlay covers the whole strip */
.color-strip-overlay {
    flex-grow: 1; /* Each strip takes equal space */
    position: relative; 
    cursor: pointer;
    display: flex; 
    align-items: center;
    justify-content: center;
    /* ADD: Transition for the wobble effect */
    transition: flex-grow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}


/* --- Styles for Export Modal --- */
.modal-content.export-modal {
    max-width: 480px; /* Wider than quick-view */
    max-height: 90vh;
}

.export-modal .modal-body {
    padding: 20px;
    overflow-y: auto;
}

.export-grid {
    display: grid;
    /* Create 4 columns */
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--chip);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px 10px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    font-family: Inter, sans-serif;
    color: var(--fg);
}

.export-option:hover {
    background: var(--bg);
    transform: translateY(-3px);
}

.export-option span {
    font-size: 13px;
    font-weight: 700;
}

.export-option svg {
    width: 28px;
    height: 28px;
    margin-bottom: 10px;
    /* Use 'stroke' or 'fill' depending on your icons */
    stroke: var(--fg);
    fill: none;
}


/* --- Styles for Image Select Modal --- */
.image-select-tabs {
    display: flex;
    padding: 0 20px; /* Padding for the tabs themselves */
    border-bottom: 1px solid var(--border);
    flex-shrink: 0; /* Prevent tabs from being squeezed */
}

.tab-btn {
    font-family: Inter, sans-serif;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    padding: 12px 16px;
    cursor: pointer;
    position: relative;
    border-bottom: 2px solid transparent;
    transition: color 0.2s;
}
.tab-btn:hover {
    color: var(--fg);
}
.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.image-select-body {
    padding: 20px; /* This is the main padding (20px top/right/bottom/left) */
    width: 100%;
    min-height: 300px;
    max-height: 80vh;
    box-sizing: border-box; 
    overflow: hidden; /* Prevent internal elements from escaping the modal */
    overflow-y: auto;
    width: 100%; /* Ensure it spans the modal width */
}

.tab-panel {
    width: 100%; 
    box-sizing: border-box;
    display: none; /* Hidden by default */
    height: 100%;
    /* Panels should have NO horizontal padding here, relying on the body padding */
}

.tab-panel.active {
    display: block; /* Shown when active */
}

/* Styles for Upload Panel */
.drop-zone {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  border: 2px dashed #e0e0e0;
  border-radius: 12px;
  color: #888;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.drop-zone:hover {
    background-color: var(--bg);
}
.drop-zone svg {
    color: var(--muted);
    margin-bottom: 15px;
    opacity: 0.7;
}
.drop-zone span {
    font-weight: 700;
    color: var(--fg);
}

/* NEW: Add a class to hide the drop zone */
.drop-zone.hidden {
    display: none;
}

/* NEW: Drag-over effect for drop zone */
.drop-zone.drag-over {
    background-color: var(--bg);
    border-color: var(--accent-color);
}

/* --- NEW: Styles for Upload Preview --- */
/* 1. The container that shows up after image upload */
#upload-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    height: auto;
    margin-bottom: 0;
    min-height: 210px; /* Keep container from collapsing */
    justify-content: flex-start;
    padding: 10px 0; /* Add vertical padding for the image to breathe */
    box-sizing: border-box;
}

/* 2. The container for the image only (e.g., if you wrap the image) */
/* If the image is a direct child of #upload-preview, these rules apply to #preview-image */
.upload-image-wrapper { 
    width: 100%;
    max-height: 350px; /* Set vertical boundary */
    overflow: hidden;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* 3. The Image Element itself */
#preview-image {
    max-width: 60%;
    max-height: 60%; /* CRITICAL: Scales down to max-height of parent */
    
    /* CRITICAL: Ensures the entire image is visible, preventing cropping */
    object-fit: contain; 
    
    width: auto; 
    height: auto; 
    display: block;
    border-radius: 8px; /* Match container border-radius */
}

/* Fix for buttons being partially hidden/pushed (Ensure they are not squished) */
.preview-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    flex-shrink: 0; /* Prevents buttons from collapsing vertically */
    margin-top: 0; /* Pushes buttons to the bottom of the visible area */
    border-top: 1px solid var(--border); /* Space above buttons */
}

.preview-btn-primary,
.preview-btn-secondary {
    font-family: Inter, sans-serif;
    font-weight: 700;
    font-size: 14px;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    flex-grow: 1;
    transition: background-color 0.2s, filter 0.2s;
}

.preview-btn-primary {
    background-color: var(--accent-color);
    color: white;
}
.preview-btn-primary:hover {
    filter: brightness(0.9);
}

.preview-btn-secondary {
    background-color: var(--chip);
    color: var(--fg);
    border: 1px solid var(--border);
}
.preview-btn-secondary:hover {
    background-color: var(--bg);
}
/* Default state: White text with shadow for dark backgrounds */


/* --- Styles for Export Modal Grid --- */
#palette-exporter_links {
    display: grid;
    /* Create 4 columns */
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

#palette-exporter_links a.link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--chip);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px 10px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    font-family: Inter, sans-serif;
    color: var(--fg);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

#palette-exporter_links a.link:hover {
    background: var(--bg);
    transform: translateY(-3px);
}

#palette-exporter_links a.link i.icon {
    /* Basic styling for your <i> icons */
    font-style: normal;
    font-size: 24px; /* Adjust as needed */
    margin-bottom: 10px;
    /* If you use SVGs, style them here: */
    /*
    width: 28px;
    height: 28px;
    stroke: var(--fg);
    */
}

/* Style all SVGs inside the export links */
#palette-exporter_links a.link svg {
    width: 32px;
    height: 32px;
    margin-bottom: 8px; /* Space between icon and text */
}



/* --- Style overrides for like button in action bar --- */
.action-buttons-group .like-button {
    background: transparent;
    border: 1px solid var(--border);
    width: auto; /* Allow it to fit the count */
    min-width: 36px;
    height: 36px;
    border-radius: 8px;
    padding: 6px 10px; /* Small padding */
    gap: 6px; /* Space between icon and count */
}

/* Add the standard hover effect */
.action-buttons-group .like-button:hover {
    background-color: var(--chip);
}

/* Make the icon and text smaller to fit */
.action-buttons-group .like-button .heart-icon {
    width: 16px;
    height: 16px;
}

.action-buttons-group .like-button .like-count {
    font-size: 13px;
    color: var(--fg); /* Ensure text is visible */
}

/* --- Styles for the generated color swatches in the image modal --- */
.generated-color-swatches {
    display: flex;
    gap: 5px; /* Space between color swatches */
    width: 100%;
    margin-top: 15px; /* Space above the swatches */
    margin-bottom: 15px; /* Space below the swatches */
    height: 40px; /* Fixed height for the swatch row */
    overflow: hidden; /* Hide any overflow if too many swatches */
    border-radius: 8px; /* Match modal styling */
    background-color: var(--bg); /* A subtle background */
    box-sizing: border-box;
    border: 1px solid var(--border);
    display: none;
}

.generated-color-swatches .color-display-swatch {
    flex: 1; /* Each swatch takes equal space */
    height: 100%;
    border-radius: 0; /* No individual swatch border-radius needed */
    background-color: #eee; /* Default if not set */
    transition: background-color 0.2s ease;
    cursor: pointer; /* Indicate it's clickable (for future picker enhancement) */
}

/* For the first and last swatch, round the corners to match container */
.generated-color-swatches .color-display-swatch:first-child {
    border-top-left-radius: 7px; /* 1px less than container for visual edge */
    border-bottom-left-radius: 7px;
}
.generated-color-swatches .color-display-swatch:last-child {
    border-top-right-radius: 7px;
    border-bottom-right-radius: 7px;
}

/* --- Styles for URL Input Group --- */
.url-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 0;
    align-items: flex-start;
}

.url-input-group label {
    font-weight: 700;
    font-size: 14px;
    color: var(--fg);
}

.url-input-group input[type="url"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--fg);
    font-size: 16px;
    box-sizing: border-box;
}

.url-input-group #loadUrlBtn {
    /* Reusing primary button style */
    padding: 10px 20px;
    margin-top: 10px;
}


/* --- Unsplash Search Results UI --- */
.unsplash-search-container {
    /* CRITICAL FIX: Set a constrained MAXIMUM width for the bar itself */
    max-width: 350px; /* Example: This is the visual width constraint */
    width: 100%; /* Ensure it uses 100% of the space up to the max */
    box-sizing: border-box;
    display: flex;
    gap: 10px;
}

#unsplashSearchInput {
    flex-grow: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--fg);
    font-size: 16px;
    box-sizing: border-box;
    min-width: 0;
}


.unsplash-search-area {
    padding: 0;
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
    /* Center the search bar visually */
    display: flex;
    justify-content: center;
}


.search-btn {
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    flex-shrink: 0; /* Prevent shrinking when input takes space */
    display: flex;
    align-items: center;
    justify-content: center;
}
.search-btn svg {
    fill: white;
}

.unsplash-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns of images */
    gap: 10px;
    padding-top: 15px;
    max-height: 400px; /* Constrain grid height */
    overflow-y: auto;
}

.unsplash-result-image {
    width: 100%;
    height: 100px; /* Fixed height for consistent grid look */
    object-fit: cover; /* Crop to fill the container */
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s;
}
.unsplash-result-image:hover {
    transform: scale(1.05);
}
.unsplash-message {
    grid-column: 1 / -1; /* Center message across all columns */
    text-align: center;
    color: var(--muted);
    padding: 20px;
}
.loader-spinner { /* Re-use your existing spinner style */
    /* ... */
}


/* In palette-card-footer */
.palette-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* New wrapper for buttons on the left */
.card-actions-left {
  display: flex;
  align-items: center;
  gap: 12px; /* Space between like and share */
}

/* Base style for both buttons */
.like-button,
.share-button {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

.like-button .heart-icon,
.share-button .share-icon {
  transition: all 0.2s ease;
}

/* Share button specific */
.share-button:hover {
  /* You can set a different hover color, e.g., blue */
  color: #3498db; 
}

.share-button .share-icon {
  fill: currentColor; /* Use text color for fill */
  stroke: none;
  width: 16px; 
  height: 16px;
}


.share-button .share-icon {
  fill: none; /* New SVG has no fill */
  stroke: currentColor; /* Use text color for stroke */
  width: 16px; 
  height: 16px;
  /* Ensure stroke width looks good */
  stroke-width: 2.5px; 
}

/* --- Gradient Card Styling --- */
.gradient-card {
    width: 100%;
    /* Use padding-top to create an aspect ratio box */
    padding-top: 100%; 
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
    /* We'll use this for the actual gradient background */
    background-size: cover;
    background-position: center;
}

.palette-card-link:hover .gradient-card {
    transform: translateY(-5px);
}

.gradient-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
}

.gradient-type {
    font-weight: 700;
    font-size: 14px;
    color: var(--fg);
    text-transform: capitalize;
}


/* --- New Styles for Footer Grouping and Alignment --- */

/* Ensures like button and avatar stay grouped (left side) */
.palette-card-footer .footer-left-group {
    display: flex;
    align-items: center;
    gap: 0; /* Remove unnecessary gap if only the like button is here */
}

/* New container for the age and avatar (right side) */
.palette-card-footer .footer-right-group {
    display: flex;
    align-items: center;
    gap: 8px; /* Space between the date/age text and the avatar */
}

/* Style the generated avatar (Unchanged from previous step) */
.palette-user-avatar {
    width: 32px; 
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border); 
    background: var(--bg);
    flex-shrink: 0;
}



/* --- Confirmation Modal (FIXED) --- */

/* These rules now ONLY apply to the confirmation modal */
#confirmationModal {
    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;
}
#confirmationModal.hidden { opacity: 0; pointer-events: none; }

#confirmationModal .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;
}
#confirmationModal.hidden .modal-content { transform: scale(0.9); }
#confirmationModal .modal-content h3 { margin: 0 0 15px 0; font-size: 22px; color: var(--fg); }
#confirmationModal .modal-content p { margin: 0 0 25px 0; font-size: 16px; color: var(--muted); line-height: 1.6; }

/* Modal Button Group */
#confirmationModal .modal-button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
}
#confirmationModal .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, background-color 0.2s; min-width: 120px;
    font-family: Inter, sans-serif;
}
#confirmationModal .modal-button:hover { filter: brightness(1.1); }

#confirmationModal .modal-button.secondary {
    background: var(--chip);
    color: var(--fg);
    border: 1px solid var(--border);
}
#confirmationModal .modal-button.secondary:hover { background: var(--bg); }

#confirmationModal .modal-button.danger {
    background: #e74c3c; /* Red */
}
#confirmationModal .modal-button.danger:hover { background: #c0392b; }

/* Modal Palette Preview */
#modalPreviewPalette {
    display: flex;
    height: 60px; /* Smaller height for the preview */
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: #eee;
}
#modalPreviewPalette .color-strip {
    flex-grow: 1 !important; /* Disable wobble */
    transition: none !important;
}
#modalPreviewPalette .color-strip:hover {
    flex-grow: 1 !important; /* Disable wobble */
}
#modalPreviewPalette .color-hex-hover {
    display: none !important; /* Hide the hex code */
}


/* --- Updated Delete Button Icon (Emoji) --- */
.card-action-btn.delete-palette-btn {
    width: 28px; 
    height: 28px; 
    border-radius: 50%;
    padding: 0;
    border: 1px solid var(--border);
    background-color: var(--card);
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

.delete-icon-emoji {
    font-size: 14px;
    line-height: 1;
    display: block;
    transition: transform 0.2s ease;
}

/* Hover effect */
.card-action-btn.delete-palette-btn:hover {
    background-color: var(--bg); 
    border-color: #e74c3c; /* Red border */
}
.card-action-btn.delete-palette-btn:hover .delete-icon-emoji {
    transform: scale(1.1);
}



/* --- New Generate Button Style --- */
.filter-generate-btn {
    background: var(--accent-color);
    color: #fff;
    padding: 8px 16px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-family: Inter, sans-serif;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-generate-btn:hover {
    filter: brightness(1.1);
}

.filter-generate-btn svg {
    width: 16px;
    height: 16px;
}




