@import url("https://fonts.googleapis.com/css2?family=Sedan+SC&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Sedan SC", serif;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #1a1a1d;
}

#rumble-main {
  display: flex;
  width: 100%;
  min-height: 100vh;
  justify-content: center;
  align-items: center;
  background: linear-gradient(to right, transparent, #1a1a1d), url(https://grainy-gradients.vercel.app/noise.svg);
}

#left {
  border-right: 2px solid #dadada;
  height: 100%;
  width: 50%;
  display: flex;
  justify-content: center;
  text-align: center;
  align-items: center;
}

#gameboard {
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(8, 85px);
  grid-template-rows: repeat(8, 85px);
  gap: 2px;
  box-shadow: 
    0 -5px 10px -3px transparent,
    0 5px 10px -3px transparent;
}

.square {
  position: relative;
  width: 85px;
  height: 85px;
  background-color: #fffff0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.3s,
    transform 0.3s;
}

.square:hover {
  background-color: #d4ff32;
}

.piece {
  padding: 5px;
  width: 80px;
  height: 80px;
  cursor: pointer;
  transition: transform 0.3s;
}

.piece svg {
  width: 75px;
  height: 75px;
}

.blue {
  border-radius: 8px;
  fill: blue;
}

.red {
  border-radius: 8px;
  fill: red;
}

.highlight {
  border-radius: 8px;
  border: 5px solid #8cff32;
  background-color: #fdff32;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 85px;
  height: 85px;
}

.highlight-swap {
  border-radius: 8px;
  border: 5px solid #FF80ED;
  background-color: #fdff32;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 85px;
  height: 85px;
}

.bullet {
  position: absolute;
  transition: all 0.1s ease; 
  z-index: 1;
}

.from-top {
  animation: from-top 0.1s linear;
}

@keyframes from-top {
  from {
    top: -2%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  to {
    top: 98%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

.from-bottom {
  animation: from-bottom 0.1s linear;
}

@keyframes from-bottom {
  from {
    top: 98%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  to {
    top: -2%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

.from-left {
  animation: from-left 0.1s linear;
}

@keyframes from-left {
  from {
    left: -2%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  to {
    left: 98%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

.from-right {
  animation: from-right 0.1s linear;
}

@keyframes from-right {
  from {
    left: 98%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
  to {
    left: -2%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

/* RIGHT PART */

#right {
  height: 100%;
  width: 50%;
  display: flex;
  justify-content: center;
}

#display-player-turn {
  color: #d4ff32;
  font-size: 32px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#player-turn {
  color: blue;
  font-weight: 600;
}

#timer {
  margin-top: 10px;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 50px;
}

.player-timer {
  padding: 10px;
  font-size: 24px;
  color: #10ff00;
  font-weight: 600;
}

#blue-timer-display {
  color: blue;
  font-weight: 600;
}

#red-timer-display {
  color: red;
  font-weight: 600;
}

.game-controls {
  margin: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 500px;
  width: 47%;
}

.action-buttons h2 {
  margin: 0;
  padding: 0;
  font-size: 24px;
  color: #636363;
}

/* Action Buttons */
.action-buttons button {
  padding: 1em 1.8em;
  background-color: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s;
  color: #8cff32;
  font-size: 15px;
  font-weight: 600;
}

.action-buttons button:hover {
  background-color: #353535cb;
  backdrop-filter: blur(5px);
}

/* Game History Styling */
#moveHistoryContainer {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 500px;
  width: 47%;
}

#moveHistoryContainer h2 {
  margin: 0;
  padding: 0;
  font-size: 24px;
  color: #636363;
}

#game-history {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  height: 100%;
  margin-top: 26px;
  overflow-y: scroll;
  scrollbar-color: #10ff00 #f8ff00;
  scrollbar-width: thin;
  background-color: #333;
  border-radius: 4px;
  padding: 10px;
  color: #2c3e50;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.7);
}

.move {
  padding: 5px;
  margin: 5px;
  background-color: #353535cb;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.move:hover {
  background-color: #333333c5;
}

.move.highlight {
  background-color: #d4ff32;
}

.blue-move {
  color: blue;
  box-shadow: inset 0 0 10px rgba(0, 21, 255, 0.358);
  text-transform: uppercase;
  font-size: 16px;
  font-weight: 600;
}

.red-move {
  color: red;
  box-shadow: inset 0 0 10px rgba(255, 0, 0, 0.225);
  text-transform: uppercase;
  font-size: 16px;
  font-weight: 600;
}

.highlight-move {
  border: 5px solid #10ff00;
  background-color: #f8ff00;
}

/* Actions options */

.action-options {
  margin: 10px;
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.action-options button {
  padding: 0.8em 1.6em;
  background-color: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s;
  color: #8cff32;
  font-size: 18px;
  font-weight: 600;
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

.tooltiptext {
  visibility: hidden;
  width: 90px;
  background-color: #1a1a1d;
  color: #10ff00;
  text-align: center;
  border-radius: 8px;
  padding: 5px;
  position: absolute;
  z-index: 9;
  bottom: 125%;
  left: 100%;
  margin-left: -80px;
  opacity: 0;
  transition: opacity 0.3s;
}

/* Popup Message Box */
#popup-box {
  display: none;
  justify-content: center;
  align-items: center;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #0d0d0ed6;
  padding: 20px;
  z-index: 1000;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  width: 100%;
  height: 100%;
}

.popup-content-box{
  padding: 10px;
  border: #10ff00 1px solid;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50%;
  width: 50%;
  background-color: #1a1a1de7;
}

.popup-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  padding: 20px;
}

#popup-title {
  font-size: 32px;
  font-weight: 600;
  color: #10ff00;
  margin-bottom: 10px;
}

.popup-content hr {
  border-top: 1px solid #d4ff32;
  width: 100%;
  margin-top: 2px;
  margin-bottom: 18px;
}

#popup-subtitle {
  font-size: 24px;
  color: #8cff32;
  margin-bottom: 20px;
}

.popup-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  margin-top: 20px;
  margin-bottom: 20px;
}

.popup-button {
  margin: 10px;
  background-color: #8cff32;
  color: #1a1a1d;
  border: 1px dashed #f8ff00;
  border-radius: 15px;
  cursor: pointer;
  padding: 0.7em 1.5em;
  transition: background-color 0.3s;
  font-size: 16px;
  font-weight: 600;
}

.popup-button:hover {
  background-color: #d4ff32;
}

/* Media Queries for Responsiveness */
@media (max-width: 992px) {
  #rumble-main {
    flex-direction: column;
  }

  #left, #right {
    width: 100%;
    border-right: none;
  }

  #right {
    padding: 20px;
    display: flex;
    flex-direction: column;
  }

  #display-player-turn {
    order: 1;
    margin-bottom: 7px;
  }

  #timer {
    order: 2; 
    margin-bottom: 14px;
  }

  #gameboard {
    order: 3; 
    margin-top: 10px;
    margin-bottom: 14px;
  }

  .game-controls {
    flex-direction: column;
    align-items: center;
  }

  .action-buttons {
    order: 5;
    width: 100%;
    margin-bottom: 20px;
    height: auto;
  }

  #moveHistoryContainer {
    order: 6; 
    width: 100%;
    height: auto;
  }

  .action-options {
    order: 4;  
    flex-direction: row;
    justify-content: space-around;
    flex-wrap: wrap;
  }

  .action-options .tooltip {
    margin: 10px 5px;
  }

  #gameboard {
    grid-template-columns: repeat(8, 11vw);
    grid-template-rows: repeat(8, 11vw);
    max-width: 90vw;
  }

  .square {
    width: 11vw;
    height: 11vw;
    border-radius: 4px;
  }

  .piece {
    width: 10vw;
    height: 10vw;
  }

  .piece svg {
    width: 9vw;
    height: 9vw;
  }

  #display-player-turn {
    font-size: 5vw;
  }

  .player-timer {
    font-size: 4vw;
  }

  .action-buttons h2, #moveHistoryContainer h2 {
    font-size: 4.5vw;
  }

  .action-buttons button {
    font-size: 3.5vw;
    padding: 0.8em 1.2em;
    margin-bottom: 7px;
  }

  .action-options button {
    font-size: 0; 
    padding: 1em;
  }

  .action-options button i {
    font-size: 6vw; 
  }

  .tooltiptext {
    font-size: 3vw;
  }
}

/* Further adjustments for smaller screens */
@media (max-width: 576px) {
  #gameboard {
    margin-top: 15.9px;
    grid-template-columns: repeat(8, 10vw);
    grid-template-rows: repeat(8, 10vw);
  }

  .square {
    width: 10vw;
    height: 10vw;
  }

  .piece {
    width: 9vw;
    height: 9vw;
  }

  .piece svg {
    width: 8vw;
    height: 8vw;
  }

  #display-player-turn {
    font-size: 5.1vw;
  }

  #player-turn{
    padding: 2px;
    border-radius: 50%;
    background-color: #d4ff32;
  }

  .player-timer {
    font-size: 4.3vw;
  }

  #blue-timer-display, #red-timer-display {
    padding: 2px;
    border-radius: 50%;
    background-color: #10ff00;
  }

  .action-buttons h2, #moveHistoryContainer h2 {
    font-size: 4.5vw;
  }

  .action-buttons button {
    font-size: 4vw;
  }

  .action-options button i {
    font-size: 7vw;
  }
  .popup-content-box {
    width: 100%;
  }
  #popup-subtitle {
    margin-bottom: 8px;
  }
  .popup-buttons {
    margin-top: 0;
    margin-bottom: 2px;
  }
  .popup-button {
    padding: 0.5em 1em;
    font-size: 14px;
  }
}