/**
 * Attribute Gallery — 前端色卡縮略圖樣式
 */

/* ── 隱藏原始 select（被色卡替代時）── */
.styler-ag-hidden-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    padding: 0 !important;
    margin: -1px !important;
}

/* ── 色卡容器 ── */
.styler-ag-swatches-frontend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 8px 0 4px;
}

/* ── 單個色卡 ── */
.styler-ag-swatch-item {
    position: relative;
    width: 64px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.15s ease;
}

.styler-ag-swatch-item:hover {
    transform: translateY(-2px);
}

/* 圖片 */
.styler-ag-swatch-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    display: block;
    margin: 0 auto;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.styler-ag-swatch-item:hover img {
    border-color: #999;
}

.styler-ag-swatch-item.active img {
    border-color: #222;
    box-shadow: 0 0 0 1px #222;
}

/* 沒有縮略圖時顯示文字 */
.styler-ag-swatch-text {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    background: #f5f5f5;
    margin: 0 auto;
    font-size: 12px;
    color: #555;
    text-transform: capitalize;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.styler-ag-swatch-item:hover .styler-ag-swatch-text {
    border-color: #999;
}

.styler-ag-swatch-item.active .styler-ag-swatch-text {
    border-color: #222;
    box-shadow: 0 0 0 1px #222;
    background: #fff;
}

/* 標籤文字 */
.styler-ag-swatch-label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    line-height: 1.2;
    text-transform: capitalize;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.styler-ag-swatch-item.active .styler-ag-swatch-label {
    color: #222;
    font-weight: 600;
}

/* ── 手機端適配 ── */
@media (max-width: 768px) {
    .styler-ag-swatches-frontend {
        gap: 8px;
    }

    .styler-ag-swatch-item {
        width: 56px;
    }

    .styler-ag-swatch-item img,
    .styler-ag-swatch-text {
        width: 52px;
        height: 52px;
    }

    .styler-ag-swatch-label {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .styler-ag-swatch-item {
        width: 48px;
    }

    .styler-ag-swatch-item img,
    .styler-ag-swatch-text {
        width: 44px;
        height: 44px;
        border-radius: 6px;
    }
}
