/* =============================================================
   color_variants.css — Product Color Variant Styles
   Applies to: shop cards, product detail page, cart, mini-cart,
               admin builder, order pages.
   ============================================================= */

/* ── Color Swatch Row (product cards & PDP) ─────────────────── */
.color-swatches-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    align-items: center;
}

/* Individual swatch dot */
.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    outline: 2px solid rgba(0,0,0,0.10);
    cursor: pointer;
    transition: transform 0.18s ease, outline-color 0.18s ease, outline-offset 0.18s ease, box-shadow 0.18s ease;
    flex-shrink: 0;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.color-swatch:hover {
    transform: scale(1.15);
    outline-color: rgba(0,0,0,0.35);
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.color-swatch.active {
    outline: 1.5px solid #111;
    outline-offset: 2px;
    transform: scale(1.08);
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

/* Touch-friendly swatches on mobile */
@media (max-width: 768px) {
    .color-swatch {
        width: 28px;
        height: 28px;
    }
    .color-swatches-row {
        gap: 10px;
        margin-top: 12px;
    }
    .color-name-display {
        font-size: 0.80rem;
        margin-top: 8px;
    }
}

/* Larger swatches on the product detail page */
.asos-product-info .color-swatches-row {
    gap: 10px;
    margin-top: 0;
    margin-bottom: 4px;
}
.asos-product-info .color-swatch {
    width: 28px;
    height: 28px;
}

/* Swatch label */
.color-swatch-label {
    font-size: 0.78rem;
    color: #555;
    margin-top: 4px;
    font-weight: 500;
}

/* Color name display below swatches */
.color-name-display {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
    margin-top: 6px;
    text-align: left;
    letter-spacing: 0.02em;
}

/* PDP color section wrapper */
.asos-color-section {
    margin: 14px 0 18px;
    padding: 14px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}
.asos-color-heading {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #111;
    margin-bottom: 10px;
}
.asos-selected-color-name {
    font-size: 0.82rem;
    color: #555;
    font-weight: 400;
    margin-left: 6px;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Image fade animation ────────────────────────────────────── */
.color-img-fade {
    transition: opacity 0.2s ease !important;
}
.color-img-fading {
    opacity: 0 !important;
}

/* ── Cart & Mini-cart color display ─────────────────────────── */
.cart-item-color,
.mc-item-color {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #666;
    margin-top: 3px;
}
.cart-item-color-dot,
.mc-item-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
    display: inline-block;
}

/* ── Order pages color display ───────────────────────────────── */
.order-item-color {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    color: #667085;
    margin-top: 2px;
}
.order-item-color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.12);
    display: inline-block;
    flex-shrink: 0;
}

/* ── Admin Color Builder ─────────────────────────────────────── */
.cv-builder-section {
    /* uses existing .card-section styles */
}

.cv-color-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.cv-color-row {
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 10px;
    background: var(--surface, #fff);
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.cv-color-row:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.cv-color-row-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border, #e2e8f0);
    cursor: pointer;
    user-select: none;
}
.cv-color-preview {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.12);
    flex-shrink: 0;
}
.cv-color-row-name {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
    color: var(--text, #1a1a2e);
}
.cv-color-row-toggle {
    font-size: 1rem;
    color: var(--text-muted, #64748b);
    transition: transform 0.2s;
}
.cv-color-row.open .cv-color-row-toggle {
    transform: rotate(180deg);
}

.cv-color-row-body {
    padding: 1rem;
    display: none;
}
.cv-color-row.open .cv-color-row-body {
    display: block;
}

.cv-fields-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
}
@media (max-width: 600px) {
    .cv-fields-row { grid-template-columns: 1fr 1fr; }
    .cv-fields-row .cv-delete-btn { grid-column: 1 / -1; }
}

.cv-hex-wrapper {
    display: flex;
    gap: 6px;
    align-items: center;
}
.cv-hex-picker {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
    background: none;
    flex-shrink: 0;
}
.cv-hex-input {
    flex: 1;
    /* uses form-control styles */
}

.cv-delete-btn {
    background: transparent;
    border: 1px solid var(--danger, #ef4444);
    color: var(--danger, #ef4444);
    border-radius: var(--radius, 8px);
    padding: 0 0.75rem;
    height: 38px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.cv-delete-btn:hover {
    background: var(--danger, #ef4444);
    color: #fff;
}

/* Image grid inside color row */
.cv-img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    min-height: 20px;
}
.cv-img-card {
    position: relative;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f8fafc;
}
.cv-img-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cv-img-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(239,68,68,0.9);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.cv-img-remove:hover {
    background: #dc2626;
}

.cv-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 0.9rem;
    background: var(--primary, #6366f1);
    color: #fff;
    border: none;
    border-radius: var(--radius, 8px);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: opacity 0.15s;
}
.cv-upload-btn:hover { opacity: 0.88; }

.cv-add-color-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 2px dashed var(--border, #e2e8f0);
    border-radius: var(--radius, 8px);
    color: var(--primary, #6366f1);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.cv-add-color-btn:hover {
    border-color: var(--primary, #6366f1);
    background: rgba(99,102,241,0.04);
}

.cv-saving-indicator {
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
    display: none;
    align-items: center;
    gap: 6px;
}
.cv-saving-indicator.visible { display: flex; }

/* Status badge inside color row header */
.cv-img-count-badge {
    font-size: 0.7rem;
    padding: 1px 7px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #64748b;
    font-weight: 600;
}
.cv-img-count-badge.has-imgs {
    background: #dcfce7;
    color: #15803d;
}
.cv-img-count-badge.no-imgs {
    background: #fef9c3;
    color: #854d0e;
}
