/* ================================================================
   渐变配色表 · 页面私有样式（gradient-palette.css）
   需在 /css/common.css 之后加载。
   ================================================================ */

/* ---- 颜色选择行 ---- */
.color-row {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.color-picker {
    width: 48px;
    height: 40px;
    padding: 2px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.flex-1 {
    flex: 1;
}

/* ---- 快速配色 ---- */
.grad-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.grad-quick .btn {
    padding: 6px 10px;
    font-size: 12px;
}

.tip {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 6px;
}

/* ---- 预览区 ---- */
.grad-preview {
    min-height: 240px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

/* ---- CSS 代码框 ---- */
.grad-css {
    margin-top: 12px;
}

.grad-css-text {
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 13px;
    color: #4b5563;
    resize: vertical;
}

/* ---- 中间色标 ---- */
.grad-stops {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.grad-stops .stop {
    flex: 1;
    min-width: 46px;
    height: 56px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.grad-stops .stop:hover {
    transform: scale(1.08);
}

.grad-stops .stop-hex {
    position: absolute;
    left: 4px;
    right: 4px;
    bottom: 4px;
    font-size: 10px;
    text-align: center;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    background: rgba(0, 0, 0, 0.18);
    border-radius: 3px;
    padding: 1px 2px;
    font-family: Consolas, Monaco, 'Courier New', monospace;
}

/* ---- 配色表网格 ---- */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    padding: 14px;
}

.palette-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.palette-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.palette-bar {
    height: 72px;
}

.palette-meta {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.palette-name {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.palette-hex {
    font-size: 11px;
    color: #9ca3af;
    font-family: Consolas, Monaco, 'Courier New', monospace;
}

/* ---- 追加卡片：item.item-clr-gradient（源于配色表，清洗后静态化） ---- */
.item.item-clr-gradient {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.item.item-clr-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.gradient-block {
    height: 72px;
    position: relative;
    cursor: pointer;
}

.gradient-text {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
}

.gradient-text-item {
    display: inline-flex;
}

.clr-btn {
    position: relative;
    display: inline-block;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 11px;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    padding: 4px 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}

.clr-btn:hover {
    background: #fff;
    border-color: #9ca3af;
}

.clr-btn input.copy-content {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    border: 0;
    padding: 0;
    margin: 0;
}

@media (max-width: 600px) {
    .color-row {
        flex-direction: column;
    }

    .color-picker {
        width: 100%;
        height: 44px;
    }
}

/* ---- 颜色占比 / 色标编辑器 ---- */
.grad-stops-editor {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
}

.gs-header {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.gs-hint {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 400;
    margin-left: 6px;
}

.gs-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #fafafa;
}

.gs-color {
    width: 38px;
    height: 30px;
    padding: 1px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    flex: none;
}

.gs-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.gs-color::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.gs-hex {
    width: 84px;
    font-family: Consolas, Menlo, Monaco, monospace;
    font-size: 12px;
    padding: 5px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    flex: none;
}

.gs-pos {
    flex: 1;
    min-width: 80px;
    accent-color: #6366f1;
    cursor: pointer;
}

.gs-pos-lock {
    width: 52px;
    flex: none;
    font-family: Consolas, Menlo, Monaco, monospace;
    font-size: 12px;
    color: #9ca3af;
}

.gs-pos-val {
    width: 42px;
    flex: none;
    text-align: right;
    font-family: Consolas, Menlo, Monaco, monospace;
    font-size: 12px;
    color: #4b5563;
}

.gs-remove {
    flex: none;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 14px;
    line-height: 1;
    padding: 4px 6px;
}

.gs-remove:hover {
    color: #ef4444;
}

.gs-add {
    margin-top: 4px;
    width: 100%;
    padding: 6px;
    border: 1px dashed #c4c9d3;
    border-radius: 6px;
    background: transparent;
    color: #4b5563;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.gs-add:hover {
    border-color: #6366f1;
    color: #6366f1;
}

@media (max-width: 600px) {
    .gs-row {
        flex-wrap: wrap;
    }

    .gs-pos {
        flex-basis: 100%;
        order: 3;
    }
}