/* ==========================================
   OrionTrade V3 - Bootstrap自定义样式
   ========================================== */

/* ========== 全局样式 ========== */
:root {
    --navbar-height: 56px;
    --mobile-nav-height: 60px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 电子书浅色主题 (参考 chart-complete-v2.html) */
[data-bs-theme="light"] {
    --bs-body-bg: #faf8f3;
    --bs-body-color: #3d3529;
    --bs-primary: #8b7355;
    --bs-secondary: #5c5545;
    --bs-light: #f5f1e8;
    --bs-dark: #3d3529;
    --bs-border-color: #d4cfc0;
    --bs-card-bg: #f5f1e8;
}

[data-bs-theme="light"] .navbar {
    background-color: #8b7355 !important;
}

[data-bs-theme="light"] .card {
    background-color: #f5f1e8;
    border-color: #d4cfc0;
    box-shadow: 0 2px 4px rgba(139, 115, 85, 0.1);
}

[data-bs-theme="light"] .table {
    --bs-table-bg: #f5f1e8;
    --bs-table-border-color: #d4cfc0;
}

[data-bs-theme="light"] .table thead th {
    background-color: #ebe6d9;
    color: #5c5545;
}

[data-bs-theme="light"] .table tbody tr:hover {
    background-color: #ebe6d9;
}

[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
    background-color: #ffffff;
    border-color: #d4cfc0;
    color: #3d3529;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    background-color: #ffffff;
    border-color: #8b7355;
    box-shadow: 0 0 0 0.2rem rgba(139, 115, 85, 0.15);
}

[data-bs-theme="light"] .btn-primary {
    background-color: #8b7355;
    border-color: #8b7355;
}

[data-bs-theme="light"] .btn-primary:hover {
    background-color: #6f5d44;
    border-color: #6f5d44;
}

[data-bs-theme="light"] .btn-outline-primary {
    color: #8b7355;
    border-color: #8b7355;
}

[data-bs-theme="light"] .btn-outline-primary:hover {
    background-color: #8b7355;
    border-color: #8b7355;
    color: #ffffff;
}

[data-bs-theme="light"] .fixed-bottom {
    background-color: #f5f1e8 !important;
    border-top-color: #d4cfc0 !important;
}

[data-bs-theme="light"] .text-muted {
    color: #8a8272 !important;
}

/* 暗色主题变量 */
[data-bs-theme="dark"] {
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #e0e0e0;
}

/* 暗蓝主题变量 */
[data-bs-theme="darkblue"] {
    --bs-body-bg: #1a1d2e;
    --bs-body-color: #e8e9f3;
    --bs-primary: #6b7db8;
    --bs-secondary: #c4c6d8;
    --bs-light: #232640;
    --bs-dark: #1a1d2e;
    --bs-border-color: #3a3f5c;
}

[data-bs-theme="darkblue"] .navbar {
    background-color: #232640 !important;
}

[data-bs-theme="darkblue"] .card {
    background-color: #232640;
    border-color: #3a3f5c;
}

[data-bs-theme="darkblue"] .table {
    --bs-table-bg: #232640;
    --bs-table-border-color: #3a3f5c;
}

[data-bs-theme="darkblue"] .table thead th {
    background-color: #2d3250;
    color: #c4c6d8;
}

[data-bs-theme="darkblue"] .table tbody tr:hover {
    background-color: #2d3250;
}

[data-bs-theme="darkblue"] .btn-primary {
    background-color: #6b7db8;
    border-color: #6b7db8;
}

[data-bs-theme="darkblue"] .btn-primary:hover {
    background-color: #5a6ca8;
    border-color: #5a6ca8;
}

/* 护眼主题变量 */
[data-bs-theme="eyecare"] {
    --bs-body-bg: #f5f8f5;
    --bs-body-color: #2d4a2d;
    --bs-primary: #5a9b5a;
    --bs-secondary: #4a6b4a;
    --bs-light: #e8f0e8;
    --bs-dark: #2d4a2d;
    --bs-border-color: #c0d8c0;
    --bs-card-bg: #e8f0e8;
}

[data-bs-theme="eyecare"] .navbar {
    background-color: #5a9b5a !important;
}

[data-bs-theme="eyecare"] .card {
    background-color: #e8f0e8;
    border-color: #c0d8c0;
    box-shadow: 0 2px 4px rgba(93, 155, 93, 0.1);
}

[data-bs-theme="eyecare"] .table {
    --bs-table-bg: #e8f0e8;
    --bs-table-border-color: #c0d8c0;
}

[data-bs-theme="eyecare"] .table thead th {
    background-color: #d4e5d4;
    color: #2d4a2d;
}

[data-bs-theme="eyecare"] .table tbody tr:hover {
    background-color: #d4e5d4;
}

[data-bs-theme="eyecare"] .form-control,
[data-bs-theme="eyecare"] .form-select {
    background-color: #ffffff;
    border-color: #c0d8c0;
    color: #2d4a2d;
}

[data-bs-theme="eyecare"] .form-control:focus,
[data-bs-theme="eyecare"] .form-select:focus {
    background-color: #ffffff;
    border-color: #5a9b5a;
    box-shadow: 0 0 0 0.2rem rgba(90, 155, 90, 0.15);
}

[data-bs-theme="eyecare"] .btn-primary {
    background-color: #5a9b5a;
    border-color: #5a9b5a;
}

[data-bs-theme="eyecare"] .btn-primary:hover {
    background-color: #4a7f4a;
    border-color: #4a7f4a;
}

[data-bs-theme="eyecare"] .btn-outline-primary {
    color: #5a9b5a;
    border-color: #5a9b5a;
}

[data-bs-theme="eyecare"] .btn-outline-primary:hover {
    background-color: #5a9b5a;
    border-color: #5a9b5a;
    color: #ffffff;
}

[data-bs-theme="eyecare"] .fixed-bottom {
    background-color: #e8f0e8 !important;
    border-top-color: #c0d8c0 !important;
}

[data-bs-theme="eyecare"] .text-muted {
    color: #6b8e6b !important;
}

/* ========== 账户信息页面主题适配 ========== */

/* Light 主题 */
[data-bs-theme="light"] .account-info-header.bg-primary {
    background-color: #8b7355 !important;
}

[data-bs-theme="light"] .accordion-item {
    background-color: #f5f1e8;
    border-color: #d4cfc0;
}

[data-bs-theme="light"] .accordion-button {
    background-color: #f5f1e8;
    color: #3d3529;
}

[data-bs-theme="light"] .accordion-button:not(.collapsed) {
    background-color: #ebe6d9;
    color: #3d3529;
}

[data-bs-theme="light"] .modal-content {
    background-color: #faf8f3;
    border-color: #d4cfc0;
}

[data-bs-theme="light"] .modal-header {
    background-color: #f5f1e8;
    border-bottom-color: #d4cfc0;
}

/* Dark 主题 */
[data-bs-theme="dark"] .account-info-header.bg-primary {
    background-color: #4a9eff !important;
}

[data-bs-theme="dark"] .accordion-item {
    background-color: #2a2a2a;
    border-color: #404040;
}

[data-bs-theme="dark"] .accordion-button {
    background-color: #2a2a2a;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
    background-color: #3a3a3a;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .accordion-button::after {
    filter: invert(1);
}

[data-bs-theme="dark"] .modal-content {
    background-color: #1a1a1a;
    border-color: #404040;
}

[data-bs-theme="dark"] .modal-header {
    background-color: #2a2a2a;
    border-bottom-color: #404040;
}

[data-bs-theme="dark"] .modal-footer {
    border-top-color: #404040;
}

[data-bs-theme="dark"] .btn-close {
    filter: invert(1);
}

/* Dark Blue 主题 */
[data-bs-theme="darkblue"] .account-info-header.bg-primary {
    background-color: #6b7db8 !important;
}

[data-bs-theme="darkblue"] .accordion-item {
    background-color: #232640;
    border-color: #3a3f5c;
}

[data-bs-theme="darkblue"] .accordion-button {
    background-color: #232640;
    color: #e8e9f3;
}

[data-bs-theme="darkblue"] .accordion-button:not(.collapsed) {
    background-color: #2d3250;
    color: #e8e9f3;
}

[data-bs-theme="darkblue"] .accordion-button::after {
    filter: invert(1);
}

[data-bs-theme="darkblue"] .modal-content {
    background-color: #1a1d2e;
    border-color: #3a3f5c;
}

[data-bs-theme="darkblue"] .modal-header {
    background-color: #232640;
    border-bottom-color: #3a3f5c;
}

[data-bs-theme="darkblue"] .modal-footer {
    border-top-color: #3a3f5c;
}

[data-bs-theme="darkblue"] .btn-close {
    filter: invert(1);
}

/* Eye Care 护眼主题 */
[data-bs-theme="eyecare"] .account-info-header.bg-primary {
    background-color: #5a9b5a !important;
}

[data-bs-theme="eyecare"] .accordion-item {
    background-color: #e8f0e8;
    border-color: #c0d8c0;
}

[data-bs-theme="eyecare"] .accordion-button {
    background-color: #e8f0e8;
    color: #2d4a2d;
}

[data-bs-theme="eyecare"] .accordion-button:not(.collapsed) {
    background-color: #d4e5d4;
    color: #2d4a2d;
}

[data-bs-theme="eyecare"] .modal-content {
    background-color: #f5f8f5;
    border-color: #c0d8c0;
}

[data-bs-theme="eyecare"] .modal-header {
    background-color: #e8f0e8;
    border-bottom-color: #c0d8c0;
}

[data-bs-theme="eyecare"] .modal-footer {
    border-top-color: #c0d8c0;
}

/* ========== 主内容区域 ========== */
.main-content {
    min-height: calc(100vh - var(--navbar-height));
    padding-bottom: 20px;
}

/* 移动端主内容适配 */
@media (max-width: 991.98px) {
    .main-content {
        min-height: calc(100vh - var(--mobile-nav-height));
        padding-bottom: calc(var(--mobile-nav-height) + 20px);
    }
}

/* ========== 导航栏样式 ========== */
.navbar-brand {
    font-size: 1.25rem;
    letter-spacing: 0.5px;
}

.nav-link {
    transition: all 0.2s ease;
    border-radius: 4px;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

/* 移动端导航栏 */
.fixed-bottom .nav-link {
    padding: 0.5rem 0.25rem;
    color: #6c757d;
    transition: color 0.2s ease;
}

.fixed-bottom .nav-link:hover {
    color: var(--bs-primary);
}

.fixed-bottom .nav-link.active {
    color: var(--bs-primary);
    background-color: transparent;
}

.fixed-bottom .nav-link.active i {
    transform: scale(1.1);
}

/* 移动端底部导航栏主题适配 */
/* Light 主题 */
[data-bs-theme="light"] .fixed-bottom.navbar {
    background-color: #f5f1e8 !important;
    border-top: 1px solid #d4cfc0 !important;
}

[data-bs-theme="light"] .fixed-bottom .nav-link {
    color: #5c5545;
}

[data-bs-theme="light"] .fixed-bottom .nav-link:hover {
    color: #8b7355;
}

[data-bs-theme="light"] .fixed-bottom .nav-link.active {
    color: #8b7355;
}

/* Dark 主题 */
[data-bs-theme="dark"] .fixed-bottom.navbar {
    background-color: #212529 !important;
    border-top: 1px solid #495057 !important;
}

[data-bs-theme="dark"] .fixed-bottom .nav-link {
    color: #adb5bd;
}

[data-bs-theme="dark"] .fixed-bottom .nav-link:hover {
    color: #0d6efd;
}

[data-bs-theme="dark"] .fixed-bottom .nav-link.active {
    color: #0d6efd;
}

/* Dark Blue 主题 */
[data-bs-theme="darkblue"] .fixed-bottom.navbar {
    background-color: #232640 !important;
    border-top: 1px solid #3a3f5c !important;
}

[data-bs-theme="darkblue"] .fixed-bottom .nav-link {
    color: #c4c6d8;
}

[data-bs-theme="darkblue"] .fixed-bottom .nav-link:hover {
    color: #6b7db8;
}

[data-bs-theme="darkblue"] .fixed-bottom .nav-link.active {
    color: #6b7db8;
}

/* Eye Care 护眼主题 */
[data-bs-theme="eyecare"] .fixed-bottom.navbar {
    background-color: #e8f0e8 !important;
    border-top: 1px solid #c0d8c0 !important;
}

[data-bs-theme="eyecare"] .fixed-bottom .nav-link {
    color: #4a6b4a;
}

[data-bs-theme="eyecare"] .fixed-bottom .nav-link:hover {
    color: #5a9b5a;
}

[data-bs-theme="eyecare"] .fixed-bottom .nav-link.active {
    color: #5a9b5a;
}

/* ========== 页面标题 ========== */
.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--bs-body-color);
}

/* ========== 卡片样式增强 ========== */
.card {
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

/* ========== 表格样式增强 ========== */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--bs-light);
    border-bottom: 2px solid var(--bs-border-color);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--bs-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

[data-bs-theme="dark"] .table thead th {
    background-color: rgba(255, 255, 255, 0.05);
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

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

/* ========== 按钮增强 ========== */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* ========== 徽章样式 ========== */
.badge {
    border-radius: 4px;
    font-weight: 500;
    padding: 0.375em 0.65em;
}

/* ========== 加载动画 ========== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ========== 响应式调整 ========== */
@media (max-width: 767.98px) {
    .page-title {
        font-size: 1.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
    }
}

/* ========== 工具类 ========== */
.text-success-light {
    color: #28a745 !important;
}

.text-danger-light {
    color: #dc3545 !important;
}

.bg-success-light {
    background-color: rgba(40, 167, 69, 0.1) !important;
}

.bg-danger-light {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bs-light);
}

::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--bs-dark);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== 账户页面移动端样式 ========== */
@media (max-width: 991.98px) {
    /* 移动端行样式 */
    .mobile-card-row td {
        padding: 1rem 0.75rem;
    }
    
    /* 网址文字截断 */
    .mobile-card-row .text-truncate {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* 按钮间距 */
    .mobile-card-row .gap-2 {
        gap: 0.5rem !important;
    }
}

/* ========== 市场页面移动端样式 ========== */
@media (max-width: 991.98px) {
    /* 移动端行样式 */
    .mobile-market-row td {
        padding: 0.75rem 0.5rem;
    }
    
    /* 移动端内容对齐 */
    .mobile-market-row .flex-shrink-0 {
        min-width: 0;
    }
}

/* ========== 推薦測試浮動按鈕 ========== */
.floating-referral-test {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: all 0.3s ease;
    z-index: 1040;
}

.floating-referral-test i {
    font-size: 26px;
}

.floating-referral-test span {
    font-size: 11px;
    font-weight: 500;
}

.floating-referral-test:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
    background: linear-gradient(135deg, #ee5a6f, #ff6b6b);
}

.floating-referral-test:active {
    transform: translateY(-1px);
}

/* 推薦碼模態框樣式 */
#referralCodeModal .alert-success {
    background-color: rgba(40, 167, 69, 0.1);
}

#referralCodeModal .alert-success h6 {
    color: #28a745;
    font-size: 14px;
    margin-bottom: 8px;
}

#referralCodeModal .alert-success ul {
    font-size: 13px;
    line-height: 1.8;
}

#referralCodeModal .alert-success ul li {
    color: inherit;
}

/* 不同主题下的推荐按钮适配 */
[data-bs-theme="light"] .floating-referral-test {
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

[data-bs-theme="dark"] .floating-referral-test,
[data-bs-theme="darkblue"] .floating-referral-test {
    background: linear-gradient(135deg, #ff8787, #ff6b6b);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.5);
}

[data-bs-theme="eyecare"] .floating-referral-test {
    background: linear-gradient(135deg, #ff7979, #ff5c5c);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.35);
}
