/* ═══════════════════════════════════════════════════════════════
   CREATION STATION  –  Cascade Dafo
   Matches UI/UX of cascadedafo.com/creation-station
═══════════════════════════════════════════════════════════════ */

/* ── Steps Bar (full-width, above two-column layout) ─────────── */
.cs-steps-bar {
    background: #fff;
    width: 100%;
}

.cs-steps-list {
    display: flex;
    align-items: flex-start;
    list-style: none;
    margin: 0;
    padding: 10px 8px 8px;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
}

.cs-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* connector line: center of this step → center of next */
.cs-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 1px;
    background: #d8d8d8;
    z-index: 0;
}

/* Default circle — white fill, light grey border */
.cs-step-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #d0d0d0;
    color: #bbb;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    transition: background 0.25s, color 0.25s, border-color 0.25s;
}

/* Active step — solid purple fill */
.cs-step.active .cs-step-circle {
    background: #403B78;
    border-color: #403B78;
    color: #fff;
}

/* Completed step — same as default (grey outlined, grey number) */
.cs-step.completed .cs-step-circle {
    background: #fff;
    border-color: #d0d0d0;
    color: #bbb;
}

.cs-step-label {
    font-size: 0.62rem;
    color: #aaa;
    margin-top: 6px;
    text-align: center;
    max-width: 100px;
    line-height: 1.3;
    transition: color 0.25s, font-weight 0.25s;
    font-weight: 400;
}

/* Active label — bold purple */
.cs-step.active .cs-step-label {
    color: #403B78;
    font-weight: 700;
}

/* Completed label — stays grey */
.cs-step.completed .cs-step-label {
    color: #aaa;
    font-weight: 400;
}


/* ── Main Layout ─────────────────────────────────────────────── */
.cs-main-layout {
    display: flex;
    align-items: stretch;
    background: #f7f7f7;
}

/* ── Preview Column ──────────────────────────────────────────── */
.cs-preview-col {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 12px 8px;
    background: #fff;
}

.cs-preview-wrapper {
    position: relative;
    width: 100%;
    max-width: 660px;
    aspect-ratio: 1 / 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;  /* needed for mix-blend-mode: multiply on outline layer */
}

.cs-layers {
    position: relative;
    width: 100%;
    height: 100%;
}

.cs-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* Layer order (bottom→top): padding(1) → pattern(2) → strap(3) → outline(4) */
.cs-layer:nth-child(1) { z-index: 2; }  /* layer-pattern: above padding */
.cs-layer:nth-child(2) { z-index: 1; }  /* layer-padding: lowest base */
.cs-layer:nth-child(3) { z-index: 3; }  /* layer-strap: above pattern */
.cs-outline-layer      { z-index: 4; mix-blend-mode: multiply; }  /* white areas become transparent, black outline stays visible */

.cs-preview-loader {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.cs-preview-loader.active { display: flex; }

.cs-spinner {
    position: relative;
    width: 48px;
    height: 48px;
    animation: cs-spin 1s steps(12, end) infinite;
}

.cs-spinner span {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 13px;
    margin-left: -2px;
    border-radius: 2px;
    background: #2a2a2a;
    transform-origin: 2px 24px;
}

.cs-spinner span:nth-child(1)  { transform: rotate(0deg);   opacity: 1;    }
.cs-spinner span:nth-child(2)  { transform: rotate(30deg);  opacity: 0.92; }
.cs-spinner span:nth-child(3)  { transform: rotate(60deg);  opacity: 0.83; }
.cs-spinner span:nth-child(4)  { transform: rotate(90deg);  opacity: 0.67; }
.cs-spinner span:nth-child(5)  { transform: rotate(120deg); opacity: 0.55; }
.cs-spinner span:nth-child(6)  { transform: rotate(150deg); opacity: 0.43; }
.cs-spinner span:nth-child(7)  { transform: rotate(180deg); opacity: 0.33; }
.cs-spinner span:nth-child(8)  { transform: rotate(210deg); opacity: 0.25; }
.cs-spinner span:nth-child(9)  { transform: rotate(240deg); opacity: 0.18; }
.cs-spinner span:nth-child(10) { transform: rotate(270deg); opacity: 0.12; }
.cs-spinner span:nth-child(11) { transform: rotate(300deg); opacity: 0.07; }
.cs-spinner span:nth-child(12) { transform: rotate(330deg); opacity: 0.03; }

@keyframes cs-spin {
    to { transform: rotate(360deg); }
}

.cs-disclaimer {
    font-size: 0.75rem;
    color: #222;
    text-align: center;
    width: 100%;
    max-width: 100%;
    line-height: 1.6;
    margin: 8px 0 0;
    padding: 0 36px;
    font-style: italic;
}

/* ── Sidebar Column ──────────────────────────────────────────── */
.cs-sidebar-col {
    width: 420px;
    min-width: 360px;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e0e0e0;
    background: #fff;
}

/* ── Summary Box ─────────────────────────────────────────────── */
.cs-summary-box {
    padding: 10px 16px 12px;
    border-bottom: 1px solid #eee;
}

.cs-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0px;
    margin-bottom: 0px;
}

.cs-summary-heading {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    color: var(--color-text-heading, #403B78);
    text-transform: uppercase;
    white-space: nowrap;
}

.cs-summary-btns {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.cs-btn-start-over {
    background: transparent;
    border: 2px solid var(--color-text-heading, #403B78);
    border-radius: 30px;
    padding: 0.3rem 0.9rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-text-heading, #403B78);
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
    white-space: nowrap;
}

.cs-btn-start-over:hover {
    background-color: var(--color-text-heading, #403B78);
    color: #fff;
    transform: translateY(-1px);
}

/* Summary-area Save PDF button — compact pill, no flex stretch */
.cs-summary-btns .cs-btn {
    flex: none;
    padding: 0.3rem 0.9rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    min-width: 0;
    border-radius: 30px;
}

.cs-summary-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 10px;
    margin: 0;
    font-size: 0.8rem;
}

.cs-summary-list dt {
    font-weight: 700;
    color: #666;
    white-space: nowrap;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.cs-summary-list dd {
    color: #222;
    margin: 0;
    font-weight: 500;
}

/* ── Tabs Navigation ─────────────────────────────────────────── */
.cs-tabs-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #e0e0e0;
    background: #fafafa;
}

.cs-tab-item a {
    display: block;
    padding: 4px 18px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.cs-tab-item a:hover {
    color: #403B78;
}

.cs-tab-item.active a {
    color: #403B78;
    border-bottom-color: #403B78;
}

/* ── Tab Content ─────────────────────────────────────────────── */
.cs-tab-content {
    flex: 1 1 0;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

.cs-tab-content::-webkit-scrollbar { width: 5px; }
.cs-tab-content::-webkit-scrollbar-track { background: #f1f1f1; }
.cs-tab-content::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

.cs-tab-pane {
    display: none;
    padding: 10px 12px;
}

.cs-tab-pane.active { display: block; }

/* Clear link row */
.cs-clear-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.cs-clear-link {
    font-size: 0.7rem;
    color: #888;
    text-decoration: none;
}

.cs-clear-link:hover { color: #c62828; }

/* Category headings */
.cs-category-heading {
    font-size: 0.7rem;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 14px 0 6px;
    padding-bottom: 0;
    border-bottom: none;
}

.cs-category-heading:first-child { margin-top: 0; }

/* Pattern grid */
.cs-options-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0 0 6px;
}

.cs-option-item {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.18s, transform 0.15s, box-shadow 0.15s;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cs-option-item:hover {
    border-color: #403B78;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

.cs-option-item.selected {
    border-color: #403B78;
    box-shadow: 0 0 0 3px rgba(64,59,120,0.25);
}

.cs-option-item.selected:hover {
    border-color: #403B78;
    background: rgba(64,59,120,0.08);
}

.cs-option-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.cs-option-label {
    font-size: 0.6rem;
    text-align: center;
    color: #444;
    line-height: 1.2;
    padding: 3px 2px 4px;
    word-break: break-word;
    width: 100%;
}

/* ── Color section header (STRAP COLORS / PADDING COLORS) ── */
.cs-color-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 0 6px;
}

.cs-color-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #333;
    text-transform: uppercase;
}

.cs-btn-clear-color {
    font-size: 0.7rem;
    color: #888;
    text-decoration: none;
}
.cs-btn-clear-color:hover { color: #c62828; }

/* Colors grid */
.cs-colors-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.cs-color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.18s, box-shadow 0.15s;
    background: transparent;
}

.cs-color-item:hover {
    border-color: #999;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.cs-color-item.selected {
    border-color: #403B78;
    box-shadow: 0 0 0 2px rgba(64,59,120,0.3);
}

.cs-color-item.selected:hover {
    border-color: #403B78;
    box-shadow: 0 0 0 3px rgba(64,59,120,0.4);
    background: rgba(64,59,120,0.05);
}

.cs-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.cs-color-label {
    font-size: 0.62rem;
    text-align: center;
    color: #444;
    line-height: 1.2;
    padding: 3px 2px 4px;
    word-break: break-word;
    width: 100%;
}

/* ── Bottom Action Bar ───────────────────────────────────────── */
.cs-action-bar {
    border-top: 1px solid #e0e0e0;
    padding: 14px 16px 12px;
    background: #fff;
    flex-shrink: 0;
}

.cs-action-buttons {
    display: flex;
    gap: 8px;
    margin: 0 0 8px;
    flex-wrap: wrap;
}

/* Base button — pill shape matching site-wide style */
.cs-btn {
    flex: 1 1 0;
    min-width: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.55rem 1.2rem;
    border-radius: 30px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.cs-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.18); }
.cs-btn:active { transform: none; box-shadow: none; }

.cs-btn-icon { font-size: 1rem; line-height: 1; }

/* Save PDF — primary filled purple (same as .btn-learn-more) */
.cs-btn-pdf {
    background-color: var(--color-text-heading, #403B78);
    color: #fff;
}

.cs-btn-pdf:hover {
    background-color: var(--color-primary-hover, #6D28D9);
    color: #fff;
}

/* Share — outline style */
.cs-btn-share {
    background-color: transparent;
    color: var(--color-text-heading, #403B78);
    border: 2px solid var(--color-text-heading, #403B78);
}

.cs-btn-share:hover {
    background-color: var(--color-text-heading, #403B78);
    color: #fff;
}

/* Coloring Pages — secondary filled */
.cs-btn-coloring {
    background-color: var(--color-text-heading, #403B78);
    color: #fff;
    opacity: 0.85;
}

.cs-btn-coloring:hover {
    background-color: var(--color-primary-hover, #6D28D9);
    color: #fff;
    opacity: 1;
}

.cs-reference-link {
    display: block;
    text-align: center;
    font-size: 0.72rem;
    color: #403B78;
    text-decoration: none;
}

.cs-reference-link:hover { text-decoration: underline; }

/* ── Coloring Pages Popup ────────────────────────────────────── */
.cs-coloring-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
}

.cs-coloring-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1010;
    background: #fff;
    border: 3px solid #403B78;
    border-radius: 8px;
    padding: 24px 24px 20px;
    width: 90%;
    max-width: 580px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}

.cs-coloring-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0;
}

.cs-coloring-close:hover { color: #333; }

.cs-coloring-intro {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 16px;
}

.cs-coloring-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
}

.cs-coloring-grid li a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #403B78;
    gap: 5px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cs-coloring-grid li a:hover {
    border-color: #403B78;
    box-shadow: 0 0 0 2px rgba(64,59,120,0.15);
}

.cs-coloring-grid li a img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 4px;
}

.cs-coloring-grid li a span {
    font-size: 0.68rem;
    text-align: center;
    color: #403B78;
    line-height: 1.2;
}

.cs-coloring-disclaimer {
    font-size: 0.72rem;
    text-align: center;
    color: #888;
    font-style: italic;
    margin: 0;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 860px) {
    .cs-main-layout {
        flex-direction: column;
    }

    .cs-sidebar-col {
        width: 100%;
        max-width: 100%;
        border-left: none;
        border-top: 1px solid #e0e0e0;
    }

    .cs-preview-col {
        padding: 10px 10px 6px;
    }

    .cs-preview-wrapper {
        max-width: 480px;
    }

    .cs-tab-content {
        flex: none;
        height: 480px;
        min-height: 400px;
        max-height: 520px;
        overflow-y: auto;
    }

    .cs-coloring-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Color grids — drop to 3 cols so swatches stay large enough */
    .cs-colors-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Make color & pattern labels more readable on tablet */
    .cs-color-label,
    .cs-option-label {
        font-size: 0.68rem;
    }

    /* Ensure summary values are clearly visible */
    .cs-summary-list dd {
        color: #111;
        font-weight: 600;
        font-size: 0.82rem;
    }

    .cs-summary-list dt {
        font-size: 0.75rem;
        color: #555;
    }
}

@media (max-width: 520px) {
    .cs-tab-content {
        flex: none;
        height: 420px;
        min-height: 360px;
        max-height: 460px;
        overflow-y: auto;
    }

    .cs-steps-list {
        padding: 12px 6px 8px;
    }

    .cs-step-circle {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .cs-step:not(:last-child)::after {
        top: 14px;
    }

    .cs-step-label {
        font-size: 0.6rem;
        max-width: 80px;
    }

    .cs-coloring-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Pattern grid — 3 cols on small phones */
    .cs-options-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Color grid — 3 cols on small phones so labels stay legible */
    .cs-colors-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Slightly larger labels on small screens for readability */
    .cs-color-label,
    .cs-option-label {
        font-size: 0.7rem;
        padding: 4px 3px 5px;
    }

    /* Summary values — bold and clearly visible */
    .cs-summary-list dd {
        color: #111;
        font-weight: 600;
        font-size: 0.85rem;
    }

    .cs-summary-list dt {
        font-size: 0.78rem;
        color: #555;
    }
}
