/* ============================================================
   WL-Bot Base CSS (核心基礎)
   變數、Reset、全域元素樣式、工具類
   ============================================================ */

/* === 1. CSS Variables (設計系統變數) === */
:root {
    /* 顏色系統 - 預設深色主題 */
    --bg-deep: #050505;
    --bg-spotlight: #1a1a1a;
    --accent-gold: #d4af37;
    --glass-surface: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-main: #ffffff;
    --text-muted: #d0d0d0;
    
    /* Bootstrap 變數覆寫 */
    --bs-body-bg: var(--bg-deep);
    --bs-body-color: var(--text-main);
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-border-color: var(--glass-border);
    
    /* Navbar 變數 */
    --nav-height: 70px;
    --nav-bg-mobile: rgba(5, 5, 5, 0.98);
    --gold-accent: #d4af37;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.85);
}

/* 淺色主題變數覆寫 */
[data-theme="light"] {
    /* 顏色系統 - 淺色主題 */
    --bg-deep: #f8f9fa;
    --bg-spotlight: #ffffff;
    --accent-gold: #d4af37;
    --glass-surface: rgba(0, 0, 0, 0.03); 
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-main: #212529;
    --text-muted: #6c757d;
    
    /* Bootstrap 變數覆寫 - 淺色主題 */
    --bs-body-bg: var(--bg-deep);
    --bs-body-color: var(--text-main);
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-main);
    --bs-table-border-color: var(--glass-border);
    
    /* Navbar 變數 - 淺色主題 */
    --nav-bg-mobile: rgba(248, 249, 250, 0.98);
    --text-primary: #212529;
    --text-secondary: rgba(33, 37, 41, 0.7);
}

/* === 2. Reset & Normalize === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    font-size: 16px;
    line-height: 1.5;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

/* === 3. Base Styles (全域元素) === */
body {
    background-color: var(--bg-deep);
    background-image: radial-gradient(circle at 50% 0%, #2a2a2a 0%, #000000 80%);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    padding-top: var(--nav-height);
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="light"] body {
    background-image: radial-gradient(circle at 50% 0%, #e9ecef 0%, #f8f9fa 80%);
}

a {
    text-decoration: none;
    color: var(--text-main);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-gold);
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* === 4. Bootstrap Overrides (通用工具類) === */
.text-muted {
    color: var(--text-muted);
}

.text-white-50,
.text-white-50.mb-0,
p.text-white-50 {
    color: rgba(255, 255, 255, 0.85) !important;
}

.text-light {
    color: var(--text-secondary);
}

[data-theme="light"] .text-light,
[data-theme="light"] a.text-light,
[data-theme="light"] footer a.text-light,
[data-theme="light"] footer.text-white a.text-light {
    color: var(--text-main);
}

.text-white {
    color: #ffffff;
}

[data-theme="light"] .text-white,
[data-theme="light"] .text-white.fw-bold,
[data-theme="light"] h4.text-white,
[data-theme="light"] h5.text-white,
[data-theme="light"] strong.text-white,
[data-theme="light"] span.text-white,
[data-theme="light"] p.text-white {
    color: var(--text-main) !important;
}

.text-dark {
    color: var(--bg-deep);
}

.bg-light {
    background-color: var(--bg-spotlight);
}

/* === 5. Utility Classes (通用工具類) === */
.loading {
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

.fade-in-down {
    animation: fadeInDown 0.6s ease-out;
}

.badge-sm {
    font-size: 0.65em;
    padding: 0.25em 0.5em;
}

.badge-lg {
    font-size: 1em;
    padding: 0.5em 1em;
}

.badge-enhanced {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}
