doctype html
html(lang="it")
  head
    meta(charset="UTF-8")
    meta(name="viewport" content="width=device-width, initial-scale=1.0")
    style(type="text/css").
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      
      body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        background-color: #f5f5f5;
        padding: 20px;
        line-height: 1.6;
      }
      
      .header-logo {
        width: 120px;
        height: auto;
        margin-bottom: 16px;
        display: block;
        margin-left: auto;
        margin-right: auto;
      }
      
      .email-container {
        max-width: 600px;
        margin: 0 auto;
        background: white;
        border-radius: 12px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
        overflow: hidden;
      }
      
      .email-header {
        background: linear-gradient(135deg, #7cb342 0%, #558b2f 100%);
        color: white;
        padding: 40px 24px;
        text-align: center;
      }
      
      .email-header h1 {
        margin: 0 0 8px 0;
        font-size: 26px;
        font-weight: 600;
        line-height: 1.3;
      }
      
      .email-header .subtitle {
        margin: 8px 0 0 0;
        font-size: 17px;
        opacity: 0.95;
        font-style: italic;
      }
      
      .money-icon {
        font-size: 56px;
        margin-bottom: 12px;
      }
      
      .email-body {
        padding: 32px 24px;
      }
      
      .intro-text {
        font-size: 16px;
        color: #333;
        margin-bottom: 20px;
        text-align: center;
        line-height: 1.7;
      }
      
      .transaction-card {
        background: linear-gradient(135deg, #f8fdf8 0%, #e8f5e9 100%);
        border: 2px solid #7cb342;
        border-radius: 8px;
        padding: 24px;
        margin: 20px 0;
        text-align: center;
      }
      
      .transaction-amount {
        font-size: 42px;
        color: #558b2f;
        font-weight: 700;
        margin-bottom: 12px;
        line-height: 1.2;
      }
      
      .transaction-label {
        font-size: 14px;
        text-transform: uppercase;
        color: #558b2f;
        font-weight: 600;
        letter-spacing: 0.5px;
        margin-bottom: 16px;
      }
      
      .transaction-detail {
        font-size: 15px;
        color: #555;
        margin: 8px 0;
        line-height: 1.5;
      }
      
      .transaction-detail strong {
        color: #558b2f;
      }
      
      .divider-line {
        height: 1px;
        background: #c8e6c9;
        margin: 16px 0;
      }
      
      .highlight-box {
        background: #fff8dc;
        border-left: 4px solid #7cb342;
        border-radius: 8px;
        padding: 16px;
        margin: 20px 0;
      }
      
      .highlight-box p {
        margin: 0;
        font-size: 16px;
        color: #1a1a1a;
        line-height: 1.6;
      }
      
      .highlight-box .label {
        font-size: 13px;
        text-transform: uppercase;
        color: #558b2f;
        font-weight: 600;
        letter-spacing: 0.5px;
        margin-bottom: 6px;
      }
      
      .cta-section {
        text-align: center;
        margin: 24px 0;
        padding: 20px 0;
        border-top: 1px solid #e0e0e0;
        border-bottom: 1px solid #e0e0e0;
      }
      
      .cta-title {
        font-size: 18px;
        font-weight: 600;
        color: #1a1a1a;
        margin-bottom: 16px;
      }
      
      .cta-button {
        display: inline-block;
        padding: 16px 48px;
        font-size: 18px;
        font-weight: 600;
        color: white;
        background: linear-gradient(135deg, #7cb342 0%, #558b2f 100%);
        border-radius: 50px;
        text-decoration: none;
        box-shadow: 0 4px 12px rgba(124, 179, 66, 0.3);
        transition: all 0.3s ease;
      }
      
      .info-box {
        background: #e8f5e9;
        border-radius: 8px;
        padding: 16px;
        margin: 20px 0;
        text-align: center;
      }
      
      .info-box p {
        margin: 0;
        color: #2e7d32;
        font-size: 16px;
        line-height: 1.6;
      }
      
      .email-footer {
        padding: 20px;
        text-align: center;
        background: #f8f9fa;
        color: #777;
        font-size: 13px;
      }
      
      .email-footer p {
        margin: 4px 0;
      }
      
      .divider {
        height: 1px;
        background: linear-gradient(to right, transparent, #e0e0e0, transparent);
        margin: 20px 0;
      }
      
      @media only screen and (max-width: 600px) {
        body {
          padding: 10px;
        }
        
        .email-header {
          padding: 24px 16px;
        }
        
        .email-header h1 {
          font-size: 22px;
        }
        
        .money-icon {
          font-size: 48px;
        }
        
        .email-body {
          padding: 20px 16px;
        }
        
        .transaction-amount {
          font-size: 36px;
        }
        
        .cta-button {
          padding: 14px 32px;
          font-size: 16px;
          width: 100%;
          max-width: 300px;
        }
      }

  body
    .email-container
      //- Header
      .email-header
        img.header-logo(src=baseurl+'/images/logo.png' alt='RISO - Rete Italiana Scambio Orizzontale')
        h1 Ciao <strong>#{username}</strong>, Hai ricevuto dei #{symbol}!
        p.subtitle Nuova transazione sul #{nomecircuito}

      //- Body
      .email-body
        //- Intro

        //- Transaction card
        .transaction-card
          .transaction-label Importo Ricevuto
          .transaction-amount +#{qty} #{symbol}
          
          .divider-line
          
          .transaction-detail(style="font-size: 18px; margin-top: 12px;")
            strong Nuovo Saldo: 
            span(style="color: #558b2f; font-weight: 700; font-size: 20px;") #{saldoAttuale} #{symbol}

          .transaction-detail
            strong Da: 
            | #{mittente}
          
          .transaction-detail
            strong Data: 
            | #{transactionDate}
          
          if groupDestoContoCom
            .transaction-detail
              strong Conto: 
              | #{groupDestoContoCom}
          
          .transaction-detail
            strong Circuito: 
            | #{nomecircuito}

        //- Descrizione
        if causalDest
          .highlight-box
            .label 📝 Descrizione
            p #{causalDest}

        //- Commento mittente
        if causale
          .highlight-box
            .label 💬 Commento di #{mittente}
            p "#{causale}"

        //- Info box
        .info-box
          p
            | ✓ La transazione è stata registrata con successo<br>
            | ✓ Il tuo saldo è stato aggiornato

        //- CTA
        .cta-section
          .cta-title Accedi alla App
          a.cta-button(href=strlinksito target="_blank") Apri #{nomeapp}

      //- Footer
      .email-footer
        .divider
        p Hai ricevuto questa email perché hai ricevuto una transazione su #{nomeapp}
        p(style="margin-top: 12px; font-size: 12px;")
          | #{new Date().getFullYear()} #{nomeapp} - Rete Italiana Scambi Orizzontali
        p(style="margin-top: 12px; font-size: 12px;")
          | 🍚 Comunità · Fiducia · Scambi Solidali · Sostenibilità