/* ==========================================================================
   佈景主題基礎樣式（後台「外觀 → 佈景主題」）
   所有主題共用，只讀 --theme-* 變數（由 ThemeService::css() 輸出在 <style id="theme-tokens">）。
   主題專屬外觀寫在 public/themes/{key}/theme.css。

   載入順序在專案 global／layout／style.css 之前，專案自己的樣式仍可覆寫；
   元素選擇器用 :where() 把權重降到 0，避免蓋掉模組或專案的 class 樣式。
   本檔屬於底層 rwd-template 的共用模組，各專案請勿直接修改。
   ========================================================================== */

/* ---------- 文字與背景 ---------- */
:where(body) {
    background-color: var(--theme-bg);
    color: var(--theme-text);
    font-family: var(--theme-font-body);
    font-size: var(--theme-font-size);
}

:where(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .text-title) {
    font-family: var(--theme-font-heading);
    color: var(--theme-heading);
}

:where(a) {
    color: var(--theme-link);
}

:where(.text-muted, small) {
    color: var(--theme-muted) !important;
}

/* 編輯器內容 */
.cms_area a:not([class]) {
    color: var(--theme-link);
}

/* ---------- 按鈕 ---------- */
.uk-button {
    display: inline-block;
    padding: .65em 1.6em;
    border: 1px solid var(--theme-primary);
    border-radius: var(--theme-radius);
    background-color: var(--theme-primary);
    color: var(--theme-button-text);
    text-decoration: none;
    transition: background-color .2s, color .2s, border-color .2s;
}

.uk-button:hover {
    background-color: var(--theme-primary-dark);
    border-color: var(--theme-primary-dark);
    color: var(--theme-button-text);
}

.btn {
    --bs-btn-border-radius: var(--theme-radius);
}

.btn-primary {
    --bs-btn-bg: var(--theme-primary);
    --bs-btn-border-color: var(--theme-primary);
    --bs-btn-color: var(--theme-button-text);
    --bs-btn-hover-bg: var(--theme-primary-dark);
    --bs-btn-hover-border-color: var(--theme-primary-dark);
    --bs-btn-hover-color: var(--theme-button-text);
    --bs-btn-active-bg: var(--theme-primary-dark);
    --bs-btn-active-border-color: var(--theme-primary-dark);
    --bs-btn-active-color: var(--theme-button-text);
}

.btn-outline-primary {
    --bs-btn-color: var(--theme-primary);
    --bs-btn-border-color: var(--theme-primary);
    --bs-btn-hover-bg: var(--theme-primary);
    --bs-btn-hover-border-color: var(--theme-primary);
    --bs-btn-hover-color: var(--theme-button-text);
    --bs-btn-active-bg: var(--theme-primary-dark);
    --bs-btn-active-border-color: var(--theme-primary-dark);
}

.btn-secondary {
    --bs-btn-bg: var(--theme-secondary);
    --bs-btn-border-color: var(--theme-secondary);
    --bs-btn-hover-bg: var(--theme-secondary);
    --bs-btn-hover-border-color: var(--theme-secondary);
}

/* ---------- 表單 ---------- */
.form-control,
.form-select {
    border-color: var(--theme-border);
    border-radius: var(--theme-radius-sm);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 .2rem rgb(var(--theme-primary-rgb) / .2);
}

.form-check-input:checked {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}

/* ---------- 卡片（產品、文章列表） ---------- */
.uk-card-item {
    border-radius: var(--theme-radius-card);
}

.uk-card-item .uk-card-header,
.uk-card-item .img-content {
    border-radius: var(--theme-radius-card) var(--theme-radius-card) 0 0;
    overflow: hidden;
}

.card {
    --bs-card-border-radius: var(--theme-radius-card);
    --bs-card-border-color: var(--theme-border);
}

/* ---------- 分頁、標籤 ---------- */
.pagination {
    --bs-pagination-active-bg: var(--theme-primary);
    --bs-pagination-active-border-color: var(--theme-primary);
    --bs-pagination-color: var(--theme-text);
    --bs-pagination-hover-color: var(--theme-primary);
    --bs-pagination-border-radius: var(--theme-radius-sm);
}

.badge.bg-primary {
    background-color: var(--theme-primary) !important;
}

/* ---------- 頁首／頁尾預設配色（後台「頁首設定」「頁尾設定」有填顏色時以 inline style 為準） ---------- */
.site-header:not(.has-bg) {
    background-color: var(--theme-header-bg);
}

.site-header:not(.has-text-color),
.site-header:not(.has-text-color) .uk-main-nav > li > a,
.site-header:not(.has-text-color) .nav-toggle-button {
    color: var(--theme-header-text);
}

.site-header {
    --hd-btn-bg: var(--theme-primary);
    --hd-btn-text: var(--theme-button-text);
    --hd-link-hover: var(--theme-primary);
}

.site-footer {
    --ft-bg: var(--theme-footer-bg);
    --ft-text: var(--theme-footer-text);
    --ft-title: var(--theme-footer-text);
    --ft-link: var(--theme-footer-text);
    --ft-link-hover: var(--theme-primary);
    --ft-btn-bg: var(--theme-primary);
    --ft-btn-text: var(--theme-button-text);
}

/* ---------- 浮動按鈕、回頂端 ---------- */
.float-menu-container a {
    background-color: var(--theme-primary);
    color: var(--theme-button-text);
}
