/**
 * This file is part of the Meeds project (https://meeds.io/).
 *
 * Copyright (C) 2020 - 2024 Meeds Association contact@meeds.io
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
@import "uiSimpleContainers/responsiveColumnGroupContainer.less";
@import "uiSimpleContainers/simpleColumnContainer.less";
@import "uiSimpleContainers/simpleRowContainer.less";
@import "uiSimpleContainers/simpleTableContainer.less";

/* ============= Shared Layout - Main Page Structure  ============= */
#ParentSiteContainer {
  height: 100%;
  min-height: ~"var(--100vh, 100vh)";
  max-height: ~"var(--100vh, 100vh)";
  display: flex;
  flex-direction: row;

  #ParentSiteLeftContainer {
    position: relative;
    flex-shrink: 0;
    flex-grow: 0;

    #ParentSiteStickyMenu {
      min-height: ~"var(--100vh, 100vh)";
      max-width: 311px;
    }
  }

  #ParentSiteRightContainer {
    position: relative;
    flex-shrink: 1;
    flex-grow: 1;

    #ParentSiteContainerChildren {
      overflow: hidden;
      position: absolute;
      top: 0;
      bottom: 0;
      display: flex;
      flex-direction: column;
      min-height: 100%;
      height: 100%;
      max-height: 100%;
      min-width: 100%;
      width: 100%;
      max-width: 100%;
      flex: 1 1 auto;
    }
  }
}

.UIPage {
  .PORTLET-FRAGMENT {
    margin-bottom: @applicationSpaceBottom;
  }

  .no-applications-spacing .PORTLET-FRAGMENT {
    margin-bottom: 0px;
  }
  .no-applications-spacing .layout-application {
    padding-bottom: 0px !important;
  }
}

/* ============= Shared Layout - TopBar Display  ============= */
#UITopBarContainerParent, #UITopBarContainer {
  min-height: @topbarHeight;
  height: calc(@topbarHeight - 1);
  box-sizing: border-box;
  z-index: 3;
}

#UITopBarContainer {
  box-shadow: none;
  border-bottom: 1px solid transparent;
  position: absolute;
  top: 0;
  width: 100%;
  max-width: 100%;
  z-index: @zindexFixedNavbar;

  .UITopBarContainerItemsParent {
    display: flex;
    padding-right: 8px ~'; /** orientation=lt */ ';
    padding-left: 8px ~'; /** orientation=rt */ ';

    .UITopBarContainerItem {
      height: @topbarHeight;
      min-height: @topbarHeight;
      max-height: @topbarHeight;
      display: flex;
      flex-grow: 0;
      flex-shrink: 0;

      > * {
        margin: auto;
        max-width: 100%;
      }

      #top-bar-logo-containerChildren {
        display: flex;
      }

      #middle-topNavigation-container {
        .UIIntermediateContainer {
          > .UIRowContainer {
            display: flex !important;
          }
        }
      }

      &.menu-topNavigation-container {
        max-width: 70%;
        margin: 0 auto;
        padding: 0 25px;
        flex-grow: 1;
        flex-shrink: 1;
        overflow: hidden;
        justify-content: center;
        > * {
          max-width: ~"calc(100% - 40px)";
        }
      }
    }
  }
}

.logoTitle {
  max-width: 200px;
}

.layout-top-bar {
  --allPagesBaseTextColor: var(--allPagesTopBarTextColor);
  --allPagesMenuTextColor: var(--allPagesTopBarTextColor);
  --allPagesBaseTextFontSize: var(--allPagesTopBarTextFontSize);
  --allPagesBaseTextFontWeight: var(--allPagesTopBarTextFontWeight);
  --allPagesBaseTextFontStyle: var(--allPagesTopBarTextFontStyle);

  background-color: @topBarBackgroundColor !important;
  background-image: @topBarBackgroundImage !important;
  background-repeat: @topBarBackgroundRepeat !important;
  background-position: @topBarBackgroundPosition !important;
  background-size: @topBarBackgroundSize !important;
}

.layout-side-bar {
  --allPagesBaseTextColor: var(--allPagesSideBarTextColor);
  --allPagesMenuTextColor: var(--allPagesSideBarTextColor);
  --allPagesBaseTextFontSize: var(--allPagesSideBarTextFontSize);
  --allPagesBaseTextFontWeight: var(--allPagesSideBarTextFontWeight);
  --allPagesBaseTextFontStyle: var(--allPagesSideBarTextTitleFontWeight);

  --allPagesBaseTextSubtitleColor: var(--allPagesSideBarTextSubtitleColor);
  --allPagesBaseTextSubtitleFontSize: var(--allPagesSideBarTextSubtitleFontSize);
  --allPagesBaseTextSubtitleFontWeight: var(--allPagesSideBarTextSubtitleFontWeight);
  --allPagesBaseTextSubtitleFontStyle: var(--allPagesSideBarTextSubtitleFontStyle);

  background-color: @sideBarBackgroundColor !important;
  background-image: @sideBarBackgroundImage !important;
  background-repeat: @sideBarBackgroundRepeat !important;
  background-position: @sideBarBackgroundPosition !important;
  background-size: @sideBarBackgroundSize !important;
}
.layout-drawer {
  .layout-drawer();
}

/* Make TopBar under drawers and other modals when opened */
.decrease-z-index #UITopBarContainer {
  z-index: @zindexFixedNavbarUnder;
}
.decrease-z-index-more #UITopBarContainer {
  z-index: @zindexFixedNavbarUnderMore;
}
.mobile-visible {
  display: none;
}

#vuetify-apps {
  .v-overlay--active {
    z-index: @zindexModalBackdrop !important;
  }
  .v-dialog__content--active {
    z-index: @zindexModal !important;
  }
}

@media (max-width: @maxMobileWidth) {
  .mobile-visible {
    display: block;
  }

  #ParentSiteContainer {
    #ParentSiteRightContainer {
      #ParentSiteContainerChildren {
        position: fixed;
      }
    }
  }

  #brandingTopBar {
    .logoContainer {
      &:after {
        display: none;
      }
    }
    .brandingContainer.company {
      display: none;
    }
    .brandingContainer.space {
      display: none;
    }
  }
}
/* ============= End - Shared Layout  ============= */

/* ============= Site Layout - Display  ============= */
.site-scroll-parent {
  position: relative;
  max-width: 100%;
  overflow: auto;
  flex: 1 1 auto;
}

@media (min-width: @minTabletWidth) {
  .site-scroll-parent {
    .specific-scrollbar()
  }
}
/* ============= End - Site Layout  ============= */

/* ============= Page Layout - Social Pages  ============= */
#parentSocialPage {
  .UIMobileSwipeParentContainer {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    width:100%;

    > div {
      width:100%;
    }

    > #leftSocialPage, > .leftSocialPage {
      flex: 0 1 70%;
      max-width: 70%;
      box-sizing: border-box;
      padding-right: 10px ~'; /** orientation=lt */ ';
      padding-left: 10px ~'; /** orientation=rt */ ';
    }

    > #rightSocialPage, > .rightSocialPage {
      flex: 0 1 30%;
      max-width: 30%;
      box-sizing: border-box;
      padding-left: 10px ~'; /** orientation=lt */ ';
      padding-right: 10px ~'; /** orientation=rt */ ';

      /* Added for sticky container */
      .UIContainer, .NormalContainerBlock, .VIEW-CONTAINER, .UIIntermediateContainer, .UIRowContainer {
        display: inline;
      }
    }
  }
}

.page-content, #singlePageApplicationContainer, .singlePageApplication, #SpacePage, #StreamPage, .SpaceActivityStreamPortletPage, #parentSocialPage {
  width: @pageWidth !important;
  max-width: 100% !important;
  padding-top: var(--allPagesMarginTop, 20px);
  padding-right: var(--allPagesMarginRight, 20px);
  padding-bottom: var(--allPagesMarginBottom, 20px);
  padding-left: var(--allPagesMarginLeft, 20px);
  margin: 0 auto;

  /* Start: box-sizing inheritence fix: Important to not influence original box-sizing inherited in child contents */
  box-sizing: border-box !important;
  > * {
    /* Set back to default CSS value: content-box */
    box-sizing: content-box !important;
  }
  /* End: box-sizing inheritence fix */

  .singlePageApplication {
    padding: 0 !important;
    margin: 0 !important;
  }

}

.singlePageApplication.no-applications-spacing {
  min-height: ~"calc(100vh - @{topbarHeight} - @{applicationSpaceBottom})";
}

.layout-page-body {
  min-height: ~"calc(100vh - @{topbarHeight})";
}

.SpaceActivityStreamPortletPage {
  #SpacePage, #StreamPage {
    padding: 0 !important;
  }
}

.TDContainer {
  vertical-align: top;
}

@media (min-width: @minTabletWidth) {

  #parentSocialPage {
    .UIRowContainer:first-of-type {
      > #rightSocialPage, > .rightSocialPage {
        #stickyBlockDesktop, .stickyBlockDesktop, &.stickyBlockDesktop {
          position: sticky;
          top: 13px;
          height: auto;
          display: block;
          padding-bottom: @applicationSpaceBottom !important;
          z-index: @zindexStickyContainer;
        }
      }
    }
  }
  .decrease-z-index #parentSocialPage .UIRowContainer:first-of-type {
    > #rightSocialPage, > .rightSocialPage {
      #stickyBlockDesktop, .stickyBlockDesktop, &.stickyBlockDesktop {
        z-index: 1;
      }
    }
  }
}

@media (max-width: 767px) {
  .UIMobileSwipeContainer {
    margin: 0 !important;
    padding: 0 !important;

    .UIMobileSwipeParentContainer {
      transition: ~"width 0.6s";

      .UIMobileSwipeChildContainer {
        position: absolute;
        width: ~"calc(100% - 40px)" !important;
        max-width: ~"calc(100% - 40px)" !important;
        margin: 0 !important;
        padding: 0 !important;

        &:not(.active) {
          right: 100vw;
        }
      }
    }

    .UIMobileSwipe {
      position: fixed !important;
      top: 60vh !important;
      height: 60px !important;
      width: 60px !important;
      background-color: #fff !important;
      z-index: 1010;
      display: flex !important;
      box-shadow: 0px 3px 3px -2px rgba(0, 0, 0, 0.2), 0px 3px 4px 0px rgba(0, 0, 0, 0.14), 0px 1px 8px 0px rgba(0, 0, 0, 0.12) !important;

      &.left {
        left: 0;
        border-bottom-right-radius: 7px;
        border-top-right-radius: 7px;
      }

      &.right {
        right: 0;
        border-bottom-left-radius: 7px;
        border-top-left-radius: 7px;
      }

      i {
        margin: auto;
        color: @textColor !important;
      }
    }
  }
}

/* ============= End - Page Layout  ============= */
