/**
 * Color Harmonies Generator — Tool Interface Styles (v2)
 * Scoped under .chg-* prefix.
 * Layout: Controls card (wheel + sliders) + stacked harmony cards grid.
 */

/* ============================================================
   SECTION
   ============================================================ */
.chg-tool-section {
    padding: 60px 0 70px;
    background: #FFFFFF;
}

/* ============================================================
   SECTION HEADER
   ============================================================ */
.chg-section-header {
    text-align: center;
    margin-bottom: 36px;
}

.chg-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
    border: 1px solid rgba(236, 72, 153, 0.2);
    border-radius: 50px;
    font-size: 1.125rem;
    font-weight: 600;
    color: #EC4899;
    margin-bottom: 14px;
}

.chg-badge i {
    font-size: 1.25rem;
}

.chg-section-desc {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.65;
}

/* ============================================================
   CONTROLS CARD  (wheel left + inputs right)
   ============================================================ */
.chg-controls-card {
    display: flex;
    gap: 40px;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 20px;
    padding: 32px 36px;
    margin-bottom: 32px;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.07);
}

/* ---- Wheel column ---- */
.chg-wheel-col {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#chg-wheel {
    width: 220px;
    height: 220px;
    cursor: crosshair;
    border-radius: 50%;
    display: block;
}

.chg-wheel-hint {
    font-size: 1.125rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

/* ---- Controls column ---- */
.chg-controls-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Base color row */
.chg-base-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chg-label {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chg-base-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chg-color-picker {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    padding: 2px;
    background: none;
    flex-shrink: 0;
}

.chg-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 8px;
}

.chg-color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 8px;
}

.chg-hex-input {
    flex: 1;
    height: 48px;
    padding: 0 14px;
    border: 1.5px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    background: #FAFAFA;
    outline: none;
    transition: border-color 0.2s;
    text-transform: uppercase;
}

.chg-hex-input:focus {
    border-color: #6366F1;
    background: #FFFFFF;
}

/* Sliders */
.chg-slider-group {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chg-slider-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.chg-slider-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #6366F1;
    min-width: 36px;
    text-align: right;
}

.chg-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 50px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(to right, #6366F1 0%, #6366F1 75%, #E2E8F0 75%);
}

.chg-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 2px solid #6366F1;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
    cursor: pointer;
    transition: transform 0.15s;
}

.chg-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.chg-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FFFFFF;
    border: 2px solid #6366F1;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
    cursor: pointer;
}

/* Saturation slider track */
.chg-slider--sat {
    background: linear-gradient(to right, #CBD5E1, hsl(var(--chg-current-hue, 217), 100%, 50%));
}

/* Base info strip */
.chg-base-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
}

.chg-base-chip {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: background 0.2s;
}

.chg-base-values {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chg-base-hex {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chg-base-rgb,
.chg-base-hsl {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   HARMONIES GRID  (2 cols desktop, 1 col mobile)
   ============================================================ */
.chg-harmonies-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

/* ============================================================
   HARMONY CARD
   ============================================================ */
.chg-harmony-card {
    background: #FFFFFF;
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 20px;
    padding: 28px 28px 22px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
    position: relative;
    overflow: hidden;
}

.chg-harmony-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366F1, #EC4899);
    border-radius: 20px 20px 0 0;
}

.chg-harmony-card:hover {
    box-shadow: 0 12px 36px rgba(99, 102, 241, 0.13);
    border-color: rgba(99, 102, 241, 0.28);
    transform: translateY(-2px);
}

/* Card header */
.chg-harmony-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 22px;
}

.chg-harmony-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}

.chg-harmony-icon-wrap i {
    font-size: 1.5rem;
    color: #6366F1;
}

.chg-harmony-meta {
    flex: 1;
    min-width: 0;
}

.chg-harmony-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 3px;
    line-height: 1.3;
}

.chg-harmony-desc {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.chg-color-count {
    font-size: 1.125rem;
    font-weight: 600;
    color: #6366F1;
    background: rgba(99, 102, 241, 0.08);
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ============================================================
   SWATCHES ROW  (inside each harmony card)
   ============================================================ */
.chg-swatches-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.chg-swatch-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

/* Color block */
.chg-swatch {
    width: 100%;
    min-width: 60px;
    height: 130px;
    border-radius: 16px;
    cursor: pointer;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.chg-swatch:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

.chg-swatch--base {
    border-color: #6366F1;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.chg-swatch-copy-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    background: rgba(0, 0, 0, 0.32);
    border-radius: 14px;
    transition: opacity 0.2s;
    color: #FFFFFF;
    font-size: 1.75rem;
    backdrop-filter: blur(2px);
}

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

.chg-swatch-base-label {
    position: absolute;
    top: 8px;
    left: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #FFFFFF;
    background: rgba(99, 102, 241, 0.9);
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.6;
    backdrop-filter: blur(4px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Swatch value pills */
.chg-swatch-details {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    width: 100%;
    padding: 4px 2px 2px;
}

.chg-swatch-format-btn {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
}

.chg-hex-pill {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 6px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
}

.chg-hex-pill:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.3);
    color: #6366F1;
}

.chg-sub-pill {
    font-size: 1rem;
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.chg-sub-pill:hover {
    background: #F1F5F9;
    color: var(--text-primary);
}

/* ============================================================
   ACTIONS BAR
   ============================================================ */
.chg-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.chg-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.chg-btn i {
    font-size: 1.125rem;
}

.chg-btn--primary {
    background: var(--primary-gradient, linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%));
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.chg-btn--primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.38);
}

.chg-btn--secondary {
    background: #F8FAFC;
    color: var(--text-primary);
    border: 1.5px solid rgba(99, 102, 241, 0.2);
}

.chg-btn--secondary:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: #6366F1;
    color: #6366F1;
}

/* ============================================================
   TOAST
   ============================================================ */
.chg-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1E293B;
    color: #FFFFFF;
    font-size: 1.125rem;
    font-weight: 500;
    padding: 10px 22px;
    border-radius: 50px;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.22s, transform 0.22s;
    white-space: nowrap;
}

.chg-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
    .chg-controls-card {
        flex-direction: column;
        padding: 24px 20px;
        gap: 24px;
    }

    #chg-wheel {
        width: 180px;
        height: 180px;
    }

    .chg-swatches-row {
        gap: 6px;
    }

    .chg-swatch {
        height: 90px;
        min-width: 44px;
        border-radius: 12px;
    }

    .chg-harmony-card {
        padding: 16px 16px 14px;
    }

    .chg-harmony-icon-wrap {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .chg-harmony-icon-wrap i {
        font-size: 1.125rem;
    }

    .chg-sub-pill {
        display: none;
    }
}

@media (max-width: 480px) {
    .chg-tool-section {
        padding: 40px 0 50px;
    }

    .chg-base-inputs {
        flex-direction: row;
        gap: 8px;
    }

    .chg-btn {
        padding: 11px 20px;
        font-size: 1.125rem;
    }
}