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

html {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  line-height: 1.5;
}

body {
  min-height: 100vh;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* CSS Variables */
:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --primary: 221.2 83.2% 53.3%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96%;
  --secondary-foreground: 222.2 84% 4.9%;
  --muted: 210 40% 96%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 221.2 83.2% 53.3%;
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: hsla(var(--background), 0.8);
  backdrop-filter: blur(8px);
}

header .header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}

header .logo {
  font-weight: 600;
  letter-spacing: -0.025em;
  text-decoration: none;
  color: inherit;
  margin-left: 1.5rem;
}

nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: #000000;
  margin-right: 1.5rem;
}

nav a {
  text-decoration: none;
  color: inherit;
  transition: color 0.15s ease;
}

nav a:hover {
  color: #333333;
}

/* Hero Section */
.gradient-hero {
  background: linear-gradient(135deg, #667eea 0%, #4982d8 100%);
  color: white;
  text-align: center;
  padding: 1rem 0;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  opacity: 0.9;
}

.hero-info-box {
  background-color: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
  max-width: 48rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-info-grid {
  display: grid;
  gap: 1rem;
  font-size: 0.875rem;
}

.hero-info-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.hero-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  padding: 0.75rem 2rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
}

.btn-disabled {
  background-color: #9ca3af;
  color: #f3f4f6;
  cursor: not-allowed;
}

.btn-outline {
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  background: transparent;
}

.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.btn-icon {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.5rem;
}

/* Sections */
section {
  padding: 1.5rem 0;
}

.section-large {
  padding: 2.5rem 0;
}

.section-title {
  font-size: 1.875rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
}

.section-bg-muted {
  background-color: hsla(var(--muted), 0.3);
}

/* Tabs */
.tabs-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.tabs-wrapper {
  display: flex;
  background-color: #f3f4f6;
  border-radius: 0.5rem;
  padding: 0.25rem;
}

.tab-btn, .gironi-tab-btn {
  padding: 0.5rem 1.5rem;
  border-radius: 0.375rem;
  transition: all 0.15s ease;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #4b5563;
}

.tab-btn.active, .gironi-tab-btn.active {
  background-color: hsl(var(--primary));
  color: white;
}

.gironi-tabs-wrapper {
  background-color: #eff6ff;
}

.gironi-tab-btn {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  color: #2563eb;
}

/* Tab Content */
.tab-content, .gironi-tab-content {
  display: none;
}

.tab-content.active, .gironi-tab-content.active {
  display: block;
}

/* Schedule Cards */
.schedule-container {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.schedule-card {
  border-radius: 0.5rem;
  padding: 1.5rem;
  border-left: 4px solid;
}

.schedule-card-green {
  background-color: #f0fdf4;
  border-left-color: #4ade80;
}

.schedule-card-blue {
  background-color: #eff6ff;
  border-left-color: #3b82f6;
}

.schedule-card-purple {
  background-color: #faf5ff;
  border-left-color: #a855f7;
}

.schedule-card-yellow {
  background-color: #fefce8;
  border-left-color: #eab308;
}

.schedule-card h3 {
  font-weight: 700;
  font-size: 1.125rem;
  margin-bottom: 0.5rem;
}

.schedule-card-green h3 { color: #166534; }
.schedule-card-blue h3 { color: #1e40af; }
.schedule-card-purple h3 { color: #7c2d12; }
.schedule-card-yellow h3 { color: #a16207; }

.schedule-card ul {
  list-style-type: disc;
  margin-left: 1.25rem;
}

.schedule-card-green ul { color: #15803d; }
.schedule-card-blue ul { color: #1d4ed8; }
.schedule-card-purple ul { color: #7c2d12; }
.schedule-card-yellow ul { color: #a16207; }

/* Players Grid */
.players-count {
  text-align: center;
  margin-bottom: 1.5rem;
}

.players-count h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: hsl(var(--primary));
}

.players-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.player-card {
  background-color: white;
  color: #374151;
  padding: 1.5rem;
  border-radius: 0.5rem;
  text-align: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
}

.player-card .team-name {
  font-weight: 600;
  font-size: 1.125rem;
}

/* Gironi */
.gironi-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.gironi-card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gironi-card h4 {
  font-weight: 700;
  color: hsl(var(--primary));
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

.gironi-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.gironi-card li {
  text-align: center;
  padding: 0.5rem;
  background-color: #f9fafb;
  border-radius: 0.25rem;
  font-size: 0.875rem;
}

/* Risultati Gironi */
.risultati-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.risultati-day {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.risultati-day h4 {
  font-weight: 700;
  color: hsl(var(--primary));
  font-size: 1.25rem;
  margin-bottom: 1rem;
  text-align: center;
}

.risultati-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.risultati-girone {
  background-color: #f9fafb;
  border-radius: 0.5rem;
  padding: 1rem;
}

.risultati-girone h5 {
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.75rem;
  text-align: center;
}

.match-card {
  text-align: center;
  font-size: 0.875rem;
  padding: 0.5rem;
  background-color: white;
  border-radius: 0.25rem;
  border: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
}

.match-name {
  font-weight: 500;
}

.match-score {
  font-size: 0.75rem;
  color: #4b5563;
  margin-top: 0.25rem;
}

.match-winner {
  font-size: 0.75rem;
  color: #059669;
  font-weight: 600;
}

.score-winner {
  font-weight: 700;
  color: #059669;
}

/* Classifiche */
.classifiche-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.classifica-card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.classifica-card h4 {
  font-weight: 700;
  color: hsl(var(--primary));
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  text-align: center;
}

.classifica-table {
  width: 100%;
  font-size: 0.875rem;
  overflow-x: auto;
}

.classifica-table th {
  text-align: left;
  padding: 0.5rem;
  background-color: #f9fafb;
}

.classifica-table td {
  padding: 0.5rem;
  border-top: 1px solid #e5e7eb;
}

.classifica-table tr.first-place {
  background-color: #f0fdf4;
}

.classifica-table tr.second-place {
  background-color: #eff6ff;
}

.classifica-table .pos {
  font-weight: 600;
}

.classifica-table .team {
  font-weight: 500;
}

.classifica-table .points {
  font-weight: 700;
  text-align: center;
}

.classifica-table .center {
  text-align: center;
}

/* Bracket */
.bracket-container {
  overflow-x: auto;
}

.bracket {
  display: flex;
  justify-content: space-between;
  min-width: 800px;
  gap: 20px;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  min-height: 400px;
}

.bracket-round h3 {
  text-align: center;
  margin-bottom: 1rem;
  color: hsl(var(--primary));
  font-weight: 600;
}

.bracket-match {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  margin: 5px 0;
  padding: 8px;
  min-width: 150px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.bracket-match.winner {
  border-color: #0d6bb7;
  background: #ffffff;
}

.bracket-team {
  padding: 6px 8px;
  margin: 2px 0;
  background: #f9fafb;
  border-radius: 4px;
  font-size: 0.8em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bracket-team.winner {
  background: #0d6bb7;
  color: white;
  font-weight: 600;
}

/* Regolamento */
.regolamento-card {
  background-color: hsl(var(--card));
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--border));
  padding: 1.5rem;
}

.regolamento-intro {
  color: hsl(var(--muted-foreground));
  font-style: italic;
  margin-bottom: 1.5rem;
}

.regolamento-content ol {
  list-style-type: decimal;
  margin-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.regolamento-content ol ol {
  margin-top: 0.5rem;
  gap: 0.25rem;
}

.regolamento-content ul {
  list-style-type: disc;
  margin-left: 1.25rem;
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.regolamento-content strong {
  font-weight: 700;
}

/* Footer */
footer {
  border-top: 1px solid hsl(var(--border));
  padding: 2rem 0;
  background-color: hsla(var(--muted), 0.5);
  text-align: center;
}

footer .footer-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
}

footer .footer-copyright {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* Slideshow Styles */
.slideshow-container {
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  background: #f8f9fa;
  position: relative;
}

.slideshow-track {
  display: flex;
  animation: slideshow 60s linear infinite;
  will-change: transform;
}

.slideshow-item {
  flex: 0 0 300px;
  height: 200px;
  margin-right: 16px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInSlide 0.6s ease-out forwards;
  cursor: pointer; /* Aggiungi questo */
}

.slideshow-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.slideshow-item:hover img {
  transform: scale(1.05);
}

/* Animazione di scorrimento infinito */
@keyframes slideshow {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(-300px * 21 - 16px * 21));
  }
}

/* Animazione di fade in per le foto */
@keyframes fadeInSlide {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Lightbox Styles */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.lightbox-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: bold;
  color: #333;
  transition: background 0.2s ease;
}

.lightbox-close:hover {
  background: #fff;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  transition: background 0.2s ease, opacity 0.2s ease;
  opacity: 0.8;
}

.lightbox-nav:hover {
  background: #fff;
  opacity: 1;
}

.lightbox-nav.prev {
  left: -70px;
}

.lightbox-nav.next {
  right: -70px;
}

.lightbox-counter {
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  color: #333;
}

/* Mobile adjustments for lightbox */
@media (max-width: 768px) {
  .lightbox-close {
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
    font-size: 18px;
  }

  .lightbox-nav {
    width: 45px;
    height: 45px;
    font-size: 16px;
  }

  .lightbox-nav.prev {
    left: 10px;
  }

  .lightbox-nav.next {
    right: 10px;
  }

  .lightbox-counter {
    bottom: 10px;
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .slideshow-item {
    flex: 0 0 250px;
    height: 167px;
  }
  
  @keyframes slideshow {
    0% {
      transform: translateX(0);
    }
    100% {
      transform: translateX(calc(-250px * 21 - 16px * 21));
    }
  }
}

@media (max-width: 480px) {
  .slideshow-item {
    flex: 0 0 200px;
    height: 133px;
  }
  
  @keyframes slideshow {
    0% {
      transform: translateX(0);
    }
    100% {
      transform: translateX(calc(-200px * 21 - 16px * 21));
    }
  }
}

@media (min-width: 640px) {
  .hero-buttons {
    flex-direction: row;
  }
  
  .hero-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .hero-info-item {
    font-size: 1rem;
  }
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.75rem;
  }
  
  .hero-subtitle {
    font-size: 1.5rem;
  }
  
  section {
    padding: 2.5rem 0;
  }
  
  .section-large {
    padding: 3.5rem 0;
  }
  
  .players-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .gironi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .risultati-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .classifiche-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .players-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .gironi-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .risultati-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 639px) {
  .container {
    padding: 0 1rem;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1.125rem;
  }
  
  .tabs-wrapper {
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: center;
  }
  
  .tab-btn, .gironi-tab-btn {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }
}

@media (max-width: 398px) {
  .tabs-wrapper {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
  }
  
  .tabs-container {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  
  .tab-btn, .gironi-tab-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
    flex: 0 0 auto;
  }
}
