/*!*
 * @package   ats
 * @copyright Copyright (c)2011-2026 Nicholas K. Dionysopoulos / Akeeba Ltd
 * @license   GNU General Public License version 3, or later
 */

@use '../variables' as *;
@use '../common/include-media' as *;
@use 'sass:color';

@mixin ats_tickets_posts
{

  .ats-post-header {
    font-size: 105%;
    padding: .5em .25em !important;
    display: flex;
    gap: .25em;

    .ats-post-origin {
      margin: 0 .25em;
    }

    .ats-post-date {
      flex-grow: 1;
    }

    .ats-post-timespent {
      background-color: $grey;
      color: $white;
      padding: .25em .5em;
      border-radius: .25em;
      margin: 0 .25em;
    }
  }

  div.ats-threaded-item {
    div.ats-threaded-item-container {
      margin: 0;
      display: flex;
      flex-direction: column;

      @include media(">=tablet") {
        flex-direction: row-reverse;
      }

      .ats-threaded-item-userinfo {
        display: flex;
        flex-direction: column;
        justify-content: start;
        margin: -0.5em -0.5em -0.5em 0;
        padding: .5em;
        background-color: color.adjust($light-grey, $lightness: 7%);
        width: 100%;

        @include media(">=tablet") {
          width: 33%;
        }

        @include media(">=desktop") {
          width: 25%;
        }

        .ats-threaded-item-userinfo-avatar {
          text-align: center;
          margin: .25em;

          &>img {
            margin: 0 auto;
            height: auto;
            border-radius: 1em;
          }
        }

        .ats-threaded-item-header-fullname {
          margin-bottom: .5em;
          text-align: center;
          font-weight: bold;
        }

        .ats-threaded-item-userinfo-username {
          margin-bottom: .5em;
          display: flex;
          justify-content: center;
          gap: .5em;

          .ats-threaded-item-username-label {
            flex-shrink: 1;
            font-family: monospace;
          }

          .ats-threaded-item-username-flag {
            flex-shrink: 1;
          }
        }

        .ats-post-header-email {
          margin-bottom: 1em;
          text-align: center;
          color: color.adjust($grey, $lightness: 20%);
          word-break: break-all;
          user-select: all;
          -moz-user-select: all;
          -webkit-user-select: all;
          -ms-user-select: all;
        }

        .ats-post-userinfo-stats {
          display: flex;
          justify-content: center;
          gap: .5em;
        }

        .ats-user-groups {
          margin: 1em 0;
          padding: 0 1em;

          &>div {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 1em;
          }
        }
      }

      .ats-threaded-item-body-container {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        width: 100%;

        @include media(">=tablet") {
          width: 67%;
        }

        @include media(">=desktop") {
          width: 75%;
        }

        .ats-threaded-item-content-html {
          margin-bottom: 1em;
        }

        .ats-post-attachments {
          border-top: 2px solid $light-grey;
          padding-top: 1em;
          margin-bottom: 1.25em;
          display: flex;
          flex-direction: column;
          gap: 1em;

          h4 {
            font-size: 105%;
          }

          .ats-post-attachment {
            display: flex;
            gap: 1.25em;

            .ats-post-attachments-filename {
              flex-grow: 1;
            }
          }
        }

        .ats-post-content-signature {
          border-top: 2px solid $light-grey;
        }

        .ats-threaded-item-footer {
          .ats-threaded-item-edits {
            color: color.adjust($grey, $lightness: 20%);
            margin: .5em 0;
          }

          .ats-threaded-item-buttons {
            display: flex;
            gap: 1.25em;
          }
        }
      }

    }
  }
}
