/* Ensure the html and body elements take up the full height */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* Base styles - Mobile First */
body {
  font-family: Arial, sans-serif;
  text-align: center;
  padding: 8px;
  background-color: #1a1a2e;
  background-image: 
    linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)),
    url(https://img.freepik.com/free-photo/empty-soccer-stadium-with-dreamy-fantasy-view-sky_23-2151563107.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  height: 100%;
  font-size: 14px;
  overflow-x: hidden;
}

h1 {
  color: #f1eaea;
  font-size: 20px;
  margin: 8px 0;
  word-wrap: break-word;
}

h2 {
  font-size: 16px;
  margin: 6px 0;
  word-wrap: break-word;
}

/* Input Section Styling */
#input-section {
  margin: 10px auto;
  padding: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  width: 96%;
  max-width: 600px;
  box-sizing: border-box;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

/* League Management Section */
#league-management {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
}

#league-management select,
#league-management button {
  padding: 10px;
  margin: 3px;
  font-size: 14px;
  border-radius: 5px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  min-width: 140px;
  max-width: 200px;
  width: 100%;
  box-sizing: border-box;
  color: #0056b3;
}

/* Current Winner Section */
#current-winner {
  width: 96%;
  max-width: 600px;
  margin: 12px auto;
  text-align: center;
}

/* Leaderboard Styling */
#leaderboard {
  width: 96%;
  max-width: 600px;
  margin: 12px auto;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Head-to-Head Section Styling */
#head-to-head-section,
#overall-head-to-head-section {
  width: 96%;
  max-width: 800px;
  margin: 12px auto;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  backdrop-filter: blur(10px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  overflow-x: auto;
}

#head-to-head-section h2,
#overall-head-to-head-section h2 {
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: #ffffff;
  background: linear-gradient(90deg, #ff416c, #ff4b2b);
  padding: 8px;
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  word-wrap: break-word;
}

#leaderboard h2 {
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: #ffffff;
  background: linear-gradient(90deg, #ff416c, #ff4b2b);
  padding: 8px;
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  word-wrap: break-word;
}

#leaderboard-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

#leaderboard-list li {
  background: rgba(255, 255, 255, 0.3);
  margin: 6px 0;
  padding: 10px;
  font-size: 14px;
  font-weight: bold;
  color: #fff;
  border-radius: 5px;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
  word-wrap: break-word;
}

/* Hover Effect */
#leaderboard-list li:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Trophy Icon for Winners */
#leaderboard-list li::before {
  content: "🏆";
  font-size: 20px;
  margin-right: 10px;
}

/* Box Flex Layout */
.box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.box1 {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.team {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  width: 100%;
}

.team label {
  font-weight: bold;
  color: #333;
  font-size: 14px;
  margin-bottom: 4px;
}

#team1,
#team2,
#team1-score,
#team2-score {
  width: 100%;
  max-width: 180px;
  padding: 10px;
  font-size: 14px;
  border-radius: 5px;
  border: 2px solid #ddd;
  outline: none;
  transition: background-color 0.3s ease, transform 0.3s ease;
  box-sizing: border-box;
}

#team1:focus,
#team2:focus,
#team1-score:focus,
#team2-score:focus {
  background-color: #e9f7fe;
  border: 2px solid #007bff;
  transform: scale(1.02);
}

#team1:hover,
#team2:hover,
#team1-score:hover,
#team2-score:hover {
  background-color: #f0f8ff;
}

/* Button Container */
.button-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  width: 100%;
}

/* Button Styling */
button {
  padding: 10px 16px;
  background: #007bff;
  border: none;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: bold;
  margin: 4px;
  min-width: 110px;
  max-width: 200px;
  width: auto;
  box-sizing: border-box;
  word-wrap: break-word;
}

button:hover {
  background: #0056b3;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Match History Section */
#match-history {
  display: none;
  background: rgba(255, 255, 255, 0.95);
  padding: 12px;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  margin: 12px auto;
  width: 96%;
  max-width: 600px;
  overflow-x: auto;
  backdrop-filter: blur(10px);
}

#match-history table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 300px;
}

#match-history th,
#match-history td {
  border: 1px solid #ddd;
  padding: 6px;
  text-align: center;
  white-space: nowrap;
}

/* League Table Styling */
#league-table {
  width: 96%;
  max-width: 900px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.95);
  text-align: left;
  overflow-x: auto;
  box-shadow: 0px 8px 32px rgba(0, 0, 0, 0.3);
  margin: 12px auto;
  font-size: 12px;
  display: block;
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

#league-table thead,
#league-table tbody {
  display: table;
  width: 100%;
  min-width: 600px;
}

#league-table th,
#league-table td {
  border: 1px solid #ddd;
  padding: 6px;
  white-space: nowrap;
  text-align: center;
}

.club {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.club img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

/* Form circles */
.form-circle {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 1px;
}

.form-win {
  background-color: #28a745;
}

.form-draw {
  background-color: #ffc107;
}

.form-loss {
  background-color: #dc3545;
}

/* Responsive Design - Tablet */
@media (min-width: 768px) {
  body {
    padding: 15px;
    font-size: 16px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  #input-section {
    width: 90%;
    padding: 20px;
  }

  #league-management {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  #league-management select,
  #league-management button {
    min-width: 150px;
    max-width: none;
    width: auto;
  }

  .box {
    flex-direction: row;
    justify-content: space-around;
    gap: 20px;
  }

  .box1 {
    flex-direction: row;
    gap: 15px;
  }

  .team {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  #team1,
  #team2,
  #team1-score,
  #team2-score {
    width: auto;
    min-width: 120px;
    max-width: none;
  }

  #league-table {
    font-size: 14px;
    display: table;
  }

  #league-table thead,
  #league-table tbody {
    display: table-row-group;
    min-width: auto;
  }

  #league-table th,
  #league-table td {
    padding: 10px;
  }

  .club img {
    width: 22px;
    height: 22px;
  }

  .form-circle {
    width: 12px;
    height: 12px;
  }

  #match-history {
    font-size: 14px;
  }

  #match-history th,
  #match-history td {
    padding: 10px;
  }

  .button-container {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }

  button {
    padding: 12px 20px;
    font-size: 16px;
    min-width: 130px;
  }

  #head-to-head-section h2,
  #overall-head-to-head-section h2,
  #leaderboard h2 {
    font-size: 18px;
    padding: 10px;
  }
}

/* Responsive Design - Desktop */
@media (min-width: 1024px) {
  body {
    padding: 20px;
  }

  h1 {
    font-size: 32px;
  }

  h2 {
    font-size: 24px;
  }

  #input-section {
    max-width: 800px;
  }

  #league-table {
    max-width: 1200px;
    font-size: 16px;
  }

  #league-table th,
  #league-table td {
    padding: 12px;
  }

  .club img {
    width: 25px;
    height: 25px;
  }

  #head-to-head-section,
  #overall-head-to-head-section {
    max-width: 1000px;
  }

  .button-container {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
  }

  button {
    padding: 14px 24px;
    font-size: 16px;
    min-width: 150px;
  }

  #head-to-head-section h2,
  #overall-head-to-head-section h2,
  #leaderboard h2 {
    font-size: 20px;
    padding: 12px;
  }
}

/* Extra Small Mobile Devices */
@media (max-width: 360px) {
  body {
    padding: 5px;
    font-size: 12px;
  }

  h1 {
    font-size: 18px;
  }

  h2 {
    font-size: 14px;
  }

  #input-section {
    width: 98%;
    padding: 8px;
  }

  .button-container {
    gap: 6px;
  }

  button {
    padding: 8px 12px;
    font-size: 12px;
    min-width: 90px;
    margin: 2px;
  }

  #league-management select,
  #league-management button {
    padding: 8px;
    font-size: 12px;
    min-width: 100px;
  }

  .club img {
    width: 15px;
    height: 15px;
  }

  .form-circle {
    width: 8px;
    height: 8px;
  }

  #league-table {
    font-size: 10px;
  }

  #league-table th,
  #league-table td {
    padding: 4px;
  }

  #match-history th,
  #match-history td {
    padding: 4px;
    font-size: 10px;
  }
}
