/**
 * Web3 科技風格主題 CSS 變數和基礎樣式
 * 深色主題、霓虹效果、區塊鏈視覺元素
 */

:root {
    /* Web3 背景顏色 */
    --web3-bg-primary: #0a0e27;
    --web3-bg-secondary: #1a1f3a;
    --web3-bg-tertiary: #252b47;
    --web3-bg-card: rgba(26, 31, 58, 0.7);
    
    /* Web3 霓虹顏色 */
    --web3-neon-blue: #00d4ff;
    --web3-neon-purple: #7b2ff7;
    --web3-neon-green: #00ff88;
    --web3-neon-cyan: #4eeaff;
    --web3-neon-pink: #ff00ff;
    
    /* Web3 漸層 */
    --web3-gradient-primary: linear-gradient(135deg, #00d4ff 0%, #7b2ff7 100%);
    --web3-gradient-secondary: linear-gradient(135deg, #00ff88 0%, #00d4ff 100%);
    --web3-gradient-accent: linear-gradient(135deg, #7b2ff7 0%, #ff00ff 100%);
    --web3-gradient-bg: radial-gradient(1200px 500px at 20% 0%, rgba(0, 212, 255, 0.10), transparent 55%),
                        radial-gradient(900px 500px at 90% 10%, rgba(123, 47, 247, 0.10), transparent 50%),
                        linear-gradient(180deg, var(--web3-bg-primary), var(--web3-bg-secondary));
    
    /* Web3 文字顏色（確保在深色背景上有足夠對比度） */
    --web3-text-primary: #ffffff;
    --web3-text-secondary: #e0e0e0;
    --web3-text-tertiary: #c0c0c0;  /* 從 #b0b0b0 調整，提高對比度 */
    --web3-text-muted: #a0a0a0;  /* 從 #888888 調整，提高對比度 */
    
    /* 新增/補齊：針對卡片/區塊的文字顏色 token */
    --web3-text-on-bg: #ffffff;        /* 頁面背景上的主文字 */
    --web3-text-on-surface: #ffffff;  /* 卡片/區塊上的主文字 */
    --web3-text-on-surface-secondary: #e0e0e0;  /* 卡片/區塊上的次文字 */
    --web3-text-on-surface-muted: #c0c0c0;      /* 卡片/區塊上的說明文字 */
    
    /* 確保卡片背景 token 明確 */
    --web3-surface-1: rgba(26, 31, 58, 0.7);    /* 主卡片背景 */
    --web3-surface-2: rgba(37, 43, 71, 0.8);   /* 次卡片背景/hover */
    
    /* Web3 玻璃態效果 */
    --web3-glass-bg: rgba(26, 31, 58, 0.7);
    --web3-glass-bg-light: rgba(255, 255, 255, 0.06);
    --web3-glass-bg-medium: rgba(255, 255, 255, 0.08);
    --web3-glass-border: rgba(0, 212, 255, 0.3);
    --web3-glass-border-light: rgba(255, 255, 255, 0.12);
    --web3-glass-border-medium: rgba(78, 234, 255, 0.22);
    
    /* Web3 陰影 */
    --web3-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --web3-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --web3-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --web3-shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.6);
    --web3-shadow-neon: 0 0 0 1px rgba(78, 234, 255, 0.10), 0 0 28px rgba(78, 234, 255, 0.08);
    --web3-shadow-neon-blue: 0 0 20px rgba(0, 212, 255, 0.3);
    --web3-shadow-neon-purple: 0 0 20px rgba(123, 47, 247, 0.3);
    --web3-shadow-neon-green: 0 0 20px rgba(0, 255, 136, 0.3);
    
    /* Web3 狀態顏色 */
    --web3-success: #00ff88;
    --web3-warning: #ffaa00;
    --web3-error: #ff4444;
    --web3-info: #00d4ff;
    
    /* Web3 圓角 */
    --web3-radius-sm: 8px;
    --web3-radius-md: 12px;
    --web3-radius-lg: 16px;
    --web3-radius-xl: 24px;
    
    /* Web3 間距 */
    --web3-spacing-xs: 4px;
    --web3-spacing-sm: 8px;
    --web3-spacing-md: 16px;
    --web3-spacing-lg: 24px;
    --web3-spacing-xl: 32px;
    
    /* Web3 過渡動畫 */
    --web3-transition-fast: 0.15s ease;
    --web3-transition-normal: 0.3s ease;
    --web3-transition-slow: 0.5s ease;
}

/* Web3 主題應用類別 */
.web3-theme {
    background: radial-gradient(circle at top, #0b1220, #020617);
    color: var(--web3-text-primary, #ffffff);
    min-height: 100vh;
}

/* 確保深色背景上的文字對比度 */
.web3-dark {
    background: radial-gradient(circle at top, #0b1220, #020617);
    color: var(--web3-text-primary, #ffffff);
}

/* Web3 玻璃態卡片 */
.web3-card {
    background: var(--web3-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--web3-glass-border);
    border-radius: var(--web3-radius-lg);
    box-shadow: var(--web3-shadow-md), var(--web3-shadow-neon);
    padding: var(--web3-spacing-lg);
    transition: all var(--web3-transition-normal);
    /* 明確指定文字顏色 */
    color: var(--web3-text-on-surface);
}

.web3-card:hover {
    border-color: var(--web3-neon-blue);
    box-shadow: var(--web3-shadow-lg), var(--web3-shadow-neon-blue);
    transform: translateY(-2px);
}

/* Web3 按鈕 */
.web3-btn {
    background: var(--web3-gradient-primary);
    color: var(--web3-text-primary);
    border: 1px solid var(--web3-neon-blue);
    border-radius: var(--web3-radius-md);
    padding: var(--web3-spacing-sm) var(--web3-spacing-lg);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--web3-transition-normal);
    box-shadow: var(--web3-shadow-sm), var(--web3-shadow-neon-blue);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.web3-btn:hover {
    background: var(--web3-gradient-secondary);
    border-color: var(--web3-neon-green);
    box-shadow: var(--web3-shadow-md), var(--web3-shadow-neon-green);
    transform: translateY(-2px);
}

.web3-btn:active {
    transform: translateY(0);
    box-shadow: var(--web3-shadow-sm), var(--web3-shadow-neon-blue);
}

.web3-btn-secondary {
    background: transparent;
    border: 1px solid var(--web3-glass-border);
    color: var(--web3-text-secondary);
}

.web3-btn-secondary:hover {
    background: var(--web3-glass-bg);
    border-color: var(--web3-neon-blue);
    color: var(--web3-text-primary);
}

/* Web3 輸入框 */
.web3-input {
    background: var(--web3-glass-bg);
    border: 1px solid var(--web3-glass-border);
    border-radius: var(--web3-radius-md);
    padding: var(--web3-spacing-sm) var(--web3-spacing-md);
    color: var(--web3-text-primary);
    font-size: 14px;
    transition: all var(--web3-transition-normal);
}

.web3-input:focus {
    outline: none;
    border-color: var(--web3-neon-blue);
    box-shadow: var(--web3-shadow-neon-blue);
}

.web3-input::placeholder {
    color: var(--web3-text-on-surface-muted);  /* 使用針對卡片/區塊的 muted 顏色 */
}

/* Web3 表格 */
.web3-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--web3-glass-bg);
    border-radius: var(--web3-radius-md);
    overflow: hidden;
}

.web3-table thead {
    background: var(--web3-bg-tertiary);
    border-bottom: 2px solid var(--web3-glass-border);
}

.web3-table th {
    padding: var(--web3-spacing-md);
    text-align: left;
    font-weight: 600;
    color: var(--web3-text-primary);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.web3-table td {
    padding: var(--web3-spacing-md);
    border-bottom: 1px solid var(--web3-glass-border-light);
    color: var(--web3-text-secondary);
}

.web3-table tbody tr {
    transition: all var(--web3-transition-fast);
}

.web3-table tbody tr:hover {
    background: var(--web3-glass-bg);
    box-shadow: inset 0 0 20px rgba(0, 212, 255, 0.1);
}

/* Web3 標籤/徽章 */
.web3-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: var(--web3-radius-sm);
    font-size: 12px;
    font-weight: 500;
    background: var(--web3-glass-bg);
    border: 1px solid var(--web3-glass-border);
    color: var(--web3-text-on-surface);  /* 使用針對卡片/區塊的文字顏色 */
}

.web3-badge-success {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--web3-neon-green);
    color: var(--web3-neon-green);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
}

.web3-badge-warning {
    background: rgba(255, 170, 0, 0.1);
    border-color: var(--web3-warning);
    color: var(--web3-warning);
    box-shadow: 0 0 10px rgba(255, 170, 0, 0.2);
}

.web3-badge-error {
    background: rgba(255, 68, 68, 0.1);
    border-color: var(--web3-error);
    color: var(--web3-error);
    box-shadow: 0 0 10px rgba(255, 68, 68, 0.2);
}

.web3-badge-info {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--web3-neon-blue);
    color: var(--web3-neon-blue);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
}

/* Web3 網格背景 */
.web3-grid-bg {
    position: relative;
}

.web3-grid-bg::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(closest-side at 50% 0%, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
    z-index: 0;
}

/* Web3 分隔線 */
.web3-divider {
    height: 1px;
    background: var(--web3-gradient-primary);
    border: none;
    margin: var(--web3-spacing-lg) 0;
    opacity: 0.3;
}

/* Web3 標題 */
.web3-title {
    font-size: 28px;
    font-weight: 700;
    background: var(--web3-gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--web3-spacing-md);
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.3);
}

.web3-subtitle {
    font-size: 16px;
    color: var(--web3-text-secondary);
    margin-bottom: var(--web3-spacing-lg);
}

/* Web3 連結 */
.web3-link {
    color: var(--web3-neon-blue);
    text-decoration: none;
    transition: all var(--web3-transition-fast);
    border-bottom: 1px solid transparent;
}

.web3-link:hover {
    color: var(--web3-neon-green);
    border-bottom-color: var(--web3-neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

/* Web3 模態框 */
.web3-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 14, 39, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--web3-spacing-lg);
}

.web3-modal-content {
    background: var(--web3-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--web3-glass-border);
    border-radius: var(--web3-radius-xl);
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--web3-shadow-xl), var(--web3-shadow-neon);
}

/* Web3 載入動畫 */
.web3-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--web3-glass-border);
    border-top-color: var(--web3-neon-blue);
    border-radius: 50%;
    animation: web3-spin 1s linear infinite;
}

@keyframes web3-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Web3 響應式設計 */
@media (max-width: 768px) {
    .web3-card {
        padding: var(--web3-spacing-md);
    }
    
    .web3-title {
        font-size: 24px;
    }
    
    .web3-table {
        font-size: 12px;
    }
    
    .web3-table th,
    .web3-table td {
        padding: var(--web3-spacing-sm);
    }
}

/* Web3 工具類別 */
.web3-text-neon-blue {
    color: var(--web3-neon-blue);
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.web3-text-neon-purple {
    color: var(--web3-neon-purple);
    text-shadow: 0 0 10px rgba(123, 47, 247, 0.5);
}

.web3-text-neon-green {
    color: var(--web3-neon-green);
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.web3-border-neon {
    border: 1px solid var(--web3-neon-blue);
    box-shadow: var(--web3-shadow-neon-blue);
}

.web3-glow-blue {
    box-shadow: var(--web3-shadow-neon-blue);
}

.web3-glow-purple {
    box-shadow: var(--web3-shadow-neon-purple);
}

.web3-glow-green {
    box-shadow: var(--web3-shadow-neon-green);
}
