package com.example.godeye.ui.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color

/**
 * Цветовая палитра GodEye согласно ТЗ
 */
object GodEyeColors {
    // Основные цвета приложения
    val BlackPure = Color(0xFF000000)
    val BlackSoft = Color(0xFF1A1A1A)
    val BlackMedium = Color(0xFF2D2D2D)

    val IvoryPure = Color(0xFFFFFFF0)
    val IvorySoft = Color(0xFFF5F5DC)
    val IvoryMedium = Color(0xFFE6E6D4)

    val NavyDark = Color(0xFF0F1419)
    val NavyMedium = Color(0xFF1E2328)
    val NavyLight = Color(0xFF2D3748)

    // Функциональные цвета
    val RecordRed = Color(0xFFFF3B30)
    val WarningAmber = Color(0xFFFF9500)
    val SuccessGreen = Color(0xFF30D158)
    val InfoBlue = Color(0xFF007AFF)

    // Градиенты
    val PrimaryGradientStart = NavyDark
    val PrimaryGradientEnd = BlackSoft

    val AccentGradientStart = NavyLight
    val AccentGradientEnd = NavyMedium
}

private val DarkColorScheme = darkColorScheme(
    primary = GodEyeColors.NavyLight,
    onPrimary = GodEyeColors.IvoryPure,
    primaryContainer = GodEyeColors.NavyMedium,
    onPrimaryContainer = GodEyeColors.IvorySoft,

    secondary = GodEyeColors.IvoryMedium,
    onSecondary = GodEyeColors.BlackPure,
    secondaryContainer = GodEyeColors.BlackMedium,
    onSecondaryContainer = GodEyeColors.IvoryPure,

    tertiary = GodEyeColors.WarningAmber,
    onTertiary = GodEyeColors.BlackPure,

    error = GodEyeColors.RecordRed,
    onError = GodEyeColors.IvoryPure,

    background = GodEyeColors.BlackPure,
    onBackground = GodEyeColors.IvoryPure,

    surface = GodEyeColors.BlackSoft,
    onSurface = GodEyeColors.IvoryPure,
    surfaceVariant = GodEyeColors.BlackMedium,
    onSurfaceVariant = GodEyeColors.IvorySoft,

    outline = GodEyeColors.NavyMedium,
    outlineVariant = GodEyeColors.NavyLight
)

private val LightColorScheme = lightColorScheme(
    primary = GodEyeColors.NavyMedium,
    onPrimary = GodEyeColors.IvoryPure,
    primaryContainer = GodEyeColors.NavyLight,
    onPrimaryContainer = GodEyeColors.BlackPure,

    secondary = GodEyeColors.BlackMedium,
    onSecondary = GodEyeColors.IvoryPure,
    secondaryContainer = GodEyeColors.IvoryMedium,
    onSecondaryContainer = GodEyeColors.BlackPure,

    tertiary = GodEyeColors.WarningAmber,
    onTertiary = GodEyeColors.IvoryPure,

    error = GodEyeColors.RecordRed,
    onError = GodEyeColors.IvoryPure,

    background = GodEyeColors.IvoryPure,
    onBackground = GodEyeColors.BlackPure,

    surface = GodEyeColors.IvorySoft,
    onSurface = GodEyeColors.BlackPure,
    surfaceVariant = GodEyeColors.IvoryMedium,
    onSurfaceVariant = GodEyeColors.BlackMedium,

    outline = GodEyeColors.NavyLight,
    outlineVariant = GodEyeColors.NavyMedium
)

@Composable
fun GodEyeTheme(
    darkTheme: Boolean = isSystemInDarkTheme(),
    content: @Composable () -> Unit
) {
    val colorScheme = when {
        darkTheme -> DarkColorScheme
        else -> LightColorScheme
    }

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