/*
 * EP Palette Generator -- Stylesheet
 * ElevatedPrintables.com
 *
 * Everything is scoped under .ep-palette-wrap so these
 * styles never bleed out onto the rest of the page.
 *

/* ============================================================
   OUTER WRAPPER
   ============================================================ */

.ep-palette-wrap {
    font-family: inherit;
    max-width: 1100px;      /* was 400px back when this lived in a sidebar */
    width: 100%;
    margin: 0 auto;
    padding: 28px;
    background-color: #FFFFFF;
    border-radius: 6px;
    color: #313f4b;
    box-sizing: border-box;
}

/* Honour Gutenberg's Wide and Full width settings. */
.ep-palette-wrap.alignwide { max-width: 1400px; }
.ep-palette-wrap.alignfull { max-width: none; border-radius: 0; }


/* ============================================================
   MODE TABS  (From Color / From Image)
   ============================================================ */

.ep-palette-wrap .ep-mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    border-bottom: 2px solid #575F4B25;
    padding-bottom: 15px;
}

.ep-palette-wrap .ep-tab {
    background: #575F4B05;
    color: #575F4B;
    border: 1px solid #575F4B;
    outline: 1px solid #575F4B;
    outline-offset: -5px;
    border-radius: 4px;
    padding: 8px 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ep-palette-wrap .ep-tab:hover {
    background-color: #575F4B;
    color: #FFFFFF;
    border: 1px solid #FFFFFF;
    outline: 1px solid #FFFFFF;
    outline-offset: -5px;
}

/* Active tab */
.ep-palette-wrap .ep-tab.ep-tab-active {
    background-color: #C08166;
    color: #ffffff;
    border: 1px solid #ffffff;
    outline: 1px solid #ffffff;
    outline-offset: -5px;
}


/* ============================================================
   PANELS  (the content areas under each tab)
   ============================================================ */

.ep-palette-wrap .ep-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: stretch;   /* was center, which is pointless at full width */
}


/* ============================================================
   FULL-PAGE CONTROL LAYOUT
   Base colour and palette type sit side by side on a wide
   screen and stack automatically on a narrow one.
   ============================================================ */

.ep-palette-wrap .ep-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    align-items: flex-start;
}

.ep-palette-wrap .ep-control-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ep-palette-wrap .ep-control-color {
    flex: 0 0 auto;
    min-width: 220px;
}

.ep-palette-wrap .ep-control-harmony {
    flex: 1 1 420px;
}

.ep-palette-wrap .ep-steps-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ep-palette-wrap .ep-generate-btn {
    align-self: flex-start;
}


/* ============================================================
   LABELS
   ============================================================ */

.ep-palette-wrap .ep-label {
    font-family: Poppins;
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #313f4b;
    text-transform: uppercase;
    margin-bottom: -8px; /* pulls the field up closer to its label */
}


/* ============================================================
   COLOR PICKER ROW
   ============================================================ */

.ep-palette-wrap .ep-color-pick-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* The browser's native color wheel */
.ep-palette-wrap input[type="color"] {
    width: 48px;
    height: 48px;
    border: 2px solid #575F4B25;
    border-radius: 6px;
    padding: 2px;
    cursor: pointer;
    background: none;
}

/* The hex text input */
.ep-palette-wrap .ep-input {
    border: 1px solid #313f4b;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.95rem;
    color: #313f4b;
    background: #FFFFFF;
    width: 140px;
    transition: border-color 0.2s ease;
}

.ep-palette-wrap .ep-input:focus {
    outline: none;
    border-color: #575F4B;
}


/* ============================================================
   CHIP GROUPS  (harmony types / color counts)
   ============================================================ */

.ep-palette-wrap .ep-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ep-palette-wrap .ep-chip {
    background-color: #F5F6F4;
    color: #575F4B;
    border: 5px solid #FFFFFF;
    outline: 5px double #E6E7E4;
    outline-offset: -5px;
    border-radius: 9px;
    padding: 3px 14px;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.ep-palette-wrap .ep-chip:hover {
    background-color: #575F4B;
    color: #FFFFFF;
    border: 5px solid #E6E7E4;
    outline: 5px double #FFFFFF;
    outline-offset: -5px;
    text-decoration: none;
}

/* Active/selected chip */
.ep-palette-wrap .ep-chip.ep-chip-active {
    background-color: #C08166;
    color: #FEF8EE;
    border: 5px solid #C08166;
    outline: 5px double #FEF8EE;
    outline-offset: -5px;
}


/* ============================================================
   GENERATE BUTTON
   ============================================================ */

.ep-palette-wrap .ep-generate-btn {
    background-color: #C0816605;
    color: #C08166;
    border: 1px solid #C08166;
    outline: 1px solid #C08166;
    outline-offset: -5px;
    border-radius: 4px;
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin: 7px auto 0;
    transition: all 0.2s ease;
    box-shadow: 0 -4px 6px rgba(0,0,0,0.15);
}

.ep-palette-wrap .ep-generate-btn:hover {
    background: #575F4B05;
    color: #575F4B;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    border: 1px solid #575F4B;
    outline: 1px solid #575F4B;
    outline-offset: -5px;
}

.ep-palette-wrap .ep-generate-btn:active {
    transform: translateY(0);
}


/* ============================================================
   IMAGE DROP ZONE
   ============================================================ */

.ep-palette-wrap .ep-drop-zone {
    border: 2px dashed #313f4b;
    border-radius: 6px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #FFFFFF;
}

.ep-palette-wrap .ep-drop-zone:hover {
    border-color: #575F4B;
    background: #575F4B10;
}

/* When a file is dragged over */
.ep-palette-wrap .ep-drop-zone.ep-drag-over {
    border-color: #575F4B25;
    background: #575F4B10;
}

.ep-palette-wrap .ep-drop-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.ep-palette-wrap .ep-drop-text {
    font-size: 0.9rem;
    color: #313f4b;
}

/* Image preview after upload */
.ep-palette-wrap .ep-image-preview-wrap {
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #575F4B;
}

.ep-palette-wrap .ep-image-preview-wrap img {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    display: block;
}


/* ============================================================
   RESULTS SECTION
   ============================================================ */

.ep-palette-wrap .ep-results {
    margin-top: 15px;
    border-top: 2px solid #575F4B25;
    padding-top: 15px;
}

/* Header row -- palette name + action buttons */
.ep-palette-wrap .ep-results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 15px;
}

.ep-palette-wrap .ep-results-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Editable palette name */
.ep-palette-wrap .ep-results-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: #313f4b;
}

/* Harmony type badge e.g. "Analogous" */
.ep-palette-wrap .ep-harmony-badge {
    background: #575F4B10;
    color: #575F4BFFF;
    border-radius: 4px;
    padding: 3px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Action buttons row -- Save, Copy, PNG, Regen */
.ep-palette-wrap .ep-results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ep-palette-wrap .ep-action-btn {
    background: #FFFFFF;
    color: #313f4b;
    border: 1px solid #575F4B25;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ep-palette-wrap .ep-action-btn:hover {
    background: #575F4B25;
    color: #575F4BFFF;
    border-color: #575F4B25;
}


/* ============================================================
   SWATCH BAR  (the big color strip across the top)
   JavaScript fills this with colored divs
   ============================================================ */

.ep-palette-wrap .ep-swatch-bar {
    display: flex;
    height: 130px;   /* taller now that it spans the page */
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: var(--ep-shadow);
}

/* Each swatch -- JavaScript creates these */
.ep-palette-wrap .ep-swatch {
    flex: 1;
    cursor: pointer;
    transition: flex 0.2s ease;
}

.ep-palette-wrap .ep-swatch:hover {
    flex: 2;  /* expands on hover -- fun! */
}


/* ============================================================
   COLOR CARDS  (name + hex + rgb for each color)
   JavaScript fills this with card divs
   ============================================================ */

.ep-palette-wrap .ep-color-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

/* Each card -- JavaScript creates these */
.ep-palette-wrap .ep-color-card {
    background: #FFFFFF;
    border: 1px solid #575F4B25;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--ep-shadow);
    transition: transform 0.2s ease;
}

.ep-palette-wrap .ep-color-card:hover {
    transform: translateY(-2px);
}

/* The big color block at the top of each card */
.ep-palette-wrap .ep-card-swatch {
    height: 80px;
    width: 100%;
}

/* Text area at the bottom of each card */
.ep-palette-wrap .ep-card-info {
    padding: 10px;
}

.ep-palette-wrap .ep-card-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #313f4b;
    margin-bottom: 4px;
}

.ep-palette-wrap .ep-card-hex {
    font-size: 0.75rem;
    color: #575F4B10;
    font-family: monospace;
}

.ep-palette-wrap .ep-card-rgb {
    font-size: 0.72rem;
    color: #999;
    font-family: monospace;
}


/* ============================================================
   SAVED PALETTES SECTION
   ============================================================ */

.ep-palette-wrap .ep-saved-section {
    margin-top: 15px;
    border-top: 2px solid #575F4B25;
    padding-top: 15px;
}

.ep-palette-wrap .ep-panel-title {
    font-size: 1rem;
    font-weight: 700;
    color: #575F4B25;
    margin-bottom: 12px;
}

.ep-palette-wrap .ep-saved-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Each saved palette row -- JavaScript creates these */
.ep-palette-wrap .ep-saved-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #FFFFFF;
    border: 1px solid #575F4B25;
    border-radius: 6px;
    padding: 10px 14px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.ep-palette-wrap .ep-saved-item:hover {
    border-color: #575F4B10;
}

/* Mini swatch strip inside each saved palette row */
.ep-palette-wrap .ep-saved-swatches {
    display: flex;
    height: 24px;
    width: 100px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.ep-palette-wrap .ep-saved-name {
    font-size: 0.88rem;
    font-weight: 600;
    flex: 1;
}

.ep-palette-wrap .ep-saved-delete {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 4px;
    transition: color 0.2s ease;
}

.ep-palette-wrap .ep-saved-delete:hover {
    color: #e55;
}


/* ============================================================
   LOADING STATE
   Shown while waiting for API responses
   ============================================================ */

.ep-palette-wrap .ep-loading {
    text-align: center;
    padding: 40px;
    color: #aaa;
    font-size: 0.9rem;
}

.ep-palette-wrap .ep-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #575F4B25;
    border-top-color: #575F4B10;
    border-radius: 50%;
    animation: ep-spin 0.7s linear infinite;
    margin-bottom: 8px;
}

@keyframes ep-spin {
    to { transform: rotate(360deg); }
}


/* ============================================================
   RESPONSIVE -- narrows gracefully on smaller screens
   ============================================================ */

@media (max-width: 782px) {

    .ep-palette-wrap {
        padding: 16px;
    }

    .ep-palette-wrap .ep-controls-row {
        flex-direction: column;
        gap: 18px;
    }

    .ep-palette-wrap .ep-swatch-bar {
        height: 90px;
    }

    .ep-palette-wrap .ep-generate-btn {
        align-self: stretch;
    }

    .ep-palette-wrap .ep-results-header {
        flex-direction: column;
    }

    .ep-palette-wrap .ep-color-cards {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    .ep-palette-wrap .ep-generate-btn {
        align-self: stretch;
        text-align: center;
    }

}