package com.jishisongfu.duobibi.ui.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color

/**
 * 关闭 Material You 动态取色,手写蓝青配色,所有设备观感统一。
 */
private val LightColors = lightColorScheme(
    primary = DbbColors.Teal,
    onPrimary = Color.White,
    primaryContainer = DbbColors.TealBg,
    onPrimaryContainer = DbbColors.TealDark,

    secondary = DbbColors.Sky,
    onSecondary = Color.White,
    secondaryContainer = DbbColors.SkyBg,
    onSecondaryContainer = Color(0xFF075985),

    tertiary = DbbColors.Save,
    onTertiary = Color.White,
    tertiaryContainer = DbbColors.SaveBg,
    onTertiaryContainer = Color(0xFF065F46),

    error = DbbColors.Up,
    onError = Color.White,
    errorContainer = DbbColors.UpBg,
    onErrorContainer = Color(0xFF991B1B),

    background = DbbColors.Bg,
    onBackground = DbbColors.Ink,
    surface = DbbColors.Card,
    onSurface = DbbColors.Ink,
    surfaceVariant = DbbColors.Fill,
    onSurfaceVariant = DbbColors.InkSec,
    outline = DbbColors.Border,
    outlineVariant = Color(0xFFEEF2F6),
)

private val DarkColors = darkColorScheme(
    primary = Color(0xFF2DD4BF),
    onPrimary = Color(0xFF00332F),
    primaryContainer = Color(0xFF0F766E),
    onPrimaryContainer = Color(0xFFCCFBF1),

    secondary = Color(0xFF38BDF8),
    onSecondary = Color(0xFF002235),
    secondaryContainer = Color(0xFF075985),
    onSecondaryContainer = Color(0xFFE0F2FE),

    tertiary = Color(0xFF34D399),
    onTertiary = Color(0xFF064E3B),
    tertiaryContainer = Color(0xFF065F46),
    onTertiaryContainer = Color(0xFFD1FAE5),

    error = Color(0xFFF87171),
    onError = Color(0xFF7F1D1D),
    errorContainer = Color(0xFF991B1B),
    onErrorContainer = Color(0xFFFEE2E2),

    background = Color(0xFF0B1220),
    onBackground = Color(0xFFE2E8F0),
    surface = Color(0xFF111A2B),
    onSurface = Color(0xFFE2E8F0),
    surfaceVariant = Color(0xFF1E293B),
    onSurfaceVariant = Color(0xFF94A3B8),
    outline = Color(0xFF334155),
    outlineVariant = Color(0xFF1E293B),
)

@Composable
fun DuobibiTheme(
    darkTheme: Boolean = isSystemInDarkTheme(),
    content: @Composable () -> Unit,
) {
    MaterialTheme(colorScheme = if (darkTheme) DarkColors else LightColors, content = content)
}
