/* GRUNDLÄGGANDE LAYOUT */
body {
  font-family: sans-serif;
  background: linear-gradient(to bottom right, #e8f4f8, #ffffff);
  margin: 0;
  padding: 0;
  color: #222;
  opacity: 0; /* Start with body hidden for fade-in */
  animation: fadeIn 1s ease-out forwards; /* Page load animation */
}

.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 1rem;
  text-align: center;
  position: relative;
  padding-bottom: 1rem;
}

.flytta-hoger {
  margin-left: 4rem;
}

.container img {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 160px;
  height: auto;
  opacity: 0;
  animation: slideInUp 0.8s ease-out 0.2s forwards; /* Logo slide-in */
}

h1 {
  margin-top: 1rem;
  margin-bottom: 2rem;
  font-size: 3rem;
  color: #344659;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out 0.4s forwards; /* Header fade-in */
}

h1 span {
  color: #0077cc;
}

.menu {
  margin-top: 8rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  display: flex;
  align-items: center;
  padding: 1rem;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background-color: #f5f5f5;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.card:hover {
  transform: translateY(-5px) scale(1.02); /* Enhanced hover effect */
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  background-color: #ffffff;
}

.animate-card {
  opacity: 0;
  transform: translateY(30px);
  animation: slideInUp 0.6s ease-out forwards;
}

.animate-card:nth-child(1) { animation-delay: 0.6s; }
.animate-card:nth-child(2) { animation-delay: 0.8s; }
.animate-card:nth-child(3) { animation-delay: 1.0s; }
.animate-card:nth-child(4) { animation-delay: 1.2s; }

.icon {
  font-size: 2rem;
  margin-right: 1rem;
  transition: transform 0.3s ease; /* Icon hover animation */
}

.card:hover .icon {
  transform: scale(1.2); /* Icon scales on card hover */
}

.green { border-left: 6px solid #007bff; }
.gold  { border-left: 6px solid #ffcc00; }
.purple { border-left: 6px solid #9c27b0; } /* New tournament card color */
.blue  { border-left: 6px solid #28a745; }

.course-info {
  background-color: #c6e1ff;
  border-left: 4px solid #007bff;
  padding: 1rem;
  margin-top: 2rem;
  text-align: left;
  border-radius: 10px;
}

/* SYMMETRICAL CHECKBOX LAYOUT */
#player-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
  margin: 2rem 0;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

#player-list > div {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.8rem 1rem;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
}

#player-list > div:hover {
  border-color: #007bff;
  background-color: #f8f9ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

#player-list label {
  display: flex;
  align-items: center;
  cursor: pointer;
  width: 100%;
  font-size: 1rem;
  font-weight: 500;
  color: #2c3e50;
  margin: 0;
}

#player-list input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 0.8rem;
  cursor: pointer;
  accent-color: #007bff;
  border-radius: 4px;
}

#player-list input[type="checkbox"]:checked + span {
  color: #007bff;
  font-weight: 600;
}

/* Style for the status messages in player list */
#player-list .status-message {
  grid-column: 1 / -1;
  margin-bottom: 0.5rem;
}

input[type="text"] {
  padding: 0.5rem;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

button {
  padding: 0.5rem 1rem;
  margin-left: 0.5rem;
  border: none;
  background-color: #007bff;
  color: white;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
}

/* LEADERBOARD LAYOUT - Fixed for proper scrolling */
#leaderboard {
  margin-bottom: 2rem;
  width: 100%;
}

/* DESKTOP TABELL STYLING */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background-color: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
}

thead {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
}

th {
  padding: 1rem 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.8rem;
  text-align: center;
  border: none;
}

th:first-child {
  text-align: left;
  padding-left: 1.5rem;
  background-color: #28a745;
  color: white;
  font-size: 0.8rem;
  min-width: 80px;
  max-width: 80px;
}

th small {
  font-size: 0.65rem;
  font-weight: normal;
  opacity: 0.9;
}

tbody tr {
  transition: all 0.3s ease;
  border-bottom: 1px solid #e9ecef;
}

tbody tr:nth-child(even) {
  background-color: #f8f9fa;
}

tbody tr:nth-child(odd) {
  background-color: white;
}

tbody tr:hover {
  background-color: #e9f7ef;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

td {
  padding: 1rem 0.5rem;
  text-align: center;
  font-weight: 500;
  font-size: 0.9rem;
  color: #495057;
  border: none;
  border-bottom: 1px solid #e9ecef;
}

td:first-child {
  text-align: left;
  padding-left: 1.5rem;
  font-weight: 600;
  color: #2c3e50;
  background-color: #f1f8f4;
  border-right: 1px solid #e9ecef;
  min-width: 80px;
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* SNYGGA INPUT FÄLT */
input[type="number"] {
  width: 45px;
  padding: 0.5rem;
  font-size: 0.95rem;
  text-align: center;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  background-color: white;
  transition: all 0.3s ease;
  font-weight: 600;
}

input[type="number"]:focus {
  outline: none;
  border-color: #28a745;
  background-color: white;
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.1);
  transform: scale(1.05);
}

input[type="number"]:hover {
  border-color: #adb5bd;
  background-color: #f8f9fa;
}

.total-score {
  font-weight: bold;
  font-size: 1rem;
  background-color: #f8f9fa !important;
  border-left: 2px solid #28a745;
  min-width: 50px;
}

/* MOBILANPASSAD SCORE LAYOUT */
.mobile-score-layout {
  display: none;
}

.mobile-player-card {
  background-color: white;
  border-radius: 12px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.mobile-player-header {
  background-color: #28a745;
  color: white;
  padding: 1rem;
  font-weight: bold;
  font-size: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mobile-total-score {
  font-size: 1.2rem;
  font-weight: bold;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
}

.mobile-holes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 1rem;
}

.mobile-hole-input {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #f8f9fa;
  padding: 0.8rem;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.mobile-hole-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #495057;
  margin-bottom: 0.3rem;
  text-align: center;
}

.mobile-hole-par {
  font-size: 0.65rem;
  color: #6c757d;
  margin-bottom: 0.5rem;
}

.mobile-hole-input input[type="number"] {
  width: 50px;
  height: 50px;
  font-size: 1.1rem;
  font-weight: bold;
  text-align: center;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  background-color: white;
  transition: all 0.3s ease;
}

.mobile-hole-input input[type="number"]:focus {
  outline: none;
  border-color: #28a745;
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
  transform: scale(1.05);
}

/* MOBILANPASSAD LEADERBOARD */
.mobile-leaderboard {
  display: none;
}

.mobile-player-card {
  background-color: white;
  border-radius: 12px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.3s ease;
}

.mobile-player-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.mobile-player-rank {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
}

.mobile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  padding: 0;
}

.mobile-stat-item {
  padding: 1rem;
  text-align: center;
  border-right: 1px solid #e9ecef;
  background-color: #f8f9fa;
}

.mobile-stat-item:last-child {
  border-right: none;
}

.mobile-stat-item:nth-child(2) {
  background-color: white;
}

.mobile-stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.mobile-stat-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: #2c3e50;
}

.mobile-stat-value.best-score {
  color: #28a745;
}

.mobile-stat-value.avg-score {
  color: #007bff;
}

.mobile-stat-value.rounds {
  color: #6c757d;
}

/* STATUS MEDDELANDEN */
.status-message {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.status-online {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-offline {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

/* KNAPP STYLING - Fixed positioning */
.start-btn {
  display: inline-block;
  margin-top: 2rem;
  background: linear-gradient(135deg, #28a745, #20c997);
  font-size: 1.1rem;
  padding: 1rem 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
  transition: all 0.3s ease;
  text-decoration: none;
  color: white;
  font-weight: bold;
  text-align: center;
  position: relative;
  clear: both;
  margin-bottom: 2rem;
}

.start-btn:hover {
  background: linear-gradient(135deg, #218838, #1abc9c);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
  transform: translateY(-3px); /* Subtle lift on hover */
}

/* TOURNAMENT INFO STYLING */
.tournament-info {
  background-color: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  margin: 9rem 0;
  text-align: left;
  animation: fadeInUp 0.6s ease-out;
  color : #2e2c2c;
  ;

}

.tournament-info h2 {
  color: #9c27b0;
  margin-bottom: 1rem;
}

.tournament-info ul {
  margin: 1rem 0;
  color : #2e2c2c;
  padding-left: 2rem;
}

.tournament-history {
  margin-top: 3rem;
}

.year-section {
  background-color: white;
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  animation: fadeInUp 0.6s ease-out;
}

.year-section h3 {
  color: #9c27b0;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.tournament-categories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.category {
  padding: 1.5rem;
  background-color: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #9c27b0;
}

.category h4 {
  color: #2c3e50;
  margin-bottom: 1rem;
}

.winner {
  font-weight: bold;
  color: #28a745;
  margin-bottom: 0.5rem;
}

.runner-up {
  color: #6c757d;
  margin-bottom: 0.5rem;
}

.top-five {
  font-size: 0.9rem;
  color: #495057;
}

@media (max-width: 768px) {
  .tournament-categories {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .year-section {
    padding: 1rem;
  }
  
  .category {
    padding: 1rem;
  }
}

/* MOBILANPASSNING */
@media (max-width: 768px) {
  .container {
    padding: 0.5rem;
  }
  
  .container img {
    width: 110px;
    top: 0.25rem;
    left: 0.25rem;
  }
  
  h1 {
    font-size: 1.6rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
  }
  
  /* Mobile checkbox layout */
  #player-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.6rem;
    margin: 1.5rem 0;
  }
  
  #player-list > div {
    padding: 0.6rem 0.8rem;
  }
  
  #player-list label {
    font-size: 0.9rem;
  }
  
  #player-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.6rem;
  }
  
  /* Göm desktop tabell */
  table {
    display: none;
  }
  
  /* Visa mobil layout */
  .mobile-score-layout {
    display: block;
  }
  
  .mobile-leaderboard {
    display: block;
  }
  
  .mobile-player-header {
    padding: 0.8rem 1rem;
    font-size: 1rem;
  }
  
  .mobile-player-rank {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
  }
  
  .mobile-stats-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
  
  .mobile-stat-item {
    padding: 0.8rem;
  }
  
  .mobile-stat-label {
    font-size: 0.7rem;
  }
  
  .mobile-stat-value {
    font-size: 1.1rem;
  }
  
  .start-btn {
    width: calc(100% - 1rem);
    font-size: 1.2rem;
    padding: 1.2rem;
    margin-top: 2rem;
    margin-bottom: 2rem;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
  }
  
  #leaderboard {
    margin-bottom: 1rem;
  }
  
  .mobile-holes-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    padding: 0.8rem;
  }
  
  .mobile-hole-input {
    padding: 0.6rem;
  }
  
  .mobile-hole-input input[type="number"] {
    width: 45px;
    height: 45px;
    font-size: 1rem;
  }
}

/* EXTRA LITEN SKÄRM */
@media (max-width: 480px) {
  .container {
    padding: 0.3rem;
  }
  
  .container img {
    width: 100px;
  }
  
  h1 {
    font-size: 1.4rem;
    margin-top: 1.2rem;
  }
  
  #player-list {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin: 1rem 0;
  }
  
  #player-list > div {
    padding: 0.5rem 0.6rem;
  }
  
  #player-list label {
    font-size: 0.85rem;
  }
  
  #player-list input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: 0.5rem;
  }
  
  .mobile-player-header {
    padding: 0.7rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .mobile-stat-item {
    padding: 0.7rem 0.3rem;
  }
  
  .mobile-stat-label {
    font-size: 0.65rem;
  }
  
  .mobile-stat-value {
    font-size: 1rem;
  }
  
  .start-btn {
    width: calc(100% - 0.6rem);
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    font-size: 1.1rem;
  }
  
  .mobile-holes-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
    padding: 0.8rem;
  }
  
  .mobile-hole-input {
    padding: 0.6rem;
  }
  
  .mobile-hole-input input[type="number"] {
    width: 45px;
    height: 45px;
    font-size: 1rem;
  }
}

/* ANIMATIONER */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

table,
.mobile-leaderboard,
.mobile-score-layout {
  animation: fadeInUp 0.6s ease-out;
}

.mobile-player-card {
  animation: fadeInUp 0.6s ease-out;
}

/* LOADING STATE */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  font-size: 1.1rem;
  color: #6c757d;
}

.loading::after {
  content: "...";
  animation: dots 1.5s infinite;
}

@keyframes dots {
  0%, 20% { content: ""; }
  40% { content: "."; }
  60% { content: ".."; }
  80%, 100% { content: "..."; }
}