/* ==================== 全局輕樣式主題 - 白天色系 ==================== */

/* 根變數 - 淺色調 */
:root {
    --light-bg: #f8fafc;
    --light-bg-secondary: #eef4f9;
    --light-card: #ffffff;
    --light-text: #1e293b;
    --light-text-muted: #475569;
    --light-border: #e2e8f0;
    --light-blue: #3b82f6;
    --light-blue-light: #dbeafe;
    --light-orange: #f59e0b;
    --light-orange-light: #fed7aa;
    --light-green: #10b981;
    --light-green-light: #d1fae5;
    --light-purple: #a855f7;
    --light-purple-light: #f3e8ff;
}

/* 全站娛樂風背景光暈 (Light Mode) */
body[data-theme="light"]::before,
body[data-theme="light"]::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
}
body[data-theme="light"]::before {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(168,85,247,0.10) 0%, transparent 70%);
    top: -15%; left: -10%;
    animation: globalGlowA 15s ease-in-out infinite alternate;
}
body[data-theme="light"]::after {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
    bottom: -10%; right: -8%;
    animation: globalGlowB 18s ease-in-out infinite alternate;
}
body[data-theme="light"] .wrapper { position: relative; z-index: 1; }

/* ==================== 頁面容器樣式 ==================== */

/* 主容器 */
.light-section {
    background: linear-gradient(135deg, var(--light-bg) 0%, var(--light-bg-secondary) 100%);
    padding: 24px 0;
    border-radius: 12px;
    margin-bottom: 20px;
}

.light-container {
    padding: 0 16px;
}

/* ==================== 卡片樣式 ==================== */

.light-card {
    background: var(--light-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--light-border);
    transition: all 0.3s ease;
    margin-bottom: 16px;
}

.light-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.light-card-header {
    border-bottom: 2px solid var(--light-border);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.light-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--light-text);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================== 按鈕樣式 ==================== */

.light-btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.light-btn-primary {
    background: var(--light-blue);
    color: white;
}

.light-btn-primary:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.light-btn-success {
    background: var(--light-green);
    color: white;
}

.light-btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.light-btn-warning {
    background: var(--light-orange);
    color: white;
}

.light-btn-warning:hover {
    background: #d97706;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.light-btn-secondary {
    background: #e2e8f0;
    color: var(--light-text);
    border: 1px solid var(--light-border);
}

.light-btn-secondary:hover {
    background: #cbd5e1;
}

/* ==================== 表格樣式 ==================== */

.light-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.light-table thead {
    background: var(--light-bg);
    border-bottom: 2px solid var(--light-border);
}

.light-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--light-text);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.light-table tbody tr {
    border-bottom: 1px solid var(--light-border);
    transition: background 0.3s ease;
}

.light-table tbody tr:hover {
    background: var(--light-bg);
}

.light-table tbody td {
    padding: 12px 16px;
    color: var(--light-text-muted);
}

/* ==================== 表單樣式 ==================== */

.light-form-group {
    margin-bottom: 20px;
}

.light-form-label {
    display: block;
    font-weight: 600;
    color: var(--light-text);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.light-form-input,
.light-form-select,
.light-form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--light-border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
    color: var(--light-text);
    transition: all 0.3s ease;
}

.light-form-input:focus,
.light-form-select:focus,
.light-form-textarea:focus {
    outline: none;
    border-color: var(--light-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================== 警告/成功消息樣式 ==================== */

.light-alert {
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.light-alert-success {
    background: var(--light-green-light);
    border-left-color: var(--light-green);
    color: #065f46;
}

.light-alert-warning {
    background: var(--light-orange-light);
    border-left-color: var(--light-orange);
    color: #92400e;
}

.light-alert-error {
    background: #fee2e2;
    border-left-color: #ef4444;
    color: #7f1d1d;
}

.light-alert-info {
    background: var(--light-blue-light);
    border-left-color: var(--light-blue);
    color: #1e40af;
}

/* ==================== 標籤和徽章 ==================== */

.light-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.light-badge-primary {
    background: var(--light-blue-light);
    color: #1e40af;
}

.light-badge-success {
    background: var(--light-green-light);
    color: #065f46;
}

.light-badge-warning {
    background: var(--light-orange-light);
    color: #92400e;
}

.light-badge-error {
    background: #fee2e2;
    color: #7f1d1d;
}

/* ==================== 網格佈局 ==================== */

.light-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.light-grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.light-grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* ==================== 響應式設計 ==================== */

@media (max-width: 1024px) {
    .light-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .light-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .light-section {
        padding: 16px 0;
    }

    .light-container {
        padding: 0 12px;
    }

    .light-card {
        padding: 16px;
        border-radius: 8px;
    }

    .light-card-title {
        font-size: 1rem;
    }

    .light-table thead th,
    .light-table tbody td {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .light-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .light-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .light-form-input,
    .light-form-select,
    .light-form-textarea {
        font-size: 16px; /* 防止移動設備上的自動縮放 */
    }
}

@media (max-width: 480px) {
    .light-card {
        padding: 12px;
    }

    .light-card-title {
        font-size: 0.95rem;
    }

    .light-btn {
        width: 100%;
    }
}

/* ==================== 動畫和過渡 ==================== */

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

.light-animate {
    animation: slideInUp 0.3s ease-out;
}

/* ==================== 分隔線 ==================== */

.light-divider {
    height: 1px;
    background: var(--light-border);
    margin: 20px 0;
}

/* ==================== 淺色文字和背景組合 ==================== */

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

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

.bg-light-blue {
    background: var(--light-blue-light);
    color: #1e40af;
}

.bg-light-green {
    background: var(--light-green-light);
    color: #065f46;
}

.bg-light-orange {
    background: var(--light-orange-light);
    color: #92400e;
}

.bg-light-purple {
    background: var(--light-purple-light);
    color: #6b21a8;
}

/* ================================================================
   全新 Table 風格（Light Mode）— 卡片化、無邊框、漸層表頭
   ================================================================ */
body[data-theme="light"] table.dataTable,
body[data-theme="light"] .table,
body[data-theme="light"] .table-custom,
body[data-theme="light"] .light-table {
    border-collapse: separate !important;
    border-spacing: 0 6px !important;
    border: none !important;
    background: transparent !important;
}
body[data-theme="light"] table.dataTable thead th,
body[data-theme="light"] .table thead th,
body[data-theme="light"] .table-custom thead th,
body[data-theme="light"] .light-table thead th {
    background: linear-gradient(135deg, rgba(168,85,247,0.12), rgba(59,130,246,0.10)) !important;
    color: #6b21a8 !important;
    border: none !important;
    padding: 14px 16px !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    border-radius: 12px 12px 0 0 !important;
    white-space: nowrap !important;
}
body[data-theme="light"] table.dataTable tbody td,
body[data-theme="light"] .table tbody td,
body[data-theme="light"] .table-custom tbody td,
body[data-theme="light"] .light-table tbody td {
    background: rgba(255,255,255,0.85) !important;
    color: #1e293b !important;
    border: none !important;
    padding: 14px 16px !important;
    font-size: 0.9rem !important;
    vertical-align: middle !important;
    transition: all 0.3s ease !important;
}
body[data-theme="light"] table.dataTable tbody tr td:first-child { border-radius: 10px 0 0 10px !important; }
body[data-theme="light"] table.dataTable tbody tr td:last-child { border-radius: 0 10px 10px 0 !important; }
body[data-theme="light"] table.dataTable tbody tr:nth-child(even) td { background: rgba(248,250,252,0.9) !important; }
body[data-theme="light"] table.dataTable tbody tr:hover td,
body[data-theme="light"] .table-hover tbody tr:hover td {
    background: rgba(168,85,247,0.06) !important;
    box-shadow: inset 3px 0 0 #a855f7 !important;
}

/* DataTables 分頁 (Light) */
body[data-theme="light"] .dataTables_wrapper .dataTables_paginate { padding-top: 20px !important; text-align: center !important; }
body[data-theme="light"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    display: inline-flex !important; align-items: center; justify-content: center;
    min-width: 40px !important; height: 40px !important; padding: 0 14px !important; margin: 0 3px !important;
    border: 1px solid rgba(168,85,247,0.2) !important; border-radius: 20px !important;
    background: rgba(255,255,255,0.85) !important; color: #6b21a8 !important;
    font-weight: 600 !important; font-size: 0.85rem !important; transition: all 0.3s ease !important; text-decoration: none !important;
}
body[data-theme="light"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(168,85,247,0.08) !important; border-color: rgba(168,85,247,0.4) !important; color: #7c3aed !important;
    box-shadow: 0 4px 15px rgba(168,85,247,0.15) !important; transform: translateY(-2px) !important;
}
body[data-theme="light"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #a855f7, #3b82f6) !important; border-color: transparent !important;
    color: #fff !important; box-shadow: 0 4px 20px rgba(168,85,247,0.3) !important; font-weight: 800 !important;
}
body[data-theme="light"] .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.3 !important; cursor: not-allowed !important; border-color: transparent !important; background: transparent !important;
}
body[data-theme="light"] .dataTables_wrapper .dataTables_filter input {
    background: rgba(255,255,255,0.9) !important; border: 1px solid rgba(168,85,247,0.2) !important;
    border-radius: 12px !important; color: #1e293b !important; padding: 8px 16px !important;
}
body[data-theme="light"] .dataTables_wrapper .dataTables_filter input:focus {
    border-color: #a855f7 !important; box-shadow: 0 0 0 3px rgba(168,85,247,0.12) !important; outline: none !important;
}
body[data-theme="light"] .dataTables_wrapper .dataTables_filter label,
body[data-theme="light"] .dataTables_wrapper .dataTables_length label { color: #475569 !important; font-weight: 600 !important; }
body[data-theme="light"] .dataTables_wrapper .dataTables_length select {
    background: rgba(255,255,255,0.9) !important; border: 1px solid rgba(168,85,247,0.2) !important;
    border-radius: 10px !important; color: #1e293b !important; padding: 6px 12px !important;
}
body[data-theme="light"] .dataTables_wrapper .dataTables_info { color: #64748b !important; font-size: 0.85rem !important; padding-top: 16px !important; }
body[data-theme="light"] table.dataTable thead .sorting_asc:after,
body[data-theme="light"] table.dataTable thead .sorting_desc:after { opacity: 1 !important; color: #a855f7 !important; }
body[data-theme="light"] .badge { font-weight: 600 !important; letter-spacing: 0.3px !important; border-radius: 8px !important; padding: 5px 12px !important; }
body[data-theme="light"] table a { color: #7c3aed !important; text-decoration: none !important; }
body[data-theme="light"] table a:hover { color: #a855f7 !important; text-decoration: underline !important; }

/* ================================================================
   全站 — 淺色模式覆寫：修正各頁面 hardcoded dark style
   造成「字或背景顏色不對，肉眼看不見」的問題。
   ================================================================ */

/* ─── AccountBinding/Index.cshtml：hardcoded dark cards → 淺色 ─── */
body[data-theme="light"] [style*="background-color: #1a3c2a"] { background-color: #f0faf5 !important; }
body[data-theme="light"] [style*="background-color: #1a2a3c"] { background-color: #eef4f9 !important; }
body[data-theme="light"] [style*="border: 1px solid #2d6b4a"] { border-color: #c6e8d8 !important; }
body[data-theme="light"] [style*="border: 1px solid #2d4a6b"] { border-color: #c2ddf0 !important; }
body[data-theme="light"] [style*="color: #4dccbd"] { color: #0d9e7e !important; }
body[data-theme="light"] [style*="color: #42a5f5"] { color: #1976d2 !important; }
body[data-theme="light"] [style*="color: #999 !important"] { color: #6c757d !important; }
body[data-theme="light"] [style*="color: #e0e0e0"] { color: #1e293b !important; }
body[data-theme="light"] .table-dark { --bs-table-bg: #1e293b; --bs-table-striped-bg: #283548; }
body[data-theme="light"] .table-dark th { background-color: #1e293b !important; color: #e8f7ff !important; }
body[data-theme="light"] .table-dark td { color: #e8f7ff !important; }
body[data-theme="light"] [style*="background-color: rgba(255,255,255,0.05)"] { background-color: rgba(0,0,0,0.05) !important; }

/* ─── PreviewConsolidation.cshtml：#666 inactive text → 淺色可讀 ─── */
body[data-theme="light"] [style*="color: #666"] { color: #94a3b8 !important; }

/* ─── TranM13/StockPledge.cshtml：#1e1e1e wrapper → 淺色 ─── */
body[data-theme="light"] [style*="background-color: #1e1e1e"] { background-color: #ffffff !important; }
body[data-theme="light"] [style*="color: #e9ecef"] { color: #1e293b !important; }
body[data-theme="light"] [style*="background-color: #2d3748"] { background-color: #f1f5f9 !important; }
body[data-theme="light"] [style*="border-color: #4a5568"] { border-color: #cbd5e1 !important; }
body[data-theme="light"] [style*="color: #e2e8f0"] { color: #1e293b !important; }
body[data-theme="light"] [style*="color: #a0aec0"] { color: #64748b !important; }

/* ─── TranCoin/M11ToM13.cshtml：embedded dark CSS body bg → 淺色 ─── */
body[data-theme="light"] [style*="color: #212529"] { color: #1e293b !important; }
body[data-theme="light"] .bonus-table th { color: #1e293b !important; }
body[data-theme="light"] .bonus-table td { color: #334155 !important; }

/* ─── PlaceList/Tree.cshtml：warm palette already fine for light ─── */
