/* Pagina Referral */
.referral-area-page {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;

  .area-container {
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: start;
    width: 100%;
    gap: 0;

    > div {
      display: flex;
      flex-wrap: wrap;
      align-items: start;
      justify-content: start;
      width: 100%;

      &:not(:last-child) {
        padding-bottom: 3rem;
        border-bottom: 1px solid #ccc;
        margin-bottom: 3rem;
      }
    }

    h2 {
      width: 100%;
      margin-bottom: 1rem;
    }

    /* Codice QR */
    .qr-section {
      display: flex;
      align-items: start;
      justify-content: start;
      width: 100%;
      gap: 1rem;

      p.qr-instructions {
        width: 100%;
        font-size: 1.25rem;
        font-weight: bold;
      }

      canvas,
      img {
        display: block;
        max-width: 200px;
        height: auto;
      }
    }

    /* Il tuo Coupon */
    .coupon-section {
      gap: 0 1rem;

      /* Body Coupon */
      .coupon-body {
        display: flex;
        flex-direction: column;
        align-items: start;
        justify-content: start;
        flex: 1 1 auto;
        gap: 1rem;

        .coupon-benefits {
          width: 100%;
        }

        .coupon-display {
          display: flex;
          align-items: center;
          justify-content: center;
          gap: 2rem;
          width: 100%;

          img.coupon-icon {
            width: 32px;
          }

          .coupon-code-box {
            --color: #000;
            --background-color: #fff;

            width: 215px;
            padding: 0.5rem 1rem;
            padding-top: 0.7rem;
            text-align: center;
            font-weight: bold;
            color: var(--color);
            background-color: var(--background-color);
          }
        }
      }
    }

    /* Condividi il tuo Coupon */
    .share-section {
      gap: 0 1rem;

      .share-body {
        display: flex;
        flex-direction: column;
        align-items: start;
        justify-content: start;
        flex: 1 1 auto;
        gap: 1rem;

        .share-instructions {
          width: 100%;

          p {
            margin-bottom: 0.5rem;
          }
        }

        .whatsapp-messages {
          display: flex;
          flex-direction: column;
          gap: 2rem;
          width: 100%;

          .whatsapp-message-box {
            display: flex;
            flex-wrap: wrap;
            align-items: start;
            justify-content: start;
            gap: 0.5rem 1rem;
            width: 100%;

            h3 {
              width: 100%;
            }

            .message-content {
              width: 100%;
              max-width: 500px;
              padding: 1rem;
              line-height: 1.3;
              background-color: #d8fdd2;
            }
          }
        }
      }
    }

    /* Ordini effettuati con il tuo Coupon */
    .orders-section {
      .orders-table-wrapper {
        width: 700px;
        max-width: 100%;

        table {
          --amount-width: 100px;
          width: 100%;

          tr.row-voucher-request {
            background-color: #ffe5e6;
            --color: #922427;
            color: var(--color);
          }

          th,
          td {
            padding: 0.5rem 0.5rem;

            &.col-date {
              width: 100px;
            }

            &.col-order-number {
              width: 85px;
            }

            &.col-client {

            }

            &.col-amount {
              width: var(--amount-width);
              text-align: right;
            }

            &.col-description {

            }

            &.col-operator {
              width: 10px;
            }
          }

          th {
            font-weight: normal;
            border-bottom: 3px solid #ccc;
          }

          /* Body */
          tbody {
            tr:first-child td {
              padding-top: 0.75rem;
            }

            tr:last-child td {
              border-bottom: 3px solid #ccc;
            }
          }

          /* Footer */
          tfoot {
            tr {
              td.col-label {
                text-align: right;
              }

              td.col-value {
                width: var(--amount-width);
                text-align: right;
              }

              &:first-child {
                td {
                  padding-top: 0.75rem;
                }
              }

              &.row-btn-request-voucher {
                td {
                  padding-top: 1rem;
                }
              }
            }
          }
        }
      }
    }
  }
}

/* Solo Desktop */
body.is-desktop .referral-area-page {
  .area-container {
    /* Il tuo Coupon */
    .coupon-section {
      /* Immagine Coupon */
      .coupon-image {
        margin-top: -1.75rem;
        max-width: 200px;
      }
    }

    /* Condividi il tuo Coupon */
    .share-section {
      .share-body {
        max-width: calc(100% - 200px - 1rem);

        .whatsapp-messages {
          .whatsapp-message-box {
            align-items: end;

            .message-content {
              --color: #000;
              max-width: calc(100% - 180px - 1rem);
            }
          }
        }
      }

      /* Immagine */
      .share-image {
        max-width: 200px;
      }
    }
  }

  /* Ordini effettuati con il tuo Coupon */
  .orders-section {
    .orders-table-wrapper {
      max-width: calc(100% - 180px - 1rem);
    }
  }
}


/* Solo Mobile */
body.is-mobile .referral-area-page {
  .qr-section,
  .coupon-section,
  .share-section,
  .orders-section {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;

    /* per evitare che il testo venga troncato */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;

    h2,
    h3,
    .qr-instructions {
      text-align: center;
    }

    h2 {
      margin-bottom: 0rem;
    }

    .section-title {
      order: 1;
    }

    .section-image {
      order: 2;
    }

    .section-body {
      order: 3;
    }

    /* Il tuo Coupon */
    &.coupon-section {
      .coupon-body {
        .coupon-display {
          gap: 0.5rem;
        }

        .coupon-code-box {
          padding-left: 0.5rem;
          padding-right: 0.5rem;
        }
      }

      .coupon-image {
        img {
          max-width: 200px;
        }
      }
    }

    /* Condividi il tuo Coupon */
    &.share-section {
      .section-image {
        display: none !important;
      }

      .whatsapp-messages {
        gap: 4rem 0;

        .whatsapp-message-box {
          justify-content: center;

          .message-content {
            --color: #000;
            margin-bottom: 0.5rem;
          }
        }
      }
    }

    /* Ordini effettuati con il tuo Coupon */
    &.orders-section {
      .orders-table-wrapper {
        table {
          --amount-width: 60px;
          font-size: 0.8rem;

          th,
          td {
            padding: 0.2rem 0.1rem;
            padding-top: 0.3rem;
            border-width: 1px;

            &.col-date {
              width: 70px;
            }

            &.col-order-number {
              width: 60px;
            }

            &.col-amount {
              width: var(--amount-width);
              text-align: right;
            }

            &.col-operator {
              width: 5px;
            }
          }
        }
      }
    }
  }
}
