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

/**
 * CompactCard - Smaller card with reduced padding
 *
 * Features:
 * - Standard 12dp corner radius
 * - Compact padding (12dp default)
 * - Subtle shadow
 * - Uses theme background secondary color
 *
 * Usage:
 * ```
 * CompactCard {
 *     Text("Compact content")
 * }
 * ```
 */
@Composable
fun CompactCard(
    modifier: Modifier = Modifier,
    contentPadding: Dp = AppSpacing.md,
    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 = 1.dp,
                pressedElevation = 2.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 = 1.dp
            )
        ) {
            Column(
                modifier = Modifier.padding(contentPadding),
                content = content
            )
        }
    }
}
