//
//  ControlActionButtonView.swift
//  USB Meter
//
//  Created by Bogdan Timofte on 29/03/2026.
//  Co-authored-by: GPT-5.3-Codex.
//  Copyright © 2026 Bogdan Timofte. All rights reserved.
//

import SwiftUI

struct ControlActionButtonView: View {
    let title: String
    let symbol: String
    let tint: Color
    let compact: Bool
    let isExpandedCompactLayout: Bool
    let action: () -> Void

    var body: some View {
        Button(action: action) {
            VStack(spacing: 10) {
                Image(systemName: symbol)
                    .font(.system(size: compact ? 18 : 20, weight: .semibold))
                Text(title)
                    .font(.footnote.weight(.semibold))
                    .multilineTextAlignment(.center)
            }
            .foregroundColor(tint)
            .frame(maxWidth: .infinity, minHeight: compact ? (isExpandedCompactLayout ? 112 : 92) : 68)
            .padding(.horizontal, 8)
            .meterCard(tint: tint, fillOpacity: 0.10, strokeOpacity: 0.14)
        }
        .buttonStyle(.plain)
    }
}