/* ==========================================================================
   Asgaros Forum Styles
   ========================================================================== */

.cc-generic-content #af-wrapper {

   /* set source sans as the default font for entire forum */
   font-family: var(--font-secondary) !important;

   /* Ensure form inputs, buttons, and textareas also inherit it */
   & button,
   & input,
   & textarea,
   & select {
      font-family: var(--font-secondary) !important;
   }

   /* forum-header section that includes the navigation buttons and searchbar */
   #forum-header {
      position: relative; /* fallback for non-anchor support browsers */
      margin-block: 4rem 1.2rem;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-between;
      background-color: #D6D8DB !important;
      border-color: #D6D8DB !important;
      border-radius: var(--border-radius-xs);
      padding: 1px;
      height: 49px;
      gap: 2px;

      & #forum-navigation-mobile {
         anchor-name: --forum-navigation-mobile;
      }

      & #forum-navigation {
         display: inline-flex;
         flex-direction: row;
         border-radius: var(--border-radius-xs);

         &>a {
            position: relative;
            border: none !important;
            padding: 1.4rem 2.4rem;
            color: var(--text-color-black-80) !important;
            /* font-family: var(--font-secondary); */
            font-size: 1.4rem;
            font-style: normal;
            font-weight: 600;
            line-height: 150%;

            &:first-of-type {
               border-radius: var(--border-radius-xs) 0px 0px var(--border-radius-xs);
            }

            &:last-of-type {
               border-radius: 0px var(--border-radius-xs) var(--border-radius-xs) 0px;
            }

            &:not(:last-child)::after {
               content: '';
               position: absolute;
               right: 0;
               top: 50%;
               transform: translateY(-50%);
               height: 90%;
               width: 1px;
               background-color: #AEAEAE;
            }

            &.active,
            &:hover {
               background-color: var(--color-primary) !important;
               color: var(--text-color-white) !important;
               text-decoration: none !important;
               opacity: 1;
            }
         }

         @media screen and (max-width: 782px) {
            & {
               display: none;

               &.show-navigation {
                  display: flex;
                  flex-direction: column;
                  position: absolute;
                  z-index: 100;
                  overflow: hidden;
                  min-width: 180px;
                  width: max-content;
                  max-width: calc(100vw - 2rem);
                  background-color: white;
                  border-radius: var(--border-radius-xs);
                  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);

                  /* Fallback positioning for browsers without Anchor Positioning (e.g. iOS Safari) */
                  top: 100%;
                  left: 0;

                  /* Modern CSS Anchor Positioning */
                  position-anchor: --forum-navigation-mobile;
                  top: anchor(bottom);
                  left: anchor(left);
                  margin-top: 0.8rem;

                  & a {
                     border-radius: 0;
                     width: 100%;

                     /* Remove desktop vertical lini in dropdown */
                     &::after {
                        display: none;
                     }
                  }
               }
            }
         }



      }

   }

   /* Main title container flex layout with subscription next to h1 */
   & .main-title-container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 1.6rem;
      margin-block: 2rem;

      & .main-title {
         padding: 0;
         margin: 0;
         font-size: 2.2rem;
         font-weight: 400;
         line-height: normal;
         color: var(--text-color-dark-grey);
      }

      & .forum-subscription-header {
         display: inline-flex;
         align-items: center;
         gap: 0.8rem;
         margin-left: auto;

         & #topic-subscription,
         & #forum-subscription {
            font-size: 1.4rem;
            color: var(--color-accent);
            line-height: 1;
            transition: color 0.2s ease;
         }

         & a {
            display: inline-flex;
            align-items: center;
            gap: 0.7rem;
            color: var(--color-accent) !important;
            font-size: 1.4rem;
            font-style: italic;
            line-height: 140%;
            text-decoration: none !important;
            transition: color 0.2s ease;

            & b,
            & strong {
               font-style: normal;
               font-weight: 700;
            }

            &:hover {
               color: var(--color-primary) !important;
            }
         }

         &:hover {

            & #topic-subscription,
            & #forum-subscription {
               color: var(--color-primary);
            }
         }
      }
   }

   /* Hide bottom navigation if empty after unhooking subscription */
   & #bottom-navigation:empty {
      display: none;
   }

   & .forum {
      & .forum-name {
         & a:not(a.button):not(a.highlight-admin):not(a.highlight-moderator) {
            text-decoration: none;

            &.forum-title {
               color: var(--text-color-dark-grey) ! important;
               font-size: 1.4rem;
               font-weight: 600;
               line-height: 140%;
            }
         }

      }

      & .forum-poster .forum-poster-summary {
         &>a:not(a.button):not(a.highlight-admin):not(a.highlight-moderator) {
            text-decoration: none;
            color: var(--text-color-dark-grey) ! important;
            font-size: 1.3rem;
            font-weight: 400;
            line-height: 140%;
         }

         & small a {
            font-size: 1.1rem;
            font-style: normal;
            font-weight: 400;
            line-height: 140%;

            &:not(a.button):not(a.highlight-admin):not(a.highlight-moderator) {
               color: var(--color-primary-dark) ! important;
            }
         }

      }
   }


   & .topic {
      & .topic-name {
         &>a:not(a.button):not(a.highlight-admin):not(a.highlight-moderator) {
            text-decoration: none;
            color: var(--text-color-dark-grey) ! important;
            font-size: 1.4rem;
            font-weight: 600;
            line-height: 140%;
         }
      }

      & .topic-poster .forum-poster-summary {
         &>a:not(a.button):not(a.highlight-admin):not(a.highlight-moderator) {
            text-decoration: none;
            color: #555 ! important;
            font-size: 1.2rem;
            font-weight: 400;
         }
      }
   }

   /* post styling */
   & .post-element .post-wrapper .forum-post-header {
      & .forum-post-menu {
         & a:not(a.button):not(a.highlight-admin):not(a.highlight-moderator) {
            color: var(--color-primary-dark) !important;

            &.delete-forum-post {
               color: #C42615 !important;
            }
         }
      }
   }

   /*  Style Icons*/
   .fas.fa-check,
   .fas.fa-history {
      color: var(--color-accent) ! important;

   }


   & a {

      /* Highlight the admin link */
      &.highlight-admin {
         color: #9D16B8 !important;
      }

      &.highlight-moderator {
         color: var(--color-accent) !important;
      }
   }

   /* Toolbar layout with Back button on the left and action buttons on the right */
   & .pages-and-menu {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 1rem;
      margin-bottom: 1.6rem;
      height: 3.2rem;
      min-height: 3.2rem;

      & .forum-back-nav {
         order: 0;

         & a.forum-back-button {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding-inline: 0.7rem;
            height: 3.2rem;
            border: 1.5px solid var(--color-primary) !important;
            border-radius: var(--border-radius-xs);
            background-color: transparent !important;
            color: var(--color-primary) !important;
            font-size: 1.4rem;
            font-weight: 400;
            line-height: 2rem;
            text-decoration: none;
            transition: all 0.2s ease;

            & .menu-icon {
               padding-right: 0;
            }

            &:hover {
               background-color: #D0F7EB !important;
            }
         }
      }

      & .forum-menu {
         order: 2;
         margin-left: auto;
         float: none;
         margin-bottom: 0;
         height: 3.2rem;

         & a {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0 1rem;
            border-radius: var(--border-radius-xs);
            font-size: 1.4rem;
            line-height: 2rem;

            &.button.button-red {
               background-color: transparent;
               border: 1.5px solid #C42615;
               color: #C42615;

               &:hover {
                  background-color: #C42615 !important;
                  color: var(--text-color-white) !important;
                  opacity: 1;
               }
            }

            &.button.button-neutral,
            &.forum-editor-button {
               background-color: var(--color-accent) !important;
               border: 1.5px solid var(--color-accent) !important;
               color: var(--text-color-white);

               &:hover {
                  background-color: var(--color-primary) !important;
                  border: 1.5px solid var(--color-primary) !important;
                  opacity: 1;
               }
            }
         }

      }


      & .pages {
         order: 1;
         float: none;
      }

      & .clear {
         display: none;
      }
   }

   /* Hide only the bottom pages-and-menu container */
   & .content-container+.pages-and-menu,
   & .post-element~.pages-and-menu {
      display: none;
   }

}