package com.mhss.app.mybrain.presentation.plans import androidx.compose.foundation.background import androidx.compose.foundation.border import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.Card import androidx.compose.material3.CardDefaults import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment 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.unit.dp import androidx.compose.ui.unit.sp import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.DialogProperties import com.mhss.app.ui.Res import com.mhss.app.ui.ic_bolt import com.mhss.app.ui.ic_check import com.mhss.app.ui.theme.PrimaryColor import com.mhss.app.ui.theme.SecondaryColor import org.jetbrains.compose.resources.painterResource @Composable fun UpgradePlanModal( featureTitle: String = "Pro Feature", featureDescription: String = "Upgrade your plan to unlock commercial bot capabilities and remove limits.", onDismiss: () -> Unit, onUpgradeClick: (planId: String) -> Unit = {} ) { Dialog( onDismissRequest = onDismiss, properties = DialogProperties(usePlatformDefaultWidth = false) ) { Surface( modifier = Modifier .fillMaxWidth(0.92f) .padding(vertical = 16.dp), shape = RoundedCornerShape(24.dp), color = MaterialTheme.colorScheme.surface, tonalElevation = 6.dp ) { Column( modifier = Modifier .fillMaxWidth() .padding(22.dp), horizontalAlignment = Alignment.CenterHorizontally ) { // Header Pill Surface( shape = RoundedCornerShape(8.dp), color = PrimaryColor.copy(alpha = 0.15f) ) { Text( text = "PREMIUM FEATURE", modifier = Modifier.padding(horizontal = 10.dp, vertical = 4.dp), style = MaterialTheme.typography.labelSmall.copy(fontWeight = FontWeight.Bold), color = PrimaryColor ) } Spacer(Modifier.height(14.dp)) Text( text = featureTitle, style = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Bold), color = MaterialTheme.colorScheme.onSurface, textAlign = TextAlign.Center ) Spacer(Modifier.height(6.dp)) Text( text = featureDescription, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant, textAlign = TextAlign.Center ) Spacer(Modifier.height(18.dp)) // Recommended Plan Card (Pro Plan) Card( modifier = Modifier .fillMaxWidth() .border( width = 1.5.dp, brush = Brush.linearGradient(listOf(PrimaryColor, SecondaryColor)), shape = RoundedCornerShape(18.dp) ), shape = RoundedCornerShape(18.dp), colors = CardDefaults.cardColors( containerColor = MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.4f) ) ) { Column(modifier = Modifier.padding(16.dp)) { Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically ) { Column { Text( text = "Pro Creator Plan", style = MaterialTheme.typography.titleMedium.copy(fontWeight = FontWeight.Bold) ) Text( text = "Most Popular for Telegram Admins", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant ) } Column(horizontalAlignment = Alignment.End) { Text( text = "INR 499", style = MaterialTheme.typography.titleLarge.copy( fontWeight = FontWeight.Bold, color = PrimaryColor ) ) Text( text = "per month", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant ) } } Spacer(Modifier.height(12.dp)) // Features list listOf( "Connect up to 5 Telegram Bots", "Up to 10,000 bot subscribers", "AI Smart Auto-Responder (Gemini / OpenAI)", "Multi-channel force join (Up to 5 channels)", "UPI and payment gateway integration", "Vouchers and promo redeem codes" ).forEach { feat -> Row( modifier = Modifier.padding(vertical = 3.dp), verticalAlignment = Alignment.CenterVertically ) { Icon( painter = painterResource(Res.drawable.ic_check), contentDescription = null, tint = PrimaryColor, modifier = Modifier.size(16.dp) ) Spacer(Modifier.width(8.dp)) Text( text = feat, style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurface ) } } } } Spacer(Modifier.height(20.dp)) Button( onClick = { onUpgradeClick("pro") onDismiss() }, modifier = Modifier .fillMaxWidth() .height(50.dp), shape = RoundedCornerShape(14.dp), colors = ButtonDefaults.buttonColors(containerColor = PrimaryColor) ) { Row(verticalAlignment = Alignment.CenterVertically) { Icon( painter = painterResource(Res.drawable.ic_bolt), contentDescription = null, tint = Color.White, modifier = Modifier.size(18.dp) ) Spacer(Modifier.width(8.dp)) Text( text = "Upgrade to Pro - INR 499/mo", fontWeight = FontWeight.Bold, color = Color.White ) } } Spacer(Modifier.height(8.dp)) TextButton( onClick = onDismiss, modifier = Modifier.fillMaxWidth() ) { Text( text = "Continue with Free Plan (1 Bot, 500 Users)", style = MaterialTheme.typography.bodySmall, color = MaterialTheme.colorScheme.onSurfaceVariant ) } } } } }