<!DOCTYPE html>
<html lang="it">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Prima Nota - Export</title>
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            color: #333;
            background-color: #f8f9fa;
            margin: 0;
            padding: 0;
        }
        .container {
            max-width: 600px;
            margin: 0 auto;
            background-color: #ffffff;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }
        .header {
            background: linear-gradient(135deg, #0C6197 0%, #084c6b 100%);
            color: white;
            padding: 30px 20px;
            text-align: center;
        }
        .header h1 {
            margin: 0;
            font-size: 24px;
            font-weight: 600;
        }
        .header .subtitle {
            margin: 10px 0 0 0;
            font-size: 14px;
            opacity: 0.9;
        }
        .content {
            padding: 30px 20px;
        }
        .greeting {
            font-size: 16px;
            margin-bottom: 20px;
        }
        .export-details {
            background-color: #f8f9fa;
            border-left: 4px solid #0C6197;
            padding: 20px;
            margin: 20px 0;
            border-radius: 0 6px 6px 0;
        }
        .export-details h3 {
            margin: 0 0 15px 0;
            color: #0C6197;
            font-size: 18px;
        }
        .detail-item {
            display: flex;
            justify-content: space-between;
            margin-bottom: 10px;
            padding: 8px 0;
            border-bottom: 1px solid #e9ecef;
        }
        .detail-item:last-child {
            border-bottom: none;
            margin-bottom: 0;
        }
        .detail-label {
            font-weight: 600;
            color: #495057;
        }
        .detail-value {
            color: #0C6197;
            font-weight: 500;
        }
        .attachment-info {
            background-color: #e8f4f8;
            border: 1px solid #b8daff;
            border-radius: 6px;
            padding: 15px;
            margin: 20px 0;
            text-align: center;
        }
        .attachment-icon {
            font-size: 24px;
            color: #0C6197;
            margin-bottom: 10px;
        }
        .footer {
            background-color: #f8f9fa;
            padding: 20px;
            text-align: center;
            border-top: 1px solid #dee2e6;
        }
        .footer p {
            margin: 5px 0;
            font-size: 12px;
            color: #6c757d;
        }
        .btn {
            display: inline-block;
            padding: 12px 24px;
            background-color: #0C6197;
            color: white;
            text-decoration: none;
            border-radius: 6px;
            font-weight: 500;
            margin: 10px 0;
        }
        .btn:hover {
            background-color: #084c6b;
        }
        @media (max-width: 600px) {
            .container {
                margin: 0;
                border-radius: 0;
            }
            .content {
                padding: 20px 15px;
            }
            .detail-item {
                flex-direction: column;
                gap: 5px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>📊Export Prima Nota</h1>
            <p class="subtitle">I tuoi dati sono pronti per il download</p>
        </div>

        <div class="content">
            <div class="greeting">
                Ciao {{ $data['user_name'] ?? 'Utente' }},
            </div>

            <p>
                Il tuo export della Prima Nota è stato generato con successo. Troverai il file Excel allegato a questa email con tutti i dati richiesti.
            </p>

            <div class="export-details">
                <h3>📋 Dettagli Export</h3>

                <div class="detail-item">
                    <span class="detail-label">📅 Periodo:</span>
                    <span class="detail-value">{{ $data['from_date'] ?? 'N/A' }} - {{ $data['to_date'] ?? 'N/A' }}</span>
                </div>

                <div class="detail-item">
                    <span class="detail-label">📊 Record totali:</span>
                    <span class="detail-value">{{ $data['total_records'] ?? 0 }}</span>
                </div>

                <div class="detail-item">
                    <span class="detail-label">🕒 Generato il:</span>
                    <span class="detail-value">{{ $data['generated_at'] ?? now()->format('d/m/Y H:i:s') }}</span>
                </div>

                @if(isset($data['filters_applied']))
                <div class="detail-item">
                    <span class="detail-label">🔍 Filtri applicati:</span>
                    <span class="detail-value">{{ $data['filters_applied'] }}</span>
                </div>
                @endif

                @if(isset($data['file_size']))
                <div class="detail-item">
                    <span class="detail-label">📁 Dimensione file:</span>
                    <span class="detail-value">{{ $data['file_size'] }}</span>
                </div>
                @endif
            </div>

            <div class="attachment-info">
                <div class="attachment-icon">📎</div>
                <strong>File allegato:</strong> Prima Nota Export<br>
                <small>Il file Excel contiene tutti i dati del periodo selezionato con i filtri applicati.</small>
            </div>

            <p>
                <strong>Cosa include questo export:</strong>
            </p>
            <ul>
                <li>📋 Tutte le transazioni del periodo specificato</li>
                <li>💰 Dettaglio entrate e uscite per metodo di pagamento</li>
                <li>📊 Totali riassuntivi</li>
                <li>🏷️ Causali e dettagli delle operazioni</li>
                <li>👥 Nominativi associati alle transazioni</li>
            </ul>

            <p>
                Se hai bisogno di assistenza o hai domande sui dati esportati, non esitare a contattare il supporto.
            </p>
        </div>

        <div class="footer">
            <p>Questa email è stata generata automaticamente dal sistema.</p>
            <p>Per qualsiasi problema tecnico, contatta il supporto.</p>
            <p><small>Generato: {{ now()->format('d/m/Y H:i:s') }}</small></p>
        </div>
    </div>
</body>
</html>
