/* Propriedades ordenadas por agrupamento: */
/*  - https://css-tricks.com/poll-results-how-do-you-order-your-css-properties/ */
/* Para explicação dos valores usados, ver JIRA S246003-79 */

@import url("/static/custom/base.css");

/*** TOP BAR (Navegação superior) ***/
.top-bar {
  overflow: hidden;
  height: var(--top-bar-height);
  border-bottom: 1px solid var(--light-border);
  background-color: var(--light-background);
  font-size: 150%;
  line-height: var(--top-bar-height);

  .title-area, &.expanded .title-area {
    height: var(--top-bar-height);
    background-color: var(--light-background);
    line-height: var(--top-bar-height);
  }

  a {
    background: var(--light-background);
    color: var(--font-color-dark);
  }

  /* Área logo */
  .name h1 a {
    padding: 0;
    &:hover {
      background: white;
    }
  }

  .logo-unicamp {
    height: var(--top-bar-height);
    padding: 30px;
  }

  /* Área links */
  .top-bar-section ul {
    background: var(--light-background);

    .divider {
      display: none;
    }

    li {
      align-content: center;
      display: flex;
      height: var(--top-bar-height);
    }

    li > a:not(.button) {
      padding: 0 30px;
      background: var(--light-background);
      color: var(--font-color-dark);
      font-size: 1em;
      line-height: var(--top-bar-height);
      text-align: center;
      &:hover, &:focus {
        background: white;
      }
    }

    li > a.button {
      top: 0;
      max-width: 13ex;
      margin: auto 30px;
      min-width: 10ex;
      height: 2.5em;
      line-height: 2.5em;
      @media only screen and (max-width: 939px) {
        height: 100%;
      }
    }

    /* Corrige comportamento indesejado do Foundation
     * com hover no li que contém o botão no top-bar */
    li:hover > a.button {
      background: #2284a1;
    }
  }

  /* Configuração Top Bar para telas menores de 940px */
  @media only screen and (max-width: 939px) {
    /* Ícone menu hamburger */
    .toggle-topbar.menu-icon a span {
      -webkit-box-shadow: 0 10px 0 1px var(--font-color-dark), 0 16px 0 1px var(--font-color-dark), 0 22px 0 1px var(--font-color-dark);
      box-shadow: 0 10px 0 1px var(--font-color-dark), 0 16px 0 1px var(--font-color-dark), 0 22px 0 1px var(--font-color-dark);
    }

    /* Menu expandido */
    .top-bar-section ul {
      .divider {
        display: block;
        padding: 2px;
        border-color: var(--light-border);
      }

      :not(:last-child){
        border-bottom: 1px var(--light-border) solid;
      }

      li {
        height: auto;
        padding: 10px;

        a:not(.button) {
          line-height: 2em;
        }

        a.button {
          margin: auto;
        }
      }
    }
  }
}
/* Ajuste comportamento esquisito Foundation */
@media only screen and (min-width: 940px) {
  .top-bar.expanded {
    background: var(--light-background);
  }
}

/* Permite que logos encolham enquanto  */
/* menu hambúrguer não é acionado */
@media only screen and (min-width: 940px) {
  .top-bar {
    display: flex;

    .title-area {
      flex: 1 1 auto;
      min-width: 0;
    }

    section {
      flex: 1 0 auto;
      justify-content: flex-end;
    }
  }
}

/*** RODAPÉ ***/
.wrapper {
  margin: 0 auto -4em;
}

.push {
  height: 4em;
}

#footer {
  align-content: center;
  height: 4em;
  padding: 0 30px;
  border-top: 1px solid var(--light-border);
  background: var(--light-background);
  /* Em tela pequena, adiciona margem superior no rodapé */
  @media only screen and (max-height: 850px) {
    margin-top: 48px;
  }
}

/*** PAINEL ***/
.panel {
  background: var(--light-background);
  pre {
    line-height: 1.35em;
  }
  .row {
    margin: 0;
  }
  ul {
    line-height: 1.75em;
    list-style-type: none;
    margin: 0 0 1em 1em;
  }
}

.highlight-box {
  margin-top: 1em;
  padding: 10px;
  border: 1px solid var(--light-border);
  background: var(--background-gray);
  color: var(--font-color-dark);
}

/*** PÁGINA INICIAL ***/
.main-page-logo {
  display: block;
  margin: 1.5em auto;
  width: 375px;
  border: 0;
}

.election-list {
  li {
    line-height: 1.3em;
    margin-bottom: 1em;
  }
}

/*** FORMULÁRIO ***/
label {
  display: inline-block;
}

/* Mensagem de erro */
.errorlist {
  margin: -0.5em 0 1em 0;
  padding: 0.6em;
  font-size: 0.9em;
  font-weight: bold;
  color: var(--font-color-red);
  background-color: var(--background-red);
  border: 1px solid var(--font-color-red);
  border-radius: 4px;
  list-style: none;
}

.errorlist.freeze {
  font-weight: normal;
  font-size: 1em;

  ul {
    margin-top: 0.5em;
    margin-bottom: 0;
  }
}

/* Seletor (dropdown) */
select {
  height: var(--form-element-height);
  width: auto;
  border-color: var(--border-color);
  background: var(--background-gray);
  color: var(--font-color-dark);
  font-family: var(--primary-font);
  font-size: var(--form-element-font-size);
}

/* Checkbox estilo switch */
/* Adaptado de https://www.w3schools.com/howto/howto_css_switch.asp */
.toggle {
  position: relative;
  display: inline-block;
  height: var(--form-element-height);
  width: calc(var(--form-element-height) * 1.75);

  /* Hide default HTML checkbox */
  input {
    height: 0;
    width: 0;
    opacity: 0;
  }

  /* The slider */
  .slider {
    position: absolute;
    inset: 0;
    background-color: var(--border-color);
    -webkit-transition: .4s;
    transition: .4s;
    cursor: pointer;
  }

  .slider:before {
    position: absolute;
    inset: calc(var(--form-element-height) * 0.125);
    height: calc(var(--form-element-height) * 0.75);
    width: calc(var(--form-element-height) * 0.75);
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    content: "";
  }

  input:checked + .slider {
    background-color: var(--background-blue);
  }

  input:focus + .slider {
    box-shadow: 0 0 5px #222;
  }

  input:checked + .slider:before {
    -webkit-transform: translateX(100%);
    -ms-transform: translateX(100%);
    transform: translateX(100%);
  }
}

/* Adiciona pequeno espaço entre widgets de data e hora */
.voting-schedule {
  select {
    margin-right: 4px;
  }
}

/* Botão de upload de arquivos */
input[type="file"] {
    margin: 0 0 1.25em 0;
}
input::file-selector-button {
  border-style: solid;
  border-width: 1px;
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  line-height: normal;
  margin: 0 1em 0 0;
  position: relative;
  text-decoration: none;
  text-align: center;
  display: inline-block;
  padding-top: 0.75em;
  padding-right: 1.5em;
  padding-bottom: 0.8125em;
  padding-left: 1.5em;
  font-size: 1em;
  background-color: #e9e9e9;
  border-color: #d0d0d0;
  color: #333333;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
  transition: background-color 300ms ease-out;
}
input::file-selector-button:hover {
  background-color: #d0d0d0;
}

/*** MODAL QUESTÕES ***/
#question-modal {
  /* Remendo para ajustar margens do modal */
  max-width: 70em;
  margin-left: 0;
  transform: translateX(-50%);

  #question-modal-container {
    /* Área útil do modal fica limitado ao mesmo tamanho
       das 12 colunas do Foundation  */
    max-width: 62.5em;
    margin: auto;

    #question-form-buttons {
      display: flex;
      justify-content: space-evenly;
      flex-direction: row;
    }
    @media only screen and (max-width: 767px) {
      #question-form-buttons {
        flex-direction: column;
      }
    }
  }
}

/*** TABELAS ***/
table, table.pretty {
  border-collapse: collapse;
  border-spacing: 0;
  text-align: left;
  width: 100%;
  margin: 0.5em 0em 0.5em 0em;

  tr {
    height: 2.2em;
  }

  td, th {
    border: 0;
    vertical-align: middle;
    color: var(--font-color-dark);
  }

  @media only screen and (min-width: 768px) {
    .col-login {
      min-width: 10em;
    }
    .col-email {
      min-width: 15em;
    }
    .col-name {
      min-width: 15em;
    }
  }
}
