/* styles.css */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  color: #333;
  background-color: #f0f0f0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif;
  line-height: 1.6;
}

header {
  text-align: center;
  margin-bottom: 20px;
  padding: 20px;
}

h1 {
  color: #2c3e50;
  font-size: 2.5em;
}

#info {
  overflow-x: auto;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 5px;
  max-width: 800px;
  margin: 20px auto;
  padding: 15px;
  box-shadow: 0 2px 5px #0000001a;
}

#info pre {
  white-space: pre-wrap;
  font-family: Courier New, monospace;
  font-size: .9em;
}

#building {
  display: flex;
  overflow: hidden;
  background-color: #fff;
  border: 3px solid #34495e;
  border-radius: 10px;
  flex-direction: column;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  box-shadow: 0 4px 10px #0003;
}

.floor {
  display: flex;
  border-bottom: 1px solid #ecf0f1;
  justify-content: space-between;
  align-items:  center;
  min-height: 80px;
  padding: 15px;
}

.floor:last-child {
  border-bottom: none;
}

.floor-number {
  text-align: center;
  flex: 1;
  font-size: 1.2em;
  font-weight: bold;
}

.floor-buttons {
  display: flex;
  gap: 10px;
}

.floor-button {
  cursor: pointer;
  color: #fff;
  display: flex;
  border: none;
  border-radius: 50%;
  justify-content: center;
  align-items:  center;
  width: 45px;
  height: 45px;
  transition: all .2s;
  font-size: 1.2em;
  font-weight: bold;
}

.floor-button.up {
  background-color: #27ae60;
}

.floor-button.down {
  background-color: #e74c3c;
}

.floor-button:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 5px #0000004d;
}

.floor-button.active {
  opacity: .6;
  box-shadow: inset 0 2px 5px #0000004d;
}

.floor-button.disabled {
  opacity: .3;
  cursor: not-allowed;
}

.elevator-shaft {
  position: relative;
  background-color: #bdc3c7;
  border-left: 2px solid #34495e;
  width: 80px;
  height: 100%;
}

.elevator {
  position: absolute;
  display: flex;
  color: #fff;
  border: 2px solid #2c3e50;
  border-radius: 5px;
  flex-direction: column;
  justify-content: center;
  align-items:  center;
  width: 70px;
  height: 70px;
  transition: top 1s ease-in-out;
  font-size: .8em;
  font-weight: bold;
  box-shadow: 0 2px 5px #0000004d;
}

.elevator:first-child {
  background-color: #3498db;
}

.elevator:nth-child(2) {
  background-color: #9b59b6;
}

.elevator:nth-child(3) {
  background-color: #1abc9c;
}

.elevator:nth-child(4) {
  background-color: #f39c12;
}

.elevator:nth-child(5) {
  background-color: #e67e22;
}

.elevator-number {
  margin-bottom: 5px;
}

.elevator-direction {
  margin-bottom: 5px;
  font-size: 1.2em;
}

.elevator-direction.up:before {
  content: "↑";
}

.elevator-direction.down:before {
  content: "↓";
}

.elevator-direction.idle:before {
  content: "—";
}

.elevator-floor {
  font-size: .9em;
}

.elevator-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  margin-top: 10px;
}

.elevator-button {
  color: #fff;
  cursor: pointer;
  display: flex;
  background-color: #fff3;
  border: 1px solid #ffffff80;
  border-radius: 3px;
  justify-content: center;
  align-items:  center;
  width: 25px;
  height: 25px;
  transition: all .2s;
  font-size: .7em;
}

.elevator-button:hover {
  background-color: #fff6;
}

.elevator-button.active {
  color: #2c3e50;
  background-color: #f1c40f;
}

.elevator-button.disabled {
  opacity: .3;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  #building {
    flex-direction: column;
    width: 95%;
  }

  .floor {
    flex-direction: column;
    align-items: stretch;
  }

  .floor-buttons {
    justify-content: center;
  }

  .elevator-shaft {
    border-top: 2px solid #34495e;
    border-left: none;
    width: 100%;
    height: 80px;
  }

  .elevator {
    position: static;
    display: inline-flex;
    margin: 10px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2em;
  }

  .floor-button {
    width: 40px;
    height: 40px;
    font-size: 1em;
  }

  .elevator {
    width: 60px;
    height: 60px;
  }

  .elevator-button {
    width: 20px;
    height: 20px;
    font-size: .6em;
  }
}
