/* HabitQuest - Global theme layer
 *
 * 为什么要单独一层
 * --------------
 * 各页面大量使用 Tailwind 硬编码的深色类（bg-dark / text-white / text-gray-400 …），
 * 只在两个页面定义 .light-mode 变量覆盖对其它页面完全无效。
 * 这里用全局选择器 + !important 覆盖这些常用类，
 * 使「任意页面切换主题即时生效」成为可能。
 *
 * 用法：body.light-mode
 */

body.light-mode {
    background-color: #F9FAFB !important;
    color: #111827 !important;
}

/* ── 背景 ── */
body.light-mode .bg-dark,
body.light-mode .bg-dark\/80,
body.light-mode .bg-dark\/90,
body.light-mode .bg-dark\/95 {
    background-color: #F9FAFB !important;
}

body.light-mode .bg-dark\/10,
body.light-mode .bg-dark\/20,
body.light-mode .bg-dark\/50 {
    background-color: rgba(17, 24, 39, 0.04) !important;
}

/* 深色遮罩层：浅色模式下改为浅灰，避免整块发黑 */
body.light-mode .bg-dark\/50 {
    background-color: rgba(17, 24, 39, 0.06) !important;
}

/* 卡片 / 面板 */
body.light-mode .bg-\[\#111\],
body.light-mode .bg-\[\#151721\],
body.light-mode .bg-\[\#1a1b23\],
body.light-mode .bg-gray-900,
body.light-mode .bg-gray-800 {
    background-color: #FFFFFF !important;
}

body.light-mode .bg-gray-900\/50,
body.light-mode .bg-gray-900\/30,
body.light-mode .bg-black\/20,
body.light-mode .bg-black\/30 {
    background-color: rgba(17, 24, 39, 0.03) !important;
}

/* 主色半透明底 */
body.light-mode .bg-primary\/10 {
    background-color: rgba(108, 93, 211, 0.10) !important;
}
body.light-mode .bg-accent\/10 {
    background-color: rgba(0, 212, 170, 0.12) !important;
}

/* ── 文字 ── */
body.light-mode .text-white {
    color: #111827 !important;
}
body.light-mode .text-gray-100,
body.light-mode .text-gray-200,
body.light-mode .text-gray-300 {
    color: #374151 !important;
}
body.light-mode .text-gray-400 {
    color: #4B5563 !important;
}
body.light-mode .text-gray-500,
body.light-mode .text-gray-600 {
    color: #6B7280 !important;
}
body.light-mode .text-gray-700,
body.light-mode .text-gray-800,
body.light-mode .text-gray-900 {
    color: #111827 !important;
}

/* ── 边框 ── */
body.light-mode .border-white\/5,
body.light-mode .border-white\/10,
body.light-mode .border-white\/20,
body.light-mode .border-gray-700,
body.light-mode .border-gray-800 {
    border-color: #E5E7EB !important;
}
body.light-mode .border-primary\/20,
body.light-mode .border-primary\/30 {
    border-color: rgba(108, 93, 211, 0.35) !important;
}
body.light-mode .border-accent\/20,
body.light-mode .border-accent\/30 {
    border-color: rgba(0, 212, 170, 0.40) !important;
}

/* ── 表单 ── */
body.light-mode input,
body.light-mode textarea,
body.light-mode select {
    background-color: #FFFFFF !important;
    color: #111827 !important;
    border-color: #D1D5DB !important;
}
body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
    color: #9CA3AF !important;
}

/* ── 悬浮态 ── */
body.light-mode .hover\:text-white:hover {
    color: #111827 !important;
}
body.light-mode .hover\:bg-gray-800:hover,
body.light-mode .hover\:bg-gray-700:hover {
    background-color: #E5E7EB !important;
}
body.light-mode .hover\:bg-white\/5:hover,
body.light-mode .hover\:bg-white\/10:hover {
    background-color: rgba(17, 24, 39, 0.04) !important;
}
body.light-mode .hover\:border-white\/20:hover {
    border-color: #D1D5DB !important;
}

/* ── 半透明遮罩上的文字保持可读 ── */
body.light-mode .text-gray-500,
body.light-mode .text-gray-600,
body.light-mode .text-gray-700 {
    color: #6B7280 !important;
}
body.light-mode ::-webkit-scrollbar-track {
    background: #F3F4F6;
}
body.light-mode ::-webkit-scrollbar-thumb {
    background: #D1D5DB;
}

/* 状态色在浅色背景下需要加深以保证对比度 */
body.light-mode .text-accent {
    color: #047857 !important;
}
body.light-mode .text-primary {
    color: #5B4BC4 !important;
}

/* 500 级色板在白底上对比度不足，统一加深 */
body.light-mode .text-green-400,
body.light-mode .text-green-300,
body.light-mode .text-green-500 {
    color: #047857 !important;
}
body.light-mode .text-red-400,
body.light-mode .text-red-300,
body.light-mode .text-red-500 {
    color: #B91C1C !important;
}
body.light-mode .text-yellow-400,
body.light-mode .text-yellow-300,
body.light-mode .text-yellow-500 {
    color: #A16207 !important;
}
body.light-mode .text-blue-400,
body.light-mode .text-blue-300,
body.light-mode .text-blue-500 {
    color: #1D4ED8 !important;
}
body.light-mode .text-orange-400,
body.light-mode .text-orange-500 {
    color: #C2410C !important;
}

/* 600/700/800 级本身已足够深，浅色背景下无需改动，
   这里只保证 border 类在浅色下仍然可见 */
body.light-mode .border-red-200,
body.light-mode .border-green-200,
body.light-mode .border-yellow-200 {
    border-color: #FCA5A5 !important;
}

/* 提示条 */
body.light-mode .bg-red-500\/10 {
    background-color: rgba(239, 68, 68, 0.10) !important;
}
body.light-mode .bg-green-500\/10 {
    background-color: rgba(16, 185, 129, 0.10) !important;
}
body.light-mode .bg-yellow-500\/10 {
    background-color: rgba(245, 158, 11, 0.12) !important;
}
body.light-mode .bg-blue-500\/10 {
    background-color: rgba(59, 130, 246, 0.10) !important;
}

/* 打印与强制深色时的回退 */
@media print {
    body.light-mode { background: #fff !important; color: #000 !important; }
}
