package com.laseroptek.raman.ui.common.button

// Removed: import android.graphics.drawable.shapes.Shape 
// import androidx.compose.foundation.layout.PaddingValues // Not used in this version
// import androidx.compose.material3.Button // Alternative with more customization - Not used in this version
// import androidx.compose.material3.ButtonDefaults // Not used in this version
// import androidx.compose.material3.MaterialTheme // Not used in this version
// import androidx.compose.ui.Alignment // Not used in this version
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.laseroptek.raman.ui.theme.RobotoTypography
import com.laseroptek.raman.utils.ext.dropShadow
import com.laseroptek.raman.utils.ext.innerShadow
import com.laseroptek.raman.utils.ext.px

@Composable
fun RoundTextButton(
    onClick: () -> Unit,
    //painter: Painter,
    text: String = "H/P",
    contentDescription: String?, // Important for accessibility
    modifier: Modifier = Modifier,
    buttonSize: Dp = 48.dp, // Overall size of the touch target
) {
    IconButton(
        onClick = onClick,
        modifier = modifier
            .size(buttonSize) // Set the touch target size for the button
            .clip(CircleShape) // This makes the button itself (and its ripple) round
            .background(
                brush = Brush.linearGradient(
                    colorStops = arrayOf(
                        0.0f to Color(255, 255, 255),
                        1.0f to Color(209, 209, 209),
                    )
                )
            )
            .border(1.6.px.dp, color = Color(208, 208, 208), shape = CircleShape)
            .dropShadow(
                shape = CircleShape,
                color = Color(0, 0, 0).copy(alpha = 0.12f),
                blur = 10.px.dp,
                offsetY = 2.px.dp,
                offsetX = 0.px.dp,
                spread = 0.px.dp
            )
            .innerShadow(
                shape = CircleShape,
                color = Color(240, 240, 240),
                blur = 1.6.px.dp,
                offsetY = 1.6.px.dp,
                offsetX = 0.px.dp,
                spread = 0.px.dp
            )
            .dropShadow(
                shape = CircleShape,
                color = Color(0, 0, 0).copy(alpha = 0.25f),
                blur = 3.2.px.dp,
                offsetY = 1.6.px.dp,
                offsetX = 0.px.dp,
                spread = 0.px.dp
            ),
    ) {
        Text(
            text = text,
            style = RobotoTypography.bodySmall.copy(
                textAlign = TextAlign.End,
                fontSize = 18.px.sp,
                fontWeight = FontWeight.Thin,
                letterSpacing = 0.2.px.sp,
            ),
            color = Color.Black
        )
    }
}

@Preview(showBackground = true)
@Composable
fun RoundTextButtonPreview() {
    RoundTextButton(
        onClick = { /* Handle click */ },
        text = "H/P",
        contentDescription = "",
        buttonSize = 50.dp,
    )
}