:root {
    --swatch-gap: 10px;
}

/* Default Palette Preview Styling */

.preview-top {
    background: var(--global-palette3);
    padding: 2em;
    text-align: center;
    border-radius: 6px 6px 0 0;
}

.preview-top h2 {
    color: var(--global-palette9);
}

.preview-top p {
    color: var(--global-palette8);
    max-width: 600px;
    margin: 0 auto;
}

.preview-top .preview-button {
    background: var(--global-palette1);
    color: var(--global-palette9);
    margin-top: 1em;
    border: none;
    padding: 0.5em 1em;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.preview-bottom {
    background: var(--global-palette8);
    border: 1px solid var(--global-palette9);
    padding: 2em;
    border-radius: 0 0 6px 6px;
}

.preview-bottom h3 {
    color: var(--global-palette3);
    text-align: center;
    margin-bottom: 1.5em;
}

.preview-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    justify-content: center;
}

.preview-card {
    flex: 1 1 200px;
    background: var(--global-palette7);
    border: 1px solid var(--global-palette9);
    border-radius: 6px;
    padding: 1em;
    text-align: center;
}

.preview-card div {
    background: var(--global-palette9);
    display: inline-block;
    border-radius: 50%;
    padding: 0.5em;
    margin-bottom: 0.5em;
}

.preview-card .dashicons {
    color: var(--global-palette1);
    font-size: 24px;
}

/* Existing CSS Below (unchanged) */

.palette-maker-wrap {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    align-items: flex-start;
    margin-bottom: 2em;
}

.input-controls {
    display: flex;
    flex-direction: column;
    gap: 1em;
    flex: 1 1 300px;
    min-width: 200px;
}

.input-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    align-items: stretch;
}

.input-group label {
    flex: 0 0 140px;
    font-weight: bold;
}

.input-group input,
.input-group select {
    flex: 1 1 auto;
    min-width: 0;
}

.hex-combo {
    display: flex;
    width: 100%;
}

.hex-combo input[type="text"] {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.colour-input-wrapper {
    display: flex;
    flex: 1;
    align-self: stretch;
    min-width: 0;
    border-radius: 4px;
    overflow: hidden;
    height: 100%;
    position: relative;
    color: #ffffff;
}

.colour-input-wrapper input[type="text"] {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    padding: 0.5rem;
    line-height: 1.2;
    height: auto;
    min-height: 2.8em;
    box-sizing: border-box;
}

.colour-input-wrapper input[type="color"] {
    width: 100px;
    min-width: 60px;
    max-width: 100px;
    height: auto;
    min-height: 2.8em;
    padding: 0;
    margin: 0 0 0 10px;
    border: none;
    cursor: pointer;
    display: block;
    appearance: none;
    border-radius: 4px;
    box-sizing: border-box;
}

.colour-icon {
    position: absolute;
    right: 45px;
    top: 43%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 30px !important;
    opacity: 0.8;
}

.colour-input-wrapper.dark .colour-icon {
    filter: invert(1);
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
}

.generate-button-container {
    flex: 0 0 auto;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}

.generate-button-container button {
    width: 100%;
    height: 100%;
    padding: 0.8em 1.2em;
    white-space: nowrap;
    text-align: center;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
}

.palette-grid {
    display: flex;
    flex-direction: column;
    gap: var(--swatch-gap);
    margin-bottom: 2em;
}

.palette-subgrid {
    display: flex;
    gap: var(--swatch-gap);
    flex-wrap: wrap;
    justify-content: space-between;
}

.swatch-card {
    flex: 1 1 0;
    height: 120px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: white;
    padding: 0.8em;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.swatch-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-end;
    font-size: 14px;
    font-weight: bold;
    gap: 0.25em;
}

.swatch-footer .hex {
    display: flex;
    align-items: center;
    gap: 6px;
}

.swatch-footer .copy-icon {
    cursor: pointer;
    font-size: 16px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.copy-icon {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.copy-icon.clicked {
    transform: scale(1.2);
    opacity: 1;
}

.swatch-footer .copy-icon:hover {
    opacity: 1;
}

.preview {
    margin-top: 2em;
    border-top: 1px solid #ccc;
    padding-top: 1em;
}

.preview-box {
    padding: 2em;
    border-radius: 6px;
    background: #f0f0f0;
    margin-bottom: 2em;
}

.preview-box h1 {
    margin-top: 0;
}

.preview-button {
    padding: 0.5em 1em;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

.export {
    margin-top: 2em;
}

textarea#json-output {
    width: 100%;
    height: 150px;
    font-family: monospace;
    margin-bottom: 1em;
}

#json-buttons {
    display: flex;
    gap: 0.5em;
    margin-bottom: 0.5em;
    flex-wrap: wrap;
}

#json-buttons button .dashicons {
    vertical-align: middle;
    margin-right: 0.4em;
    font-size: 1.1em;
    position: relative;
    top: -1px;
}

.layout-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2em;
}

.preview,
.palette-col {
    flex: 1 1 45%;
    min-width: 0;
    max-width: 100%;
}

.palette-col {
    container-type: inline-size;
    container-name: palette-col;
}

.preview-card {
    background: var(--bg);
    color: var(--text);
    border-radius: 6px;
    padding: 1em;
    margin-top: 1em;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.preview-card h4 {
    margin: 0 0 0.5em;
}

@container palette-col (max-width: 600px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .input-controls {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        flex: unset;
    }

    .input-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .input-group label {
        flex: none;
        width: auto;
        text-align: left;
        align-self: auto;
    }

    .generate-button-container {
        width: 100%;
        height: auto;
        min-width: 0;
    }

    .generate-button-container button {
        width: 100%;
    }

    .swatch-footer {
        flex-direction: column;
        align-items: flex-start;
        font-size: 12px;
    }

    .swatch-footer .hex {
        white-space: nowrap;
    }

    .swatch-card {
        padding: 0.6em;
    }

    #dark-row .swatch-card {
        flex: 1 1 calc(50% - var(--swatch-gap) / 2);
        max-width: calc(50% - var(--swatch-gap) / 2);
    }
}

