package app.closer.ui.theme

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

@Composable
fun CloserTheme(
    darkTheme: Boolean = isSystemInDarkTheme(),
    content: @Composable () -> Unit
) {
    val colors = if (darkTheme) darkColors else lightColors

    MaterialTheme(
        colorScheme = colors,
        typography = Typography,
        content = content
    )
}

// Purple-pink color palette (Light theme)
val PrimaryColor = Color(0xFFB98AF4)
val PrimaryContainerColor = Color(0xFFF3E8FF)
val SecondaryColor = Color(0xFFE7A2D1)
val TertiaryColor = Color(0xFFB98AF4)
val BackgroundColor = Color(0xFFFFFBFE)
val SurfaceColor = Color(0xFFFFFBFE)
val ErrorColor = Color(0xFF8D2D35)
val SurfaceVariantColor = Color(0xFFF4E8FF)
val OutlineColor = Color(0xFF9B8AA6)
val OutlineVariantColor = Color(0xFFE3D4EB)

val OnPrimaryColor = Color(0xFF24122F)
val OnPrimaryContainerColor = Color(0xFF321545)
val OnSecondaryColor = Color(0xFF2E1731)
val OnTertiaryColor = Color(0xFF24122F)
val OnBackgroundColor = Color(0xFF261D2E)
val OnSurfaceColor = Color(0xFF261D2E)
val OnSurfaceVariantColor = Color(0xFF5A5060)
val OnErrorColor = Color(0xFFFFFFFF)

val lightColors = lightColorScheme(
    primary = PrimaryColor,
    onPrimary = OnPrimaryColor,
    primaryContainer = PrimaryContainerColor,
    onPrimaryContainer = OnPrimaryContainerColor,
    secondary = SecondaryColor,
    onSecondary = OnSecondaryColor,
    secondaryContainer = Color(0xFFFFE8F4),
    onSecondaryContainer = Color(0xFF3B1730),
    tertiary = TertiaryColor,
    onTertiary = OnTertiaryColor,
    tertiaryContainer = Color(0xFFF4E8FF),
    onTertiaryContainer = Color(0xFF321545),
    background = BackgroundColor,
    surface = SurfaceColor,
    onBackground = OnBackgroundColor,
    onSurface = OnSurfaceColor,
    surfaceVariant = SurfaceVariantColor,
    onSurfaceVariant = OnSurfaceVariantColor,
    outline = OutlineColor,
    outlineVariant = OutlineVariantColor,
    error = ErrorColor,
    onError = OnErrorColor
)

val darkColors = darkColorScheme(
    primary = Color(0xFFCFA7FF),
    onPrimary = Color(0xFF2A1238),
    primaryContainer = Color(0xFF43255F),
    onPrimaryContainer = Color(0xFFF3E8FF),
    secondary = Color(0xFFFFAFD9),
    onSecondary = Color(0xFF3B1730),
    secondaryContainer = Color(0xFF5B2847),
    onSecondaryContainer = Color(0xFFFFD8EB),
    tertiary = Color(0xFFB98AF4),
    onTertiary = Color(0xFF24122F),
    tertiaryContainer = Color(0xFF43255F),
    onTertiaryContainer = Color(0xFFF3E8FF),
    background = Color(0xFF18111E),
    surface = Color(0xFF211729),
    onBackground = Color(0xFFF2E8F6),
    onSurface = Color(0xFFF2E8F6),
    surfaceVariant = Color(0xFF372641),
    onSurfaceVariant = Color(0xFFD9C8E2),
    outline = Color(0xFFA996B4),
    outlineVariant = Color(0xFF5A4666),
    error = Color(0xFFFFB3BA),
    onError = OnErrorColor
)
