/**
 * 昕藝商品分類折疊選單樣式
 *
 * 配合昕藝花卉坊網站墨綠色系設計（#5D725F）
 */

/* ========== 整體容器 ========== */
.xcc-categories {
    font-family: inherit;
    color: #3d4a3a;
    line-height: 1.6;
}

/* ========== 標題區 ========== */
.xcc-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e8e3d6;
}

.xcc-title {
    font-size: 18px;
    font-weight: 500;
    color: #3d4a3a;
    margin: 0 0 4px;
    letter-spacing: 1px;
}

.xcc-subtitle {
    font-size: 11px;
    color: #8a9080;
    margin: 0;
    letter-spacing: 3px;
    text-transform: uppercase;
}

/* ========== 分類列表 ========== */
.xcc-list,
.xcc-sublist {
    list-style: none;
    margin: 0;
    padding: 0;
}

.xcc-item {
    border-bottom: 1px solid #f0ece2;
}

.xcc-item:last-child {
    border-bottom: none;
}

/* ========== 父分類列 ========== */
.xcc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.xcc-link {
    flex: 1;
    display: block;
    padding: 12px 0;
    font-size: 14px;
    color: #3d4a3a;
    text-decoration: none;
    transition: color 0.2s ease;
    line-height: 1.5;
}

.xcc-link:hover,
.xcc-link:focus {
    color: #5D725F;
    text-decoration: none;
}

.xcc-item.is-current > .xcc-row > .xcc-link {
    color: #5D725F;
    font-weight: 500;
}

.xcc-count {
    font-size: 12px;
    color: #8a9080;
    font-weight: 400;
    margin-left: 4px;
}

/* ========== 展開／收合按鈕 ========== */
.xcc-toggle {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.xcc-toggle:hover,
.xcc-toggle:focus {
    background-color: #f3f1ea;
    outline: none;
}

.xcc-toggle:focus-visible {
    outline: 2px solid #5D725F;
    outline-offset: 2px;
}

.xcc-toggle-icon {
    display: block;
    width: 8px;
    height: 8px;
    border-right: 1.5px solid #5D725F;
    border-bottom: 1.5px solid #5D725F;
    transform: rotate(45deg);
    transition: transform 0.25s ease;
    margin-top: -3px;
}

.xcc-item.is-open > .xcc-row > .xcc-toggle .xcc-toggle-icon {
    transform: rotate(-135deg);
    margin-top: 3px;
}

/* ========== 子分類 ========== */
.xcc-sublist {
    padding: 4px 0 12px 12px;
    border-left: 1px solid #e8e3d6;
    margin-left: 4px;
    animation: xcc-fade-in 0.2s ease-out;
}

.xcc-sublist[hidden] {
    display: none !important;
}

.xcc-subitem {
    padding: 0;
}

.xcc-sublink {
    display: block;
    padding: 8px 12px;
    font-size: 13px;
    color: #6b7268;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1.5;
}

.xcc-sublink:hover,
.xcc-sublink:focus {
    color: #5D725F;
    background-color: #f3f1ea;
    text-decoration: none;
}

.xcc-subitem.is-current > .xcc-sublink {
    color: #5D725F;
    font-weight: 500;
    background-color: #f3f1ea;
}

/* ========== 動畫 ========== */
@keyframes xcc-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== 在小工具區內的調整 ========== */
.widget_xinyi_categories .xcc-categories {
    padding: 0;
}

/* ========== 行動裝置調整 ========== */
@media (max-width: 768px) {
    .xcc-link {
        padding: 14px 0;
        font-size: 15px;
    }

    .xcc-sublink {
        padding: 10px 12px;
        font-size: 14px;
    }

    .xcc-toggle {
        width: 36px;
        height: 36px;
    }
}
