/**
 * 全站共用樣式：變數、主色、通用組件（唯一副本，請勿複製到別路徑）
 * 引用：includes/head_common.php → <?php echo $asset_base; ?>assets/css/common.css
 * 後台：include head_common 前設 $asset_base = '../';
 */

/* ========== 設計變數（瑞士金融風 · 直角 · #A31D1F） ========== */
:root {
    /* --primary / --primary-color 由 head_common.php 注入 */
    --primary-light: #f5eaea;
    --sidebar: #1c1c1c;
    --gold: #2c2c2c;
    --accent-blue: #A31D1F;
    --radius: 0;
    --company-kyc-bg: color-mix(in srgb, var(--primary-color, var(--primary, #A31D1F)) 82%, #000000);
}

body.theme-swiss {
    font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    letter-spacing: 0.01em;
}

/* ========== 主色工具類 ========== */
.bg-primary { background-color: var(--primary-color, var(--primary)); }
.text-primary { color: var(--primary-color, var(--primary)); }
.border-primary { border-color: var(--primary-color, var(--primary)); }
.btn-primary {
    background-color: var(--primary-color, var(--primary));
    color: #fff;
    border-radius: var(--radius, 0);
    transition: opacity 0.2s ease;
}
.btn-primary:hover { opacity: 0.94; }

/* 公司 KYC（主色加深約 20%） */
.btn-company-kyc {
    background-color: var(--company-kyc-bg);
    color: #fff;
    border-radius: var(--radius, 0);
}
.btn-company-kyc:hover { opacity: 0.95; }

/* ========== 全站按鈕直角（覆寫 Tailwind rounded-*） ========== */
button,
input[type="button"],
input[type="submit"],
input[type="reset"],
input[type="file"]::file-selector-button,
.btn-primary,
.btn-company-kyc,
[role="button"] {
    border-radius: var(--radius, 0) !important;
}
button[class*="rounded"],
input[type="button"][class*="rounded"],
input[type="submit"][class*="rounded"],
input[type="reset"][class*="rounded"],
a[class*="rounded"].inline-flex,
a[class*="rounded"].flex,
a[class*="rounded"].block,
a.bg-primary,
a[class*="bg-primary"][class*="text-white"],
a[class*="bg-\[#A31D1F\]"],
a[class*="bg-\[#535891\]"],
.admin-topbar a[class*="rounded"],
.sidebar-hamburger {
    border-radius: 0 !important;
}

/* 預約匯率表：幣種列梅花間竹（tbody .transition-colors；td 一併著色以免 Tailwind／flex cell 蓋掉 tr 底色） */
table.portal-rates-zebra tbody > tr.transition-colors:nth-child(odd),
table.portal-rates-zebra tbody > tr.transition-colors:nth-child(odd) > td {
    background-color: #ffffff;
}
table.portal-rates-zebra tbody > tr.transition-colors:nth-child(even),
table.portal-rates-zebra tbody > tr.transition-colors:nth-child(even) > td {
    background-color: color-mix(
        in srgb,
        var(--primary-color, var(--primary, #1e3a5a)) 4%,
        #ffffff
    );
}
table.portal-rates-zebra tbody > tr.transition-colors:hover {
    filter: brightness(0.985);
}

/* ========== 即時匯率頁 · 門店 Tab（單行；過寬則橫向捲動） ========== */
/* !important：避免 Tailwind CDN 注入樣式覆寫於後導致換行 */
.rate-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}
.rate-tabs .rate-tab {
    order: 1;
    display: inline-flex !important;
    justify-content: center;
    align-items: center;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    border-radius: 0;
    background: #fff;
    color: #6b7280;
    text-decoration: none;
    transition: background ease 0.3s, color ease 0.3s;
    border: none;
    flex: 0 0 auto !important;
    max-width: none !important;
    white-space: nowrap !important;
}
.rate-tabs .rate-tab:hover { color: #374151; }
.rate-tabs .rate-tab.is-active { background-color: var(--primary); color: #fff; }

/* 預約日期晶片（無分店主題時亦有足夠對比） */
.slot-date-chip.is-selected {
    background-color: var(--primary-color, var(--primary)) !important;
    color: #fff !important;
    border-color: var(--primary-color, var(--primary)) !important;
}
.slot-date-chip.is-selected .slot-date-weekday { color: rgba(255,255,255,0.92) !important; }
.slot-date-chip.is-selected .slot-date-chip-check { color: #fff !important; opacity: 1 !important; }
.rate-tabs .rate-tab-content {
    order: 9;
    flex-grow: 1;
    width: 100%;
    display: block;
    padding: 0;
    background: #fff;
    box-shadow: none;
    border-radius: 0;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}
@media (max-width: 465px) {
    .rate-tabs .rate-tab-content,
    .rate-tabs .rate-tab { order: initial; }
}

/* ========== 即時匯率頁 · 跑馬燈 ========== */
@keyframes marquee-ltr {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}
.marquee-line {
    display: inline-block;
    padding-left: 100%;
    animation: marquee-ltr 28s linear infinite;
    white-space: nowrap;
}
.marquee-line:hover { animation-play-state: paused; }
.marquee-content { display: inline-block; padding-left: 3em; }

/* ========== 底部彈出選擇（幣種 / 通用） ========== */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.bottom-sheet-overlay.show { opacity: 1; visibility: visible; }
.bottom-sheet {
    position: fixed;
    left: 50%;
    bottom: 0;
    width: 100%;
    max-width: 32rem;
    max-height: 70vh;
    background: #fff;
    border-radius: 0;
    z-index: 101;
    transform: translate(-50%, 100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}
.bottom-sheet.show { transform: translate(-50%, 0); }
.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 0;
    margin: 10px auto 8px;
}
.bottom-sheet-title {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}
.bottom-sheet-body {
    overflow-y: auto;
    max-height: calc(70vh - 60px);
    padding: 8px 0 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* ========== 幣種圖示與選擇器 ========== */
.coin-icon-wrap {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.coin-icon-wrap img { width: 44px; height: 44px; object-fit: contain; }
.coin-icon-wrap .fa-coins { color: var(--primary); font-size: 1.5rem; }
.currency-picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.15s;
}
.currency-picker-item:hover,
.currency-picker-item:active { background: #f3f4f6; }
.currency-picker-item .coin-icon-wrap { width: 40px; height: 40px; }
.currency-picker-item .coin-icon-wrap img { width: 40px; height: 40px; }
.currency-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    padding: 4px 0;
}
.currency-trigger .chevron { color: #9ca3af; font-size: 0.75rem; margin-left: auto; }

/* ========== 步驟指示（代客建單 / 匯款等） ========== */
.step-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.2s;
}
.step-dot.active { background: var(--primary); color: white; }
.step-dot.done { background: #10b981; color: white; }
.step-dot.pending { background: #e5e7eb; color: #9ca3af; }
.create-step-panel { display: none; }
.create-step-panel.active { display: block; animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ========== 後台側欄（與 admin_sidebar 變數一致，可選用） ========== */
.sidebar { background-color: var(--sidebar); width: 260px; }
.nav-link { color: #a2a3b7; transition: all 0.3s; }
.nav-link:hover,
.nav-link.active { color: white; background: rgba(255,255,255,0.05); }

/* ========== 訂單 Tab（全部/待上傳/...） ========== */
.tab-active {
    border-bottom: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* ========== KYC / 表單焦點（可選） ========== */
.kyc-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color, #A31D1F) 25%, transparent);
}
.upload-box:hover { border-color: var(--primary); background: var(--primary-light, #f5eaea); }
.upload-cell:hover { border-color: var(--primary); background: var(--primary-light, #f5eaea); }

/* ========== 方案卡選中（買入方案等） ========== */
.plan-card:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light, #f5eaea);
}

/* 瑞士金融：卡片／面板直角、細邊框（對齊後台 admin/index） */
.theme-swiss .card {
    background: #fff;
    border-radius: 0 !important;
    box-shadow: 0 1px 0 #e5e5e5 !important;
    border: 1px solid #e0e0e0 !important;
    border-top: 3px solid var(--primary-color, var(--primary, #A31D1F)) !important;
}
.theme-swiss [class*="rounded"] {
    border-radius: 0 !important;
}
.theme-swiss .shadow-xl,
.theme-swiss .shadow-2xl,
.theme-swiss .shadow-lg {
    box-shadow: 0 1px 0 #e5e5e5, 0 8px 24px rgba(0, 0, 0, 0.06) !important;
}
.theme-swiss body {
    background: #f5f5f5;
}

/* ========== 會員端預約日期 chip：選中＝主色底＋白字，無淺底特效 ========== */
button.slot-date-chip.bg-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
}
button.slot-date-chip.bg-primary:hover,
button.slot-date-chip.bg-primary:focus {
    background-color: var(--primary) !important;
    color: #fff !important;
}
button.slot-date-chip.bg-primary .slot-date-chip-check {
    color: var(--primary);
    background: rgba(255,255,255,0.95);
}
button.slot-date-chip.bg-primary span:not(.slot-date-chip-check) {
    color: #fff !important;
}
