/* ================================== */
/* =     WhatsApp manual sending    = */
/* ================================== */

.whatsapp-link-menu .fa-whatsapp,
.whatsapp-page .fa-whatsapp {
  color: #25d366;
}

.whatsapp-page {
  margin-top: 20px;

  .whatsapp-panel {
    padding: 15px 20px 20px;
  }

  h2 {
    margin: 0 0 4px;
  }

  .whatsapp-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
  }

  .whatsapp-progress {
    font-size: 14px;
  }

  .whatsapp-progress-started {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;

    &[hidden] {
      display: none;
    }

    progress {
      appearance: none;
      width: 200px;
      height: 8px;
      border: 0;
      border-radius: 4px;
      overflow: hidden;
      background-color: #e5e5e5;

      &::-webkit-progress-bar {
        background-color: #e5e5e5;
      }

      &::-webkit-progress-value {
        background-color: #25d366;
      }

      &::-moz-progress-bar {
        background-color: #25d366;
      }
    }
  }

  .whatsapp-message-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    width: fit-content;
    max-width: 560px;
    margin: 15px 0 20px;
  }

  .whatsapp-message {
    color: #00451d;
    min-width: 400px;
    min-height: 60px;
    align-self: stretch;
    padding: 10px 14px;
    background-color: #dcf8c6;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;

    p {
      margin: 0 0 8px;

      &:last-child {
        margin-bottom: 0;
      }
    }
  }

  .whatsapp-edit-link {
    font-size: 13px;
  }

  .whatsapp-message-form {
    max-width: 560px;
    margin: 15px 0 20px;

    label {
      display: block;
      margin-bottom: 6px;
      font-weight: bold;
    }

    textarea {
      box-sizing: border-box;
      width: 100%;
      font-family: inherit;
      font-size: 14px;
      line-height: 1.4;
    }

    .hint {
      margin: 4px 0 12px;
    }
  }

  .whatsapp-message-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
  }

  .folder-tabs {
    border-bottom: 1px solid #e5e5e5;

    a[aria-current] {
      margin-bottom: -1px;
    }
  }

  .whatsapp-contacts {
    width: 100%;
    border-collapse: collapse;

    td {
      padding: 8px 10px;
      border-bottom: 1px solid #eee;
      vertical-align: middle;
    }

    tr.sent td {
      color: var(--color-grey-light);

      a {
        color: inherit;
      }
    }

    .whatsapp-contact-phone {
      width: 1%;
      color: var(--color-grey-medium);
    }

    .whatsapp-contact-action {
      width: 1%;
      text-align: right;
    }
  }

  .whatsapp-send-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: 1px solid #1ebe5d;
    border-radius: 4px;
    background-color: #25d366;
    color: #fff;
    font-weight: bold;
    white-space: nowrap;

    .fa-whatsapp {
      color: inherit;
    }

    &:hover {
      background-color: #1ebe5d;
    }

    &:focus-visible {
      outline: 3px solid #128c7e;
      outline-offset: 2px;
    }
  }

  .whatsapp-sent-label {
    display: none;
  }

  tr.sent .whatsapp-send-link {
    border-color: #ddd;
    background-color: #f5f5f5;
    color: #666;

    .whatsapp-send-label {
      display: none;
    }

    .whatsapp-sent-label {
      display: inline;
    }
  }

  .whatsapp-empty {
    margin: 30px 0;
    text-align: center;
  }
}

@media (max-width: 767px) {
  .whatsapp-page {
    margin-top: 10px;

    .whatsapp-panel {
      padding: 12px 16px 16px;
    }

    .whatsapp-progress-started {
      align-items: flex-start;
    }

    .whatsapp-contact-phone {
      display: none;
    }
  }
}
