package com.example.uitugasakhir

import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import com.example.app.ui.theme.Inter
import androidx.compose.foundation.layout.fillMaxHeight
import com.example.app.ui.theme.Inria_Regular


@Composable
fun PanduanScreen(navController: NavController) {

    Box(modifier = Modifier.fillMaxSize()) {

        Card(
            modifier = Modifier
                .fillMaxWidth()
                .height(160.dp),
            shape = RoundedCornerShape(0.dp),
            colors = CardDefaults.cardColors(Color(0xFF2F6F4E))
        ) {
            Box(
                modifier = Modifier
                    .fillMaxSize()
                    .padding(top = 22.dp),
                contentAlignment = Alignment.TopCenter
            ) {
                Image(
                    painter = painterResource(id = R.drawable.back),
                    contentDescription = "kembali",
                    modifier = Modifier
                        .size(15.dp)
                        .offset(x = -160.dp, y = 1.dp)
                        .clickable { navController.popBackStack() }
                )

                Text(
                    text = stringResource(R.string.guide),
                    fontSize = 16.sp,
                    fontFamily = Inter,
                    fontWeight = FontWeight.Bold,
                    color = Color.White
                )
            }
        }

        // CONTENT
        Card(
            modifier = Modifier
                .padding(top = 58.dp)
                .fillMaxSize(),
            shape = RoundedCornerShape(topStart = 24.dp),
            colors = CardDefaults.cardColors(Color.White)
        ) {
            Column(
                modifier = Modifier
                    .fillMaxSize()
                    .padding(16.dp)
                    .verticalScroll(rememberScrollState())
                    .animateContentSize()
            ) {
                Text(
                    text = stringResource(R.string.first_step),
                    fontSize = 15.sp,
                    fontFamily = Inria_Regular,
                    fontWeight = FontWeight.Medium,
                    color = Color.Gray,
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(horizontal = 28.dp)
                )

                Spacer(modifier = Modifier.height(15.dp))

                Card(
                    modifier = Modifier
                        .padding(horizontal = 25.dp)
                        .size(width = 333.dp, height = 100.dp),
                    shape = RoundedCornerShape(24.dp),
                    colors = CardDefaults.cardColors(
                        containerColor = Color(0xFFA7C7E7)
                    ),
                    elevation = CardDefaults.cardElevation(4.dp)
                ){

                }

                Spacer(modifier = Modifier.height(15.dp))

                Text(
                    text = stringResource(R.string.main_features),
                    fontSize = 15.sp,
                    fontFamily = Inria_Regular,
                    fontWeight = FontWeight.Medium,
                    color = Color.Gray,
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(horizontal = 28.dp)
                )

                Spacer(modifier = Modifier.height(15.dp))

                Card(
                    modifier = Modifier
                        .padding(horizontal = 25.dp)
                        .size(width = 333.dp, height = 100.dp),
                    shape = RoundedCornerShape(24.dp),
                    colors = CardDefaults.cardColors(
                        containerColor = Color(0xFFB7E4C7)
                    ),
                    elevation = CardDefaults.cardElevation(4.dp)
                ){

                }

                Spacer(modifier = Modifier.height(15.dp))

                Text(
                    text = stringResource(R.string.automatic_watering),
                    fontSize = 15.sp,
                    fontFamily = Inria_Regular,
                    fontWeight = FontWeight.Medium,
                    color = Color.Gray,
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(horizontal = 28.dp)
                )

                Spacer(modifier = Modifier.height(15.dp))

                Card(
                    modifier = Modifier
                        .padding(horizontal = 25.dp)
                        .size(width = 333.dp, height = 100.dp),
                    shape = RoundedCornerShape(24.dp),
                    colors = CardDefaults.cardColors(
                        containerColor = Color(0xFFBDE0FE)
                    ),
                    elevation = CardDefaults.cardElevation(4.dp)
                ){

                }

                Spacer(modifier = Modifier.height(15.dp))

                Text(
                    text = stringResource(R.string.manual_control),
                    fontSize = 15.sp,
                    fontFamily = Inria_Regular,
                    fontWeight = FontWeight.Medium,
                    color = Color.Gray,
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(horizontal = 28.dp)
                )

                Spacer(modifier = Modifier.height(15.dp))

                Card(
                    modifier = Modifier
                        .padding(horizontal = 25.dp)
                        .size(width = 333.dp, height = 100.dp),
                    shape = RoundedCornerShape(24.dp),
                    colors = CardDefaults.cardColors(
                        containerColor = Color(0xFFA3B18A)
                    ),
                    elevation = CardDefaults.cardElevation(4.dp)
                ){

                }

                Spacer(modifier = Modifier.height(15.dp))

                Text(
                    text = stringResource(R.string.notifications),
                    fontSize = 15.sp,
                    fontFamily = Inria_Regular,
                    fontWeight = FontWeight.Medium,
                    color = Color.Gray,
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(horizontal = 28.dp)
                )

                Spacer(modifier = Modifier.height(15.dp))

                Card(
                    modifier = Modifier
                        .padding(horizontal = 25.dp)
                        .size(width = 333.dp, height = 100.dp),
                    shape = RoundedCornerShape(24.dp),
                    colors = CardDefaults.cardColors(
                        containerColor = Color(0xFFFFD6A5)
                    ),
                    elevation = CardDefaults.cardElevation(4.dp)
                ){

                }

                Spacer(modifier = Modifier.height(15.dp))

                Text(
                    text = stringResource(R.string.history_analytics),
                    fontSize = 15.sp,
                    fontFamily = Inria_Regular,
                    fontWeight = FontWeight.Medium,
                    color = Color.Gray,
                    modifier = Modifier
                        .fillMaxWidth()
                        .padding(horizontal = 28.dp)
                )

                Spacer(modifier = Modifier.height(15.dp))

                Card(
                    modifier = Modifier
                        .padding(horizontal = 25.dp)
                        .size(width = 333.dp, height = 100.dp),
                    shape = RoundedCornerShape(24.dp),
                    colors = CardDefaults.cardColors(
                        containerColor = Color(0xFFFFC8DD)
                    ),
                    elevation = CardDefaults.cardElevation(4.dp)
                ){

                }

            }
        }
    }
}