.color-box {
    font-family: sans-serif;
    background: #f0f0f0;
    color: #333;
    padding: 20px;
    padding-top: 150px;
}

body.dark-mode .color-box {
    background: #111;
    color: #efefef;
}

/* LARGE COLOR PREVIEW */
.color-preview {
    width: 100%;
    height: 250px;
    border: 1px solid #ccc;
    margin-bottom: 20px;
    position: relative;
    background: #999;
}

.preview-text {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
    font-size: 0.9rem;
}

/* MAIN WRAPPER FOR 3 COLUMNS */
.picker-area {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
}

/* LEFT COLUMN: color preview + pickers + button group */
.left-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Saturation/Value canvas + marker */
.sv-wrapper {
    position: relative;
    width: 300px;
    height: 220px;
}

#svCanvas {
    width: 100%;
    height: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: crosshair;
    display: block;
}

.sv-marker {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 4px #000;
    pointer-events: none;
}

/* Hue row */
.hue-row {
    position: relative;
    width: 300px;
    height: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    cursor: crosshair;
}

#hueCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.hue-marker {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 3px #000;
}

.hex-input-container {
    margin-top: 10px;
    text-align: center;
}

#hexInput {
    width: 90%;
    padding: 6px;
    font-size: 16px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #333;
}


/* Alpha row (checkerboard) */
.alpha-row {
    position: relative;
    width: 300px;
    height: 16px;
    border-radius: 4px;
    overflow: hidden;
    cursor: crosshair;
    border: 1px solid #ccc;
    background-size: 16px 16px;
    background-position: 0 0, 8px 8px;
    background-repeat: repeat;
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
        linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc);
}

.alpha-marker {
    position: absolute;
    top: 50%;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 0 3px #000;
}

/* BUTTONS */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
}

button {
    padding: 5px 9px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}

button:hover {
    background: #eee;
}

/* MIDDLE COLUMN: 5 columns, each column has top button + 5 squares */
.middle-col {
    display: flex;
    flex-direction: row;
    gap: 20px;
}

.palette-column {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
}

.col-button {
    font-size: 0.8rem;
    padding: 3px 8px;
    background: #ddd;
    border: 1px solid #aaa;
    border-radius: 3px;
    cursor: pointer;
    margin-bottom: 5px;
}

.col-button:hover {
    background: #ccc;
}

/* Make squares a bit bigger so the HEXA string fits easily */
.palette-square {
    position: relative;
    width: 110px;
    height: 60px;
    border: 2px solid #333;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
}

.palette-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 0.7rem;
    text-align: center;
    padding: 2px 4px;
    user-select: text;
    /* so user can copy it */
}

/* RIGHT COLUMN: gradient box + list + share button */
.right-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gradient-box {
    width: 300px;
    height: 60px;
    border: 2px solid #333;
    border-radius: 4px;
}

.gradient-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gradient-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ccc;
    border-radius: 4px;
    padding: 4px 8px;
}

.gradient-color-box {
    width: 65px;
    height: 40px;
    border: 1px solid #333;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

.gradient-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 0.7rem;
    text-align: center;
    padding: 2px 4px;
    user-select: text;
}

.email-btn {
    margin-top: 10px;
    padding: 8px 14px;
    border-radius: 4px;
    background: green;
    color: #fff;
    border: none;
    cursor: pointer;
}

.email-btn:hover {
    background: #0b0;
}

/* TOGGLE SELECTED COLUMN (when user picks “Add Column #X”) */
.col-button.selected {
    background: #28a745;
    /* greenish */
    color: #fff;
}

/* Eyedropper highlight */
body.eyedropper-active #svCanvas,
body.eyedropper-active .hue-row,
body.eyedropper-active .alpha-row {
    outline: 2px dashed yellow;
}

/* Make everything smaller on screens smaller than 1024px */
@media (max-width: 1024px) {

    /* Make the palette columns smaller */
    .palette-square {
        width: 90px;
        height: 50px;
    }

    .palette-label {
        font-size: 0.65rem;
    }
}

/* Even smaller for mobile screens (below 768px) */
@media (max-width: 768px) {
    .picker-area {
        flex-direction: column;
        align-items: center;
    }

    .left-col,
    .middle-col,
    .right-col {
        width: 100%;
        align-items: center;
    }


    .palette-square {
        width: 70px;
        height: 45px;
    }

    .palette-column:last-child {
        display: none;
    }
}