/* ================================================================
   夜間／深色主題（預設） — body[data-theme="dark"] 全域覆寫
   覆蓋頂欄、內容區、卡片、表格、表單與 UserInfo 組件。
   切到 light 時移除本組規則，回歸 style.css/light-theme.css 淺色。
   ================================================================ */

/* ----- 全站色彩變數 ----- */
body[data-theme="dark"] {
    --bg-color: #0a1c2d;
    --card-bg: #10283d;
    --text-main: #e8f7ff;
    --text-muted: #9db4c8;
    --border-color: #1e3a52;
    --primary-color: #6ea8dc;
    --accent-color: #e94560;
    --success-color: #2ecc9a;
    --warning-color: #f5c33b;
    background-color: var(--bg-color);
    color: var(--text-main);
}

/* ----- 標題與文字 ----- */
body[data-theme="dark"] h1,
body[data-theme="dark"] h2,
body[data-theme="dark"] h3,
body[data-theme="dark"] h4,
body[data-theme="dark"] h5,
body[data-theme="dark"] h6 {
    color: #e8f7ff;
}

body[data-theme="dark"] .text-primary { color: #6ea8dc !important; }
body[data-theme="dark"] .text-muted { color: #9db4c8 !important; }
body[data-theme="dark"] .text-dark { color: #e8f7ff !important; }
body[data-theme="dark"] .text-secondary { color: #a9c3d6 !important; }
body[data-theme="dark"] .text-success { color: #2ecc9a !important; }
body[data-theme="dark"] .text-warning { color: #f5c33b !important; }
body[data-theme="dark"] .text-danger { color: #ff7b72 !important; }
body[data-theme="dark"] .text-body,
body[data-theme="dark"] .text-body-secondary { color: #c9d9e6 !important; }

/* ----- 頂欄 ----- */
body[data-theme="dark"] .top-navbar {
    background: #0f2940;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.35);
}

body[data-theme="dark"] .brand-name-en {
    color: #e8f7ff;
}

body[data-theme="dark"] .brand-name-zh {
    color: #d4a836;
}

body[data-theme="dark"] .top-user-name {
    color: #a9c3d6 !important;
}

body[data-theme="dark"] .top-user-rank {
    color: #70e5d0 !important;
}

body[data-theme="dark"] .user-profile img {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"] .language-switcher .form-select,
body[data-theme="dark"] .language-switcher select {
    background-color: #10283d;
    color: #e8f7ff;
    border-color: #1e3a52;
}

body[data-theme="dark"] .sidebar-toggler {
    color: #e8f7ff;
    border-color: rgba(255, 255, 255, 0.25);
}

/* ----- 登入／註冊等訪客按鈕 ----- */
body[data-theme="dark"] .navbar-right-controls .btn-outline-primary {
    color: #6ea8dc;
    border-color: rgba(110, 168, 220, 0.6);
}

body[data-theme="dark"] .navbar-right-controls .btn-outline-primary:hover {
    color: #fff;
    background-color: #6ea8dc;
    border-color: #6ea8dc;
}

body[data-theme="dark"] .admin-gear-btn {
    border-color: rgba(255, 255, 255, 0.35) !important;
    color: #e8f7ff;
}

/* ----- 下拉選單 ----- */
body[data-theme="dark"] .dropdown-menu {
    background-color: #10283d;
    color: #e8f7ff;
    border: 1px solid #1e3a52;
}

body[data-theme="dark"] .dropdown-menu .dropdown-item {
    color: #e8f7ff;
}

body[data-theme="dark"] .dropdown-menu .dropdown-item:hover,
body[data-theme="dark"] .dropdown-menu .dropdown-item:focus {
    background-color: #1a3a55;
    color: #ffffff;
}

body[data-theme="dark"] .dropdown-menu .dropdown-divider {
    border-color: #1e3a52;
}

body[data-theme="dark"] .dropdown-menu .text-dark {
    color: #e8f7ff !important;
}

body[data-theme="dark"] .dropdown-menu .text-secondary {
    color: #a9c3d6 !important;
}

/* ----- 卡片 ----- */
body[data-theme="dark"] .fin-card {
    background: var(--card-bg);
    border-color: rgba(132, 228, 255, 0.15);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

body[data-theme="dark"] .fin-card:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.35);
}

body[data-theme="dark"] .card {
    background-color: var(--card-bg);
    color: var(--text-main);
    border-color: rgba(132, 228, 255, 0.15);
}

body[data-theme="dark"] .card-header,
body[data-theme="dark"] .card-footer {
    background-color: rgba(10, 28, 45, 0.55);
    border-color: #1e3a52;
    color: var(--text-main);
}

body[data-theme="dark"] .light-card {
    background: var(--card-bg);
    border-color: #1e3a52;
    color: var(--text-main);
}

/* ----- UserInfo 組件 ----- */
body[data-theme="dark"] .user-info-light-section {
    background: linear-gradient(135deg, #0d2236 0%, #0f2f4a 100%);
}

body[data-theme="dark"] .user-header-card {
    background: #10283d;
    border-color: #1e3a52;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .username-text {
    color: #70e5d0;
}

body[data-theme="dark"] .rank-status {
    color: #a78bfa;
}

body[data-theme="dark"] .wallet-card {
    background: #10283d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .wallet-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

body[data-theme="dark"] .wallet-label {
    color: #9db4c8;
}

body[data-theme="dark"] .wallet-amount {
    color: #e8f7ff;
}

body[data-theme="dark"] .wallet-card.profit .wallet-amount { color: #6ea8dc; }
body[data-theme="dark"] .wallet-card.performance .wallet-amount { color: #f5c33b; }
body[data-theme="dark"] .wallet-card.cash .wallet-amount { color: #2ecc9a; }
body[data-theme="dark"] .wallet-card.rwa .wallet-amount { color: #a78bfa; }

body[data-theme="dark"] .info-row {
    background: #10283d;
    border-color: #1e3a52;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .info-row label {
    color: #9db4c8;
}

body[data-theme="dark"] .info-value {
    color: #70e5d0;
}

body[data-theme="dark"] .stock-section {
    background: #10283d;
    border-color: #1e3a52;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body[data-theme="dark"] .stock-title {
    color: #70e5d0;
}

body[data-theme="dark"] .stock-list li {
    color: #c9d9e6;
}

body[data-theme="dark"] .stock-list li:before {
    color: #6ea8dc;
}

body[data-theme="dark"] .stock-serial {
    color: #e8f7ff;
}

body[data-theme="dark"] .stock-pledgor {
    color: #9db4c8;
}

/* ----- 表格 ----- */
body[data-theme="dark"] .table-custom th {
    color: var(--text-muted);
    border-color: var(--border-color);
}

body[data-theme="dark"] .table-custom td {
    color: var(--text-main);
    border-color: var(--border-color);
}

body[data-theme="dark"] .table,
body[data-theme="dark"] .table-hover,
body[data-theme="dark"] .table-striped {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}

body[data-theme="dark"] .table thead th {
    color: var(--text-muted);
    border-color: var(--border-color);
}

body[data-theme="dark"] .table th,
body[data-theme="dark"] .table td {
    border-color: var(--border-color);
    color: var(--text-main);
}

body[data-theme="dark"] .light-table {
    background: var(--card-bg);
    color: var(--text-main);
}

body[data-theme="dark"] .light-table thead th {
    color: #9db4c8;
    background-color: rgba(10, 28, 45, 0.55);
    border-color: #1e3a52;
}

body[data-theme="dark"] .light-table tbody tr {
    border-color: #1e3a52;
}

body[data-theme="dark"] .light-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .light-table tbody td {
    color: var(--text-main);
    border-color: #1e3a52;
}

/* ----- 表單 ----- */
body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-select {
    background-color: #10283d;
    color: #e8f7ff;
    border-color: #1e3a52;
}

body[data-theme="dark"] .form-control:focus,
body[data-theme="dark"] .form-select:focus {
    background-color: #10283d;
    color: #e8f7ff;
    border-color: #6ea8dc;
    box-shadow: 0 0 0 0.25rem rgba(110, 168, 220, 0.2);
}

body[data-theme="dark"] .form-control::placeholder {
    color: #6b8194;
}

body[data-theme="dark"] .form-control:disabled,
body[data-theme="dark"] .form-control[readonly] {
    background-color: #0d1f30;
    color: #9db4c8;
}

body[data-theme="dark"] .form-label {
    color: #c9d9e6;
}

body[data-theme="dark"] .light-form-group label {
    color: #9db4c8;
}

body[data-theme="dark"] .light-form-input,
body[data-theme="dark"] .light-form-select,
body[data-theme="dark"] .light-form-textarea {
    background-color: #10283d;
    color: #e8f7ff;
    border-color: #1e3a52;
}

body[data-theme="dark"] .light-form-input:focus,
body[data-theme="dark"] .light-form-select:focus,
body[data-theme="dark"] .light-form-textarea:focus {
    background-color: #10283d;
    color: #e8f7ff;
    border-color: #6ea8dc;
}

/* ----- 列表／導覽 ----- */
body[data-theme="dark"] .list-group {
    background: transparent;
}

body[data-theme="dark"] .list-group-item {
    background-color: #10283d;
    color: #e8f7ff;
    border-color: #1e3a52;
}

body[data-theme="dark"] .nav-pills .nav-link {
    color: #c9d9e6;
}

body[data-theme="dark"] .nav-pills .nav-link.active {
    background-color: #6ea8dc;
    color: #fff;
}

body[data-theme="dark"] .accordion-button {
    background-color: #10283d;
    color: #e8f7ff;
    border-color: #1e3a52;
}

body[data-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #17314a;
    color: #e8f7ff;
}

body[data-theme="dark"] .accordion-body {
    background-color: #10283d;
    color: #e8f7ff;
}

/* ----- 彈窗與警報 ----- */
body[data-theme="dark"] .modal-content {
    background-color: #10283d;
    color: #e8f7ff;
    border-color: #1e3a52;
}

body[data-theme="dark"] .modal-header,
body[data-theme="dark"] .modal-footer {
    border-color: #1e3a52;
}

body[data-theme="dark"] .modal-title {
    color: #e8f7ff;
}

body[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body[data-theme="dark"] .alert {
    color: #e8f7ff;
}

body[data-theme="dark"] .alert-info,
body[data-theme="dark"] .alert-primary {
    background-color: #17314a;
    border-color: #2a4a66;
    color: #c9e5ff;
}

body[data-theme="dark"] .alert-success {
    background-color: #0f2f26;
    border-color: #1e4a3a;
    color: #a7f3d0;
}

body[data-theme="dark"] .alert-warning {
    background-color: #2f2a0f;
    border-color: #4a4220;
    color: #ffe9a7;
}

body[data-theme="dark"] .alert-danger {
    background-color: #33201f;
    border-color: #5a302d;
    color: #ffb4ad;
}

/* ----- 分頁 ----- */
body[data-theme="dark"] .pagination .page-link {
    background-color: #10283d;
    color: #6ea8dc;
    border-color: #1e3a52;
}

body[data-theme="dark"] .pagination .page-link:hover {
    background-color: #1a3a55;
    color: #ffffff;
}

body[data-theme="dark"] .pagination .page-item.active .page-link {
    background-color: #6ea8dc;
    border-color: #6ea8dc;
    color: #fff;
}

/* ----- 註冊表單分區卡片 ----- */
body[data-theme="dark"] .reg-form-intro {
    background: var(--card-bg);
}

body[data-theme="dark"] .reg-card {
    background: var(--card-bg);
}

body[data-theme="dark"] .reg-card-header {
    background: #17314a;
    border-bottom-color: #1e3a52;
}

body[data-theme="dark"] .reg-step {
    background: #6ea8dc;
    color: #0a1c2d;
}

body[data-theme="dark"] .reg-balance-list {
    background: #0d1f30;
}

body[data-theme="dark"] .reg-total-row {
    background: #17314a;
}

/* ----- 頁首首頁（訪客）內容區 ----- */
body[data-theme="dark"] .home-section,
body[data-theme="dark"] .intro-video-area,
body[data-theme="dark"] .faq section {
    background: linear-gradient(135deg, #0d2236 0%, #0f2f4a 100%);
    color: var(--text-main);
}

/* ----- DataTables / 其他常用容器 ----- */
body[data-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: #10283d;
    color: #e8f7ff;
    border-color: #1e3a52;
}

body[data-theme="dark"] .page-header-banner {
    background: linear-gradient(135deg, #0b1b2e, #12314f);
}

body[data-theme="dark"] hr {
    border-color: #1e3a52;
}

body[data-theme="dark"] code {
    color: #ffb86b;
}
