package com.example.oscellamobile.screens

import android.icu.text.ListFormatter.Width
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import org.w3c.dom.Text

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun AuthWithEmail(navController: NavHostController) {
   // val kdamFontFamily = FontFamily(Font(R.font.kdam))
    var text = ""

    val gradientButton = Brush.linearGradient(
        colors = listOf(
            Color(0xFF2EC4B6),
            Color(0xFFFF9F1C)
        ),
        start = Offset(30f, 30f),
        end = Offset(200f, 200f)
    )

    val gradientButton1 = Brush.linearGradient(
        colors = listOf(
            Color(0xFF2EC4B6),
            Color(0xFFFF9F1C)
        ),
        start = Offset(0f, 0f),
        end = Offset(150f, 150f)
    )

    Canvas(
        modifier = Modifier
            .fillMaxWidth()
            .fillMaxHeight()
    ) {
        val gradient = Brush.linearGradient(
            colors = listOf(
                Color(0xFF2EC4B6),
                Color(0xFFFF9F1C),
                Color(0xFFE71D36)
            ),
            start = Offset(size.width, 1200f),
            end = Offset(150f, size.height)
        )

        drawRect(brush = gradient)
    }

    Column(
        modifier = Modifier
            .fillMaxWidth()
            .fillMaxHeight(),
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        Spacer(modifier = Modifier.height(180.dp))
        Text(
            text = "Oscella", fontSize = 40.sp,
           // fontFamily = kdamFontFamily
        )
        Spacer(modifier = Modifier.height(60.dp))
        TextField(
            value = text,
            onValueChange = { text = it },
          //  placeholder = { Text("Enter Code", fontSize = 24.sp, fontFamily = kdamFontFamily) },
            shape = RoundedCornerShape(20.dp),
            colors = TextFieldDefaults.textFieldColors(
                focusedIndicatorColor = Color.Transparent,
                unfocusedIndicatorColor = Color.Transparent
            ),
            modifier = Modifier
                .width(330.dp)
                .height(66.dp)
        )
        Spacer(modifier = Modifier.height(20.dp))
        Button(
            onClick = { },
            modifier = Modifier
                .shadow(100.dp)
                .width(180.dp)
                .height(50.dp)
                .background(brush = gradientButton, shape = RoundedCornerShape(20.dp)),
            colors = ButtonDefaults.buttonColors(
                containerColor = Color.Transparent
            )

        ) {
       //     Text("Login", color = Color.White, fontFamily = kdamFontFamily, fontSize = 24.sp)
        }
    }
}
