/**
 * 前端顯示樣式
 */

/* 顏色規格容器 */
.ys-color-spec-display {
    margin: 15px 0;
}

/* 標題 */
.ys-color-spec-title {
    font-size: 18px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

/* 顏色色塊容器 */
.ys-color-spec-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* 單個色塊 */
.ys-color-spec-swatch {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.ys-color-spec-swatch:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 選中狀態 */
.ys-color-spec-swatch.selected {
    border-color: #333;
    box-shadow: 0 0 0 2px #333;
}

/* 顏色顯示 */
.ys-color-spec-swatch .swatch-color {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
}

/* 圖片顯示 */
.ys-color-spec-swatch .swatch-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    overflow: hidden;
}

/* Tooltip 效果 - 附加到 body，使用 fixed 定位避免 overflow 裁切 */
.ys-color-spec-tooltip {
    position: fixed;
    padding: 8px 16px;
    background: #333;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    border-radius: 4px;
    pointer-events: none;
    z-index: 99999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ys-color-spec-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}

/* Tooltip 顯示在下方時的箭頭 */
.ys-color-spec-tooltip.tooltip-bottom::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #333;
}

/* 小尺寸變體 */
.ys-color-spec-display.size-small .ys-color-spec-swatch {
    width: 32px;
    height: 32px;
}

/* 大尺寸變體 */
.ys-color-spec-display.size-large .ys-color-spec-swatch {
    width: 56px;
    height: 56px;
}

/* 響應式調整 */
@media screen and (max-width: 768px) {
    .ys-color-spec-swatch {
        width: 40px;
        height: 40px;
    }

    .ys-color-spec-swatches {
        gap: 6px;
    }
}

/* 無障礙支援 - 焦點狀態 */
.ys-color-spec-swatch:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* 深色模式支援 */
@media (prefers-color-scheme: dark) {
    .ys-color-spec-tooltip {
        background: #fff;
        color: #333;
    }

    .ys-color-spec-tooltip::after {
        border-top-color: #fff;
    }

    .ys-color-spec-tooltip.tooltip-bottom::after {
        border-top-color: transparent;
        border-bottom-color: #fff;
    }
}
