// template structures frame

$btn-background-color: $menu-background-color;
$btn-text-color: $menu-font-color;
$input-border-color: #bfbfbf;

.ot-structures-frame, .ot-structures-frame-details {
  @include flex;
  font-family: Cambria, Arial, serif;

  header {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    width: 100%;
    align-items: center;
  }

  h2 {
    font-size: 21px;
    font-weight: 750;
    flex: 1;
    text-align: left;
    color: $btn-background-color;
  }

  header a {
    padding: 3px;
    margin: 2px;
    font-weight: 500;
  }

  input, select {
    height: 36px;
    border: solid 1px $input-border-color;
    border-radius: 0;
  }

  .structure-col {
    @include flex;
    flex-direction: column;
    flex: 1;
    max-width: 50%;
    padding: 12px;
    align-items: center;
  }

  .btn {
    background-color: $btn-background-color;
    border-radius: 4px;
    padding: 8px;
    font-weight: 750;
    color: $btn-text-color;
    text-align: center;
  }

  .spacer {
    flex: 1;
  }
}

.ot-structures-frame {
  flex-direction: row;
  flex-wrap: wrap;

  // The wrapper role is to maintain the map's height equal to its width
  // @see https://stackoverflow.com/a/14896313/4279120
  #structure-map-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    float: left;
    height: 0;
  }

  #structure-map {
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
  }

  #structure-map a {
    text-decoration: none;
  }

  #structure-map-bar {
    margin: 16px 2% 6px 2%;
    width: 100%;
  }

  #structure-map-bar .advice {
    color: #262626;
    font-weight: 750;
    text-align: center;
    font-size: 12px;
  }

  #overseas-provinces-list {
    @include flex;
    flex-direction: row;
    list-style: none;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0;
    width: 100%;
  }

  #overseas-provinces-list li {
    margin: 5px;
    min-width: 50px;
    width: 75px;
    height: 75px;
  }

  #overseas-provinces-list li img {
    border: solid 1px #000000;
    max-width: 100%;
    width: 100%;
    height: 100%;
    cursor: pointer;
  }

  .structure-search {
    width: 100%;
  }

  .structure-search form {
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  .structure-search-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    margin-bottom: 8px;
  }

  .search-bar-wrapper {
    display: flex;
    flex-direction: row;
    height: 30px;
    padding: 6px 2%;
    border: solid 1px $input-border-color;
    margin: 6px 0;
    max-width: 44%;
  }

  .search-bar-wrapper:not(:last-child) {
    margin-right: auto;
  }

  .search-bar {
    flex: 1;
    background: none;
    outline: none;
    height: auto;
    font-size: 18px;
    border: none;
    width: 95%;
    min-width: 85%;
  }

  .search-bar-btn {
    @include flex;
    flex-direction: column;
    justify-content: center;
    border: none;
    background: none;
    width: 5%;
    min-width: 24px;
    padding: 5px;
    font-size: 18px;
    cursor: pointer;
    min-height: 32px;
  }

  .search-bar-btn .fas {
    color: darken($input-border-color, 20);
  }

  .city-search-dropdown {
    min-width: 100%;
    position: relative;
    display: inline-block;
    top: 10px;
    left: -100%;
  }

  .city-search-results, .city-search-no-result, .city-search-loading {
    position: absolute;
    min-width: 100%;
    background: #EEEEEE;
    box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
    z-index: 99;
    top: 100%;
  }

  .city-search-loading img {
    padding:10px;
    width:30px;
  }

  .city-search-item, .city-search-no-result {
    display: block;
    padding: 12px 24px;
    white-space: nowrap;
  }

  .city-search-item:hover {
    background-color: #d9d9d9;
    cursor: pointer;
  }

  .structure-search select {
    color: $btn-background-color;
    padding: 4px 6px;
    margin: 3px 2%;
    font-weight: 750;
    width: 22%;
    min-width: 110px;
    font-size: 12px;
  }

  .structure-search select:first-child {
    margin-left: 0;
  }
  .structure-search select:last-child {
    margin-right: 0;
  }

  .structure-search .reset-search {
    background: none;
    color: $btn-background-color;
    margin: 0 6px 6px 0;
    cursor: pointer;
    height: 36px;
    border: solid 2px $btn-background-color;
    border-radius: 0;
  }

  .structure-search .submit-search {
    background-color: $btn-background-color;
    color: $btn-text-color;
    font-weight: 750;
    margin: 0 0 6px 6px;
    cursor: pointer;
    height: 36px;
    border: none;
    border-radius: 0;
  }

  .structure-results .structures-page {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .structure-card {
    display: flex;
    flex-direction: column;
    width: 42%;
    min-width: 200px;
    border: solid 1px #cccccc;
    border-radius: 4px;
    padding: 12px;
    margin: 8px 1%;
    background-color: #f2f2f2;
  }

  .structure-poster {
    display: flex;
    flex-direction: row;
    justify-content: center;
    margin: 8px;
    min-width: 160px;
    height: 80px;
  }

  .structure-poster img {
    width: auto;
    height: auto;
    max-width: 100%;
  }

  .structure-details {
    display: flex;
    flex-direction: column;
  }

  .structure-details > * {
    margin: 4px;
  }

  .structure-practices {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    min-height: 18px;
  }

  .structure-practice {
    background-color: #d9d9d9;
    color: #262626;
    font-size: 11px;
    margin: 1px 4px 1px 0;
    padding: 1px 5px 3px 5px;
    height: 16px;
    border-radius: 6px;
  }

  .structure-name {
    font-size: 18px;
    font-weight: 750;
    width: 100%;
    text-align: left;
    color: $btn-background-color;
  }

  .structure-details-table td {
    border:none;
  }

  .structure-details-entry {
    color: #595959;
  }

  .structure-details-entry .fas {
    color: $btn-background-color;
  }

  .structure-see {
    width: 128px;
    max-height: 28px;
    padding: 4px;
    font-weight: 500;
    margin-top: 8px;
  }

  .structure-see:hover {
    text-decoration: none;
    color: white;
  }

  .results-count-message {
    width: 100%;
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    color: #666666;
    font-size: 0.8em;
    padding-left: 12px;
  }

  .pagination-bar {
    li a {
      color: #4d4d4d;
      font-weight: 600;
    }

    li.current a {
      color: $btn-background-color;
    }
  }
}

.ot-structures-frame.list-view {
  // List view changes

  .structure-col-map {
    display: none;
  }

  .structure-search form .search-buttons {
  }

  .search-bar-wrapper {
    flex: 1;
    max-width: none;
  }

  .search-bar-wrapper:not(:last-child) {
    margin-right: 2%;
  }

  .structure-search-row.filters {
    margin: 0 auto 12px auto;
  }

  .search-bar {
    flex: 1;
    max-width: none;
  }

  .filters select, .filters button {
    height: 52px;
    margin: 3px 0.5%;
  }

  .filters .reset-search {
    margin-left: 0;
  }

  .filters .submit-search {
    margin-right: 0;
  }

  .filters select {
    width: 18.5%;
  }

  .filters button {
    width: 10.5%;
  }

  .structure-col {
    align-items: normal;
  }

  .structure-col-results {
    width: 100%;
    max-width: 100%;
  }

  .structure-card {
    width: 95%;
    flex-direction: row;
  }

  .structure-card .spacer {
    flex: 0; // disable spacer in list view
  }

  .structure-details {
    flex: 1;
  }

  .structure-see {
    align-self: flex-end;
  }
}

.ot-structures-frame.map-view .activate-map-view {
  font-weight: 750;
}
.ot-structures-frame.list-view .activate-list-view {
  font-weight: 750;
}

// Medium screens
@media screen and (min-width: 700px) and (max-width: 1048px) {
  .ot-structures-frame.map-view {
    #overseas-provinces-list li {
      width: 85px;
      height: 85px;
      margin: 5px 12px;
    }

    .structure-search select {
      margin: 3px 2%;
      width: 46%;
    }
  }

  .ot-structures-frame.list-view {
    .structure-search-row {
      flex-wrap: nowrap;
    }

    .filters {
      select, button {
        width: 15%;
        margin: 1%;
      }
    }
  }
}


// Small screens
@media screen and (max-width: 700px) {
  .ot-structures-frame {
    flex-direction: column;
    flex-wrap: nowrap;

    .structure-col {
      max-width: none;

      // prevents content to be higher than the container
      min-width: 100px;
      overflow: hidden;
    }

    .structure-search-row {
      flex-direction: column;
    }

    .search-bar-wrapper {
      width: 95%;
      max-width: 95%;
      margin: 3px auto;
    }

    .search-bar-wrapper input {
      width: auto;
    }

    .structure-search select {
      width: 95%;
      margin: 3px auto;
    }

    .structure-card {
      width: 100%;
    }
  }
  .ot-structures-frame.list-view {

    .search-bar-wrapper {
      width: 85%;
    }

    .structure-card {
      flex-direction: column;
    }

    .structure-search-row {
      flex-wrap: nowrap;
    }

    .structure-search-row.filters {
      margin: 0;
    }

    .filters {
      select, button {
        width: 80%;
        margin: 5px auto;
      }
    }
  }
}

.ot-structures-frame-details {
  flex-direction: column;

  .please-wait {
    @include flex;
    flex-direction: row;
    width: 100%;
    height: 100vh;
    justify-content: center;
    align-items: center;
  }

  .content {
    margin: 18px 10%;
    max-width: 80%;
  }

  header {
    @include flex;
    flex-direction: row;

    .go-back {
      margin: 16px;
      padding: 4px 8px;
      color: #737373;
      font-weight: 700;
    }

    h2 {
      font-size: 14px;
      flex: 1
    }
  }

  .structure-header {
    @include flex;
    flex-direction: row;
    align-items: center;

    >* {
      margin: 12px;
    }

    .logo {
      height: 60px;
      width: auto;
    }

    h3 {
      font-size: 22px;
      color: $btn-background-color;
      font-weight: 750;
      flex: 1;
    }

    .social {
      @include flex;
      flex-direction: row;
      align-items: center;
    }

    .social a {
      font-size: 22px;
      padding: 4px 6px;
      color: #808080;
    }
  }

  .structure-practices {
    display: flex;
    flex-direction: row;
    width: 100%;
    margin: 6px auto;
    padding-bottom: 6px;
    flex-wrap: wrap;
    min-height: 18px;
    justify-content: center;
    border-bottom: solid 1px #a6a6a6;
  }

  .structure-practice {
    background-color: #d9d9d9;
    color: #262626;
    font-size: 11px;
    margin: 1px 4px 1px 0;
    padding: 1px 5px 3px 5px;
    height: 16px;
    border-radius: 6px;
  }

  .illustration-container {
    @include flex;
    flex-direction: row;
    margin: 40px 20%;
    justify-content: center;

    img {
      max-height: 180px;
      width: auto;
    }
  }

  .practices-tags {
    @include flex;
    flex-direction: row;
  }

  .details {
    @include flex;
    flex-direction: row;
    max-width: 100%;
    color: #666666;

    h4 {
      font-size: 18px;
      font-weight: 750;
      border-bottom: solid 1px $btn-background-color;
      align-self: flex-start;
      color: #666666;
      margin: 8px 0;
    }

    .description {
      @include flex;
      flex-direction: column;
      border-right: solid 2px $btn-background-color;
      width: 45%;
      padding-right: 5%;
    }
    .contact {
      @include flex;
      flex-direction: column;
      width: 45%;
      padding-left: 5%;
    }

    .contact td {
      background: none;
      border: none;
      width: 80%;
    }
    .contact td:first-child {
      width: 20%;
      color: $btn-background-color;
    }
  }

  .spot-on-bar {
    @include flex;
    flex-direction: row;
  }

  #structure-details-map {
    height: 300px;
    margin-top: 45px;
  }

}
