package com.tt.honeyDue.ui.components.common

import androidx.compose.foundation.layout.*
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.tt.honeyDue.ui.theme.AppRadius
import com.tt.honeyDue.ui.theme.AppSpacing
import com.tt.honeyDue.ui.theme.backgroundSecondary

/**
 * StandardCard - Consistent card component matching iOS design
 *
 * Features:
 * - Standard 12dp corner radius
 * - Consistent padding (16dp default)
 * - Subtle shadow for elevation
 * - Uses theme background secondary color
 *
 * Usage:
 * ```
 * StandardCard {
 *     Text("Card content")
 * }
 * ```
 */
@Composable
fun StandardCard(
    modifier: Modifier = Modifier,
    contentPadding: Dp = AppSpacing.lg,
    backgroundColor: Color? = null,
    onClick: (() -> Unit)? = null,
    content: @Composable ColumnScope.() -> Unit
) {
    val colors = if (backgroundColor != null) {
        CardDefaults.cardColors(containerColor = backgroundColor)
    } else {
        CardDefaults.cardColors(
            containerColor = MaterialTheme.colorScheme.backgroundSecondary
        )
    }

    if (onClick != null) {
        Card(
            onClick = onClick,
            modifier = modifier,
            shape = androidx.compose.foundation.shape.RoundedCornerShape(AppRadius.md),
            colors = colors,
            elevation = CardDefaults.cardElevation(
                defaultElevation = 2.dp,
                pressedElevation = 4.dp
            )
        ) {
            Column(
                modifier = Modifier.padding(contentPadding),
                content = content
            )
        }
    } else {
        Card(
            modifier = modifier,
            shape = androidx.compose.foundation.shape.RoundedCornerShape(AppRadius.md),
            colors = colors,
            elevation = CardDefaults.cardElevation(
                defaultElevation = 2.dp
            )
        ) {
            Column(
                modifier = Modifier.padding(contentPadding),
                content = content
            )
        }
    }
}
