/* [ConnectEmo] - Jeu de cartes en ligne
 * Mina Pêcheux (2020)
 * ------------------------------------------
 * elements.css - Global CSS elements styling
 *                (used throughout the app)
 */

/* Panel */
.panel {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.35s ease-in-out;
  pointer-events: none;
}

.panel-overlay {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.25);
  z-index: 1;
}

.panel-content {
  display: flex;
  flex-direction: column;
  background-color: white;
  padding: 1em;
  box-shadow: 0 0 4px 2px rgba(0, 0, 0, 0.15);
  z-index: 2;
  border-radius: 2px;
}

.panel-content a {
  text-decoration: none;
  color: #b70770;
}
.panel-content a:hover {
  color: #e0167e;
}
.panel-content h4 {
  margin-top: 0;
}
.panel-content .bottom-credits {
  font-size: 0.85em;
  border-top: 1px solid black;
  padding-top: 4px;
  margin-top: 16px;
  width: 100%;
}

/* Forms */
.intro, .validation {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
}

.form-block {
  min-height: 275px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  border-radius: 2px;
  padding: 1em;
  box-shadow: 0 0 4px 2px rgba(0, 0, 0, 0.15);
}

.form-block form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.form-block form .form-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
}
.form-block form .form-items .left-label {
  text-align: right;
  justify-self: flex-end;
}
.form-block form .form-items .switch {
  justify-self: center;
}

.form-block form .btn {
  margin-top: 1em;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  box-shadow: 0 0 4px 2px rgba(0, 0, 0, 0.15);
}
.header .icon {
  text-decoration: none;
  color: #555;
  display: grid;
  place-items: center;
  padding: 8px;
}
.header .icon a {
  color: #555;
  padding: 0;
  height: 20px;
}

/* Button */
.btn {
  text-align: center;
  border: 1px;
  padding: 4px 8px;
  text-transform: uppercase;
  font-family: inherit;
  border-radius: 4px;
  font-weight: 500;
  font-size: 1em;
  cursor: pointer;
  background-color: #f2f2f2;
}
.btn:hover {
  background-color: #e5e5e5;
}
.btn:active, .btn:focus {
  background-color: #e2e2e2;
  outline: none;
}

/* Layout */
.row {
  display: flex;
  align-items: center;
}
.row > *:not(:last-child) {
  margin-right: 0.5em;
}

/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {
  :root {
    --col-width: 100%;
  }

  .row-breakable > *:not(:last-child) {
    margin-bottom: 1em;
    margin-right: 0em;
  }

  .form-block, .validation-block {
    width: 80vw;
  }
}

/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {
  :root {
    --col-width: 50%;
  }

  .row-breakable > *:not(:last-child) {
    margin-bottom: 1em;
    margin-right: 0em;
  }

  .form-block, .validation-block {
    width: 80vw;
  }
}

/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {
  :root {
    --col-width: 30%;
  }

  .row-breakable > *:not(:last-child) {
    margin-bottom: 1em;
    margin-right: 0em;
  }

  .form-block, .validation-block {
    width: 60vw;
  }
}

/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {
  :root {
    --col-width: 20%;
  }

  .row-breakable {
    display: flex;
    align-items: center;
  }
  .row-breakable > *:not(:last-child) {
    margin-bottom: 0em;
    margin-right: 1em;
  }

  .form-block, .validation-block {
    width: 40vw;
  }
}

/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {
  :root {
    --col-width: 16%;
  }

  .row-breakable {
    display: flex;
    align-items: center;
  }
  .row-breakable > *:not(:last-child) {
    margin-bottom: 0em;
    margin-right: 1em;
  }

  .form-block, .validation-block {
    width: 33vw;
  }
}

/* Card */
.cards {
  padding: 0 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--col-width), 1fr));
  grid-gap: 4px;
  margin-top: 16px;
}

.card {
  position: relative;
  border: 1px solid #e2e2e2;
  box-sizing: border-box;
  border-radius: 4px;
  transition: all 0.5s ease-in-out;
  opacity: 1;
}

.card::before {
  content: '';
  display: block;
  padding-top: 71%;
}

.card-type-1 .card-third {
  opacity: 0;
}
.card-type-1 .card-interact-btns {
  display: none;
}
.card-type-2 .card-third {
  display: none;
  opacity: 1;
}
.card-type-2 .card-number {
  display: none;
}
.card-type-3 .card-front {
  display: none;
}
.card-type-3 .card-number {
  display: none;
}
.card-type-2 .card-wrapper {
  transform: rotateY(180deg);
}
.card-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  transition: transform 1s;
  transform-style: preserve-3d;
}

.card-recto, .card-verso, .card-third {
  position: absolute;
  width: 100%;
  height: 100%;
  padding: 4px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.card-recto .card-number {
  position: absolute;
  top: 12px;
  right: 16px;
  font-style: italic;
  font-size: 16px;
  color: #f5f5f5;
}
.card-recto img, .card-verso img, .card-third img {
  width: 100%;
  height: auto;
}

.card-verso {
  transform: rotateY(180deg);
}

.card-third {
  transition: opacity 1s;
  opacity: 1;
}

.card-text {
  text-transform: uppercase;
  z-index: 10;
  text-align: center;
  line-height: 22px;
  margin-top: -24px;
  font-size: 14px;
  color: #f5f5f5;
}

.card-interact-btns {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: absolute;
  right: 4px;
  top: 0;
  height: 100%;
  z-index: 100;
  padding: 8px 0;
}

.card-interact-btns > div {
  background-color: #f2f2f2;
  color: #555;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.card-interact-btns > div:hover {
  background-color: #e1e1e1;
}

.card-interact-btns .validate-btn {
  background-color: #97bd31;
  color: #f5f5f5;
}
.card-interact-btns .validate-btn:hover {
  background-color: #7fa024;
}

/* Loader */
.loader-wrapper {
  display: none;
  position: absolute;
  top: calc(50vh - 40px);
  left: calc(50vw - 40px);
}
.loader {
  display: inline-block;
  position: relative;
  width: 80px;
  height: 80px;
}
.loader div {
  position: absolute;
  border: 4px solid #809DC3;
  opacity: 1;
  border-radius: 50%;
  animation: loader 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;
}
.loader div:nth-child(2) {
  animation-delay: -0.5s;
}
@keyframes loader {
  0% {
    top: 36px;
    left: 36px;
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    top: 0px;
    left: 0px;
    width: 72px;
    height: 72px;
    opacity: 0;
  }
}

/* The switch - the box around the slider */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 16px;
}

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

/* The slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  -webkit-transition: .4s;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  -webkit-transition: .4s;
  transition: .4s;
}

.left-label:has(+ label input:not(:checked) ) {
  font-weight: 700;
}

label:has(input:checked) + .right-label {
  font-weight: 700;
}

.left-label::after, .right-label::after {
  content: attr(data-text);
  font-weight: 700;
  visibility: hidden;
  height: 0;
  overflow: hidden;
  display: block;
}

input + .slider {
  background-color: #2196F3;
}

xx input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

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

/* Rounded sliders */
.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Buzz */
@-webkit-keyframes buzz {
  50% {
    -webkit-transform: translateX(3px) rotate(2deg);
    transform: translateX(3px) rotate(2deg);
  }
  100% {
    -webkit-transform: translateX(-3px) rotate(-2deg);
    transform: translateX(-3px) rotate(-2deg);
  }
}
@keyframes buzz {
  50% {
    -webkit-transform: translateX(3px) rotate(2deg);
    transform: translateX(3px) rotate(2deg);
  }
  100% {
    -webkit-transform: translateX(-3px) rotate(-2deg);
    transform: translateX(-3px) rotate(-2deg);
  }
}
.buzz {
  display: inline-block;
  vertical-align: middle;
  -webkit-transform: perspective(1px) translateZ(0);
  transform: perspective(1px) translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
  -webkit-animation-name: buzz;
  animation-name: buzz;
  -webkit-animation-duration: 0.15s;
  animation-duration: 0.15s;
  -webkit-animation-timing-function: linear;
  animation-timing-function: linear;
  -webkit-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
}

/* Custom dropdown */
.topics-dropdown {
  font-size: 14px;
  padding: 10px 8px 10px 10px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  position: relative;
  max-width: 80%
}

.topics-dropdown .select select {
  background: transparent;
  line-height: 1;
  border: 0;
  padding: 0;
  border-radius: 0;
  position: relative;
  z-index: 10;
  font-size: 1em;
  width: 100%;
}
