/* Colors */
:root {
    --black: black;
    --color-1: #2d9fff;
    --color-1-dark: rgba(45, 159, 255, 0.4);
    --color-1-dark-2: rgba(45, 159, 255, 0.6);
    --color-2: #2dffb5;
    --color-3: #ff2ddb;
    --grey: darkgrey;
    --white: #ffffff;
    --white-2: #e0e0e0;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--black);
    color: var(--white);
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    text-align: center;
}

/* Floating background */
.floating-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.floating-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(40px);
    will-change: transform;
}

.floating-circle:nth-child(1) {
    background: radial-gradient(circle, var(--color-1) 10%, transparent 70%);
    width: 300px;
    height: 300px;
    top: 10%;
    left: -10%;
    animation: float1 25s infinite linear;
    opacity: 0.3;
}

.floating-circle:nth-child(2) {
    background: radial-gradient(circle, var(--color-2) 10%, transparent 70%);
    width: 200px;
    height: 200px;
    top: 60%;
    right: -5%;
    animation: float2 30s infinite linear;
    opacity: 0.2;
}

.floating-circle:nth-child(3) {
    background: radial-gradient(circle, var(--color-3) 10%, transparent 70%);
    width: 400px;
    height: 400px;
    top: 30%;
    left: 50%;
    animation: float3 35s infinite linear;
    opacity: 0.15;
}

.floating-circle:nth-child(4) {
    background: radial-gradient(circle, var(--color-1-dark) 30%, transparent 70%);
    width: 150px;
    height: 150px;
    top: 80%;
    left: 20%;
    animation: float4 20s infinite linear;
    opacity: 0.25;
}

.floating-circle:nth-child(5) {
    background: radial-gradient(circle, var(--color-1-dark-2) 30%, transparent 70%);
    width: 250px;
    height: 250px;
    top: 5%;
    right: 30%;
    animation: float5 28s infinite linear;
    opacity: 0.2;
}

@keyframes float1 {
    0% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(100px, -50px) scale(1.1); }
    50% { transform: translate(200px, 100px) scale(0.9); }
    75% { transform: translate(-50px, 150px) scale(1.05); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes float2 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-150px, 100px) scale(0.8); }
    66% { transform: translate(-80px, -120px) scale(1.2); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes float3 {
    0% { transform: translate(0, 0) scale(1); }
    20% { transform: translate(-200px, 50px) scale(1.1); }
    40% { transform: translate(-100px, -100px) scale(0.9); }
    60% { transform: translate(150px, -50px) scale(1.05); }
    80% { transform: translate(100px, 120px) scale(0.95); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes float4 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(300px, -200px) scale(1.3); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes float5 {
    0% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-100px, 80px) scale(0.9); }
    50% { transform: translate(50px, 150px) scale(1.1); }
    75% { transform: translate(-200px, 50px) scale(0.85); }
    100% { transform: translate(0, 0) scale(1); }
}

.floating-circle {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}


/* Hide the body content until fonts are loaded */
body {
    opacity: 0;
    transition: opacity 0.3s ease;
}

body.fonts-loaded {
    opacity: 1;
}

body.fonts-loaded .loading-spinner {
    display: none;
}

/* Add a loading indicator */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: sans-serif;
    color: var(--white);
}

.hidden {
    display: none;
}

/* Typography */
h1 {
  font-family: 'Pacifico', cursive;
  font-display: block;
  font-size: 5rem;
  margin-bottom: 0.5rem;
  color: var(--color-1);
  text-shadow: 0 0 1px var(--color-3);
}

h2 {
  font-weight: 300;
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto 4rem auto;
  color: var(--white-2);
}

/* Container layout */
.container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 800px;
  position: relative;
}

/* Vertical divider */
.container::after {
  content: '';
  position: absolute;
  height: 120px;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--color-1), transparent);
  left: 50%;
  transform: translateX(-50%);
}

/* Section styling */
.section {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Button styling */
.button {
  /*background: linear-gradient(45deg, #2d9fff, #4f9eff);*/
  background: linear-gradient(45deg, var(--color-1), var(--color-3));
  border: none;
  border-radius: 30px;
  color: var(--white);
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-weight: bold;
  font-size: 1.1rem;
  padding: 0.8rem 2rem;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px var(--color-1-dark);
}

.button.disabled {
    background: var(--grey);
}

.button.disabled:hover {
  transform: none;
  box-shadow: none;
}

.button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px var(--color-1-dark-2);
}

.button:active {
  transform: translateY(1px);
}

.big-margin-top {
    margin-top: 4rem;
}

.small-margin-top {
    margin-top: 1rem;
}

/* Logout */
.logout {
    position: absolute;
    right: 15px;
    top: 5px;
}

.logout a {
    color: red;
}

/* Join game section */
.join-game {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Input styling */
input, select {
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--color-1);
  border-radius: 30px;
  color: var(--white);
  font-family: 'Poppins', sans-serif;
  font-size: 1.1rem;
  padding: 0.8rem 1.5rem;
  text-align: center;
  width: 100%;
  max-width: 200px;
  transition: all 0.3s ease;
  outline: none;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

input:focus {
  background-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 15px var(--color-1-dark);
}

input.create-game {
  max-width: 100px;
}

input.error {
    border: 2px solid red;
    background-color: darkred;
}

select {
  max-width: 250px;
}

/* How to play section */
.how-to-play {
    margin-top: 4rem;
    max-width: 600px;
    background-color: rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 20px;
    border: 2px solid var(--color-1);
}

.how-to-play h3 {
    color: var(--color-2);
    margin-bottom: 1rem;
}

.how-to-play p {
    color: var(--white-2);
    line-height: 1.6;
}

/* Search tune modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
}

.modal-content {
    background-color: var(--color-1-dark-2);
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    background-color: var(--color-1-dark);
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
}

.close {
    color: var(--white-2);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
}

.modal-body {
    padding: 20px;
}

/* Search result styles */
.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #eee;
    margin-bottom: 8px;
}

.search-result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.track-info {
    flex: 1;
}

.track-name {
    color: var(--white-2);
    font-weight: bold;
    margin-bottom: 4px;
}

.artist-name {
    color: var(--white-2);
    font-size: 0.9em;
}

.add-button {
    background-color: var(--color-2);
    color: var(--black);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    min-width: 40px;
}

.fa-trash-can {
    color: red;
    cursor: pointer;
}

.fa-down-long {
    cursor: pointer;
}

.fa-up-long {
    cursor: pointer;
}


/* GAME STYLING */

/* TODO: move combined to game-status */
.game-status-connected {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 3px;
    background-color: darkgreen;
    transition: height 0.3s ease-out;
}

.game-status-connected.hiding {
    height: 0;
}

.game-status-disconnected {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 30px;
    background-color: red;
    padding-top: 5px;
    font-size: 10pt;
}

.game-status-disconnected > a {
    cursor: pointer;
    text-decoration: underline;
}

/* Media query for mobile devices */
@media (max-width: 768px) {
  h1 {
    font-size: 3.5rem;
  }

  .container {
    flex-direction: column;
    gap: 2rem;
  }

  .container::after {
    height: 2px;
    width: 80%;
    left: 50%;
    top: calc(50% - 30px);
    transform: translate(-50%, -50%);
    background: linear-gradient(to right, transparent, var(--color-1), transparent);
  }

  /* Add more spacing between sections on mobile */
  .section {
    padding: 1.5rem;
  }

  /* Add more space for the join game section */
  .join-game {
    margin-top: 1rem;
  }
}
