/* ═══ CSS Gradient Generator ═══ */

.cg-wrap { display: flex; flex-direction: column; gap: 20px; }

.cg-notice {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 0;
    padding: 10px 18px;
    border-radius: 10px;
    background: rgba(74,222,128,0.06);
    border: 1px solid rgba(74,222,128,0.2);
    font-size: 13px;
    color: var(--text-muted, #999);
    display: flex;
    align-items: center;
    gap: 10px;
}
.cg-notice i { color: #4ADE80; font-size: 14px; flex-shrink: 0; }

.cg-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(380px, 460px);
    gap: 20px;
    align-items: start;
}

.cg-col--form { min-width: 0; }

.cg-col--preview {
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: calc(100vh - 100px);
}

.cg-preview-sticky {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Canvas — большой превью с точками */
.cg-canvas-wrap {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    background: #0d0d0f;
    margin-bottom: 16px;
}

.cg-canvas {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    cursor: crosshair;
    user-select: none;
    touch-action: none;
    background: #0d0d0f;
    transition: background 0.15s;
}

.cg-canvas-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 11.5px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    opacity: 0.85;
}

/* Точки внутри canvas */
.cg-dot {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: grab;
    border: 2.5px solid #fff;
    box-shadow:
        0 0 0 2px rgba(0,0,0,0.5),
        0 4px 12px rgba(0,0,0,0.4);
    transition: transform 0.1s, box-shadow 0.15s;
    touch-action: none;
    z-index: 2;
}
.cg-dot:hover {
    transform: translate(-50%, -50%) scale(1.15);
    box-shadow:
        0 0 0 2px rgba(0,0,0,0.5),
        0 0 0 6px rgba(255,255,255,0.15),
        0 6px 16px rgba(0,0,0,0.5);
}
.cg-dot.is-active {
    border-color: #FBBF24;
    box-shadow:
        0 0 0 2px rgba(0,0,0,0.5),
        0 0 0 8px rgba(251,191,36,0.25),
        0 6px 16px rgba(0,0,0,0.5);
    cursor: grabbing;
}

/* Секции */
.cg-section {
    padding: 18px;
    border-radius: 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 14px;
}
.cg-section:last-child { margin-bottom: 0; }

.cg-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.cg-section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text, #e8e8ea);
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}
.cg-section-head .cg-section-title { margin: 0; }
.cg-section-title i { color: #FBBF24; font-size: 14px; }

/* Список точек */
.cg-points {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cg-point-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.04);
    transition: border-color .15s, background .15s;
}
.cg-point-row.is-active {
    border-color: rgba(251,191,36,0.4);
    background: rgba(251,191,36,0.06);
}

.cg-point-color {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.15);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    background: transparent;
}
.cg-point-color::-webkit-color-swatch-wrapper { padding: 0; }
.cg-point-color::-webkit-color-swatch { border: none; border-radius: 4px; }
.cg-point-color::-moz-color-swatch { border: none; border-radius: 4px; }

.cg-point-info {
    flex: 1;
    font-size: 12px;
    color: var(--text-muted, #999);
    font-family: ui-monospace, 'SF Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cg-point-remove {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: #f87171;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    transition: all .15s;
}
.cg-point-remove:hover {
    background: rgba(248,113,113,0.1);
    border-color: rgba(248,113,113,0.3);
}
.cg-point-remove:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Поля */
.cg-field { margin-bottom: 14px; }
.cg-field:last-child { margin-bottom: 0; }

.cg-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted, #999);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cg-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cg-range {
    width: 100%;
    accent-color: #FBBF24;
    margin-bottom: 4px;
}

.cg-meta {
    font-size: 12px;
    color: #FBBF24;
    font-weight: 600;
    font-family: ui-monospace, monospace;
}

.cg-color {
    width: 100%;
    height: 42px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.3);
    cursor: pointer;
    padding: 3px;
}
.cg-color::-webkit-color-swatch-wrapper { padding: 0; }
.cg-color::-webkit-color-swatch { border: none; border-radius: 5px; }

.cg-select {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text, #e8e8ea);
    font-size: 13px;
    font-family: inherit;
    color-scheme: dark;
    cursor: pointer;
}
.cg-select:focus {
    outline: none;
    border-color: #FBBF24;
}
.cg-select option {
    background: #1a1a1e;
    color: #e8e8ea;
}

/* Пресеты */
.cg-presets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.cg-preset {
    aspect-ratio: 1;
    border-radius: 10px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .15s, border-color .15s, box-shadow .15s;
    position: relative;
    overflow: hidden;
    padding: 0;
}
.cg-preset:hover {
    transform: scale(1.05);
    border-color: rgba(255,255,255,0.3);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}
.cg-preset.is-active {
    border-color: #FBBF24;
    box-shadow: 0 0 0 3px rgba(251,191,36,0.2);
}

.cg-preset-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 6px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
    font-size: 9.5px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.02em;
}

/* Tabs */
.cg-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}

.cg-tab {
    flex: 1;
    padding: 9px 14px;
    border-radius: 7px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted, #999);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
}
.cg-tab:hover { color: var(--text, #e8e8ea); background: rgba(255,255,255,0.04); }
.cg-tab--active {
    background: #FBBF24;
    color: #1a1a1a !important;
}

/* Code */
.cg-code {
    padding: 16px;
    margin: 0;
    border-radius: 12px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.06);
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #E0E7FF;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 320px;
    white-space: pre-wrap;
    word-break: break-word;
}
.cg-code code { color: inherit; font-family: inherit; }

/* Кнопки */
.cg-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text, #e8e8ea);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    justify-content: center;
}
.cg-btn:hover { background: rgba(255,255,255,0.1); }
.cg-btn--primary {
    background: #FBBF24;
    color: #1a1a1a !important;
    border-color: transparent;
}
.cg-btn--primary:hover {
    background: #FCD34D;
    box-shadow: 0 8px 24px rgba(251,191,36,0.3);
}
.cg-btn--sm {
    padding: 7px 12px;
    font-size: 12px;
}
.cg-btn--success {
    background: rgba(74,222,128,0.15) !important;
    border-color: rgba(74,222,128,0.3) !important;
    color: #4ADE80 !important;
}

.cg-actions {
    display: flex;
    gap: 8px;
}
.cg-actions .cg-btn { flex: 1; }

/* Info */
.cg-info-box {
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(251,191,36,0.06);
    border: 1px solid rgba(251,191,36,0.15);
}
.cg-info-box-title {
    font-size: 12px;
    font-weight: 700;
    color: #FBBF24;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cg-info-box p {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted, #999);
    margin: 0;
}

.cg-info {
    display: grid;
    grid-template-columns: 44px 1fr;
    gap: 14px;
    padding: 16px 20px;
    max-width: 760px;
    margin: 8px auto 0;
    background: rgba(251,191,36,0.05);
    border: 1px solid rgba(251,191,36,0.15);
    border-radius: 14px;
}
.cg-info-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(251,191,36,0.15);
    color: #FBBF24;
    font-size: 18px;
}
.cg-info h4 { font-size: 14px; margin: 0 0 6px; color: #fff; }
.cg-info p { font-size: 12.5px; color: var(--text-muted, #999); line-height: 1.55; margin: 0; }
.cg-info code {
    background: rgba(0,0,0,0.3);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 11.5px;
    color: #FCD34D;
}

/* Mobile */
@media (max-width: 900px) {
    .cg-layout { grid-template-columns: 1fr; }
    .cg-col--preview { position: static; max-height: none; }
    .cg-canvas { aspect-ratio: 4 / 3; }
    .cg-presets { grid-template-columns: repeat(4, 1fr); }
    .cg-code { max-height: 240px; }
}
@media (max-width: 640px) {
    .cg-field-row { grid-template-columns: 1fr; }
    .cg-presets { grid-template-columns: repeat(3, 1fr); }
}

/* ═══ v3: панель настройки активной точки ═══ */
.cg-point-row {
    cursor: pointer;
    padding: 10px 12px;
    gap: 12px;
}
.cg-point-row:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
}
.cg-point-row.is-active {
    background: rgba(251,191,36,0.08) !important;
    border-color: rgba(251,191,36,0.5) !important;
}
.cg-point-swatch {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    flex-shrink: 0;
}
.cg-point-row.is-active .cg-point-swatch {
    border-color: #FBBF24;
    box-shadow: 0 0 0 3px rgba(251,191,36,0.2), 0 2px 6px rgba(0,0,0,0.3);
}
.cg-point-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cg-point-coords {
    font-size: 12px;
    color: var(--text, #e8e8ea);
    font-weight: 600;
}
.cg-point-hex {
    font-size: 11px;
    color: var(--text-muted, #999);
    font-family: ui-monospace, monospace;
    letter-spacing: 0.02em;
}
.cg-detail-panel {
    margin-top: 14px;
    padding: 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(251,191,36,0.08) 0%, rgba(251,191,36,0.02) 100%);
    border: 1px solid rgba(251,191,36,0.3);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cg-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(251,191,36,0.2);
}
.cg-detail-title {
    font-size: 13px;
    font-weight: 700;
    color: #FBBF24;
    display: flex;
    align-items: center;
    gap: 6px;
}
.cg-detail-coords {
    font-size: 11.5px;
    color: var(--text-muted, #999);
    font-family: ui-monospace, monospace;
}
.cg-detail-color-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cg-detail-label {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted, #999);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.cg-detail-color-input {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.cg-detail-color {
    width: 52px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.15);
    cursor: pointer;
    padding: 3px;
    background: rgba(0,0,0,0.3);
}
.cg-detail-color::-webkit-color-swatch-wrapper { padding: 0; }
.cg-detail-color::-webkit-color-swatch { border: none; border-radius: 5px; }
.cg-detail-hex {
    flex: 1;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text, #e8e8ea);
    font-family: ui-monospace, monospace;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.cg-detail-hex:focus {
    outline: none;
    border-color: #FBBF24;
    box-shadow: 0 0 0 3px rgba(251,191,36,0.15);
}
.cg-detail-quick {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.cg-quick-color {
    aspect-ratio: 1;
    border-radius: 6px;
    border: 2px solid rgba(255,255,255,0.15);
    cursor: pointer;
    padding: 0;
    transition: transform .15s, border-color .15s;
}
.cg-quick-color:hover {
    transform: scale(1.1);
    border-color: rgba(255,255,255,0.4);
}
.cg-quick-color.is-active {
    border-color: #FBBF24;
    box-shadow: 0 0 0 2px rgba(251,191,36,0.3);
}
.cg-detail-size-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cg-detail-size-val {
    color: #FBBF24;
    font-family: ui-monospace, monospace;
}
.cg-detail-coords-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.cg-detail-label-small {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted, #999);
    text-transform: uppercase;
}
.cg-detail-num {
    flex: 1;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text, #e8e8ea);
    font-family: ui-monospace, monospace;
    font-size: 13px;
    width: 100%;
}
.cg-detail-num:focus {
    outline: none;
    border-color: #FBBF24;
}
.cg-dot {
    transition: transform .1s, box-shadow .15s, width .15s, height .15s;
}
@media (max-width: 640px) {
    .cg-detail-quick { grid-template-columns: repeat(7, 1fr); gap: 4px; }
    .cg-detail-color { width: 44px; height: 40px; }
    .cg-detail-hex { font-size: 13px; padding: 9px 12px; }
}


/* ═══ v4: pro-набор ═══ */
.cg-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
}
.cg-toolbar-spacer { flex: 1; }
.cg-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text, #e8e8ea);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all .15s;
    font-family: inherit;
}
.cg-icon-btn:hover:not(:disabled) {
    background: rgba(251,191,36,0.1);
    border-color: rgba(251,191,36,0.3);
    color: #FBBF24;
}
.cg-icon-btn:active:not(:disabled) {
    transform: scale(0.94);
}
.cg-icon-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.cg-icon-btn#cgRandom { color: #FBBF24; }
.cg-icon-btn#cgRandom:hover { background: rgba(251,191,36,0.15); border-color: #FBBF24; }
@media (max-width: 640px) {
    .cg-toolbar { padding: 6px; gap: 4px; }
    .cg-icon-btn { width: 34px; height: 34px; font-size: 12px; }
}


/* ═══ v5: чистые тосты + color preview без пипетки ═══ */
.cg-detail-color-preview {
    width: 52px;
    height: 44px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.3);
    flex-shrink: 0;
    transition: background 0.15s;
}


/* ═══ v6: aurora + photo + toggle ═══ */
.cg-canvas.is-animated {
    background-size: 200% 200% !important;
    animation: cgAurora 20s ease-in-out infinite alternate;
}
@keyframes cgAurora {
    0%   { background-position: 0% 0%; }
    25%  { background-position: 100% 30%; }
    50%  { background-position: 70% 100%; }
    75%  { background-position: 30% 70%; }
    100% { background-position: 0% 0%; }
}
.cg-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #e8e8ea);
    transition: all .15s;
}
.cg-toggle:hover {
    background: rgba(251,191,36,0.08);
    border-color: rgba(251,191,36,0.3);
}
.cg-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #FBBF24;
    cursor: pointer;
    flex-shrink: 0;
}
.cg-hint {
    font-size: 11px;
    color: var(--text-muted, #999);
    margin: 6px 0 0;
    line-height: 1.4;
}
.cg-field--aurora {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.cg-icon-btn#cgPhoto {
    color: #A78BFA;
}
.cg-icon-btn#cgPhoto:hover {
    background: rgba(167,139,250,0.15);
    border-color: #A78BFA;
    color: #C4B5FD;
}
