/* Reset e stili di base */
:root {
  --primary: #4361ee;
  --primary-dark: #3a56d4;
  --secondary: #7209b7;
  --accent: #f72585;
  --success: #4cc9f0;
  --warning: #f9c74f;
  --danger: #f94144;
  --light: #f8f9fa;
  --dark: #212529;
  --gray: #6c757d;
  --gray-light: #e9ecef;
  --gray-dark: #343a40;
  --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: all 0.3s ease;
  --font-main: 'Poppins', 'Inter', 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  --font-heading: 'Poppins', 'Inter', sans-serif;
  --font-body: 'Inter', 'Roboto', sans-serif;
}

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

html {
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: #f5f7fa;
  color: var(--dark);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Tipografia */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.5rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
}

p {
  margin-bottom: 1rem;
}

/* Card e contenitori */
.card {
  background-color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: var(--transition);
  overflow: hidden;
  position: relative;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gray-light);
}

/* Pulsanti */
.btn {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  margin: 0.75rem 0;
  text-align: center;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-100%);
  transition: var(--transition);
  z-index: -1;
}

.btn:hover::before {
  transform: translateX(0);
}

.btn-primary {
  background: var(--gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

.btn-secondary {
  background-color: var(--gray);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.btn-secondary:hover {
  background-color: var(--gray-dark);
  box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.btn-danger {
  background-color: var(--danger);
  color: white;
  box-shadow: 0 4px 15px rgba(249, 65, 68, 0.3);
}

.btn-danger:hover {
  background-color: #e63946;
  box-shadow: 0 6px 20px rgba(249, 65, 68, 0.4);
}

.btn-success {
  background-color: #2ecc71;
  color: white;
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-success:hover {
  background-color: #27ae60;
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.4);
}

.btn-accent {
  background-color: var(--accent);
  color: white;
  box-shadow: 0 4px 15px rgba(247, 37, 133, 0.3);
}

.btn-accent:hover {
  background-color: #e91e78;
  box-shadow: 0 6px 20px rgba(247, 37, 133, 0.4);
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
  padding: 2rem 1rem;
  background-color: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background: var(--gradient);
}

header h1 {
  margin-bottom: 0.5rem;
}

header p {
  color: var(--gray);
  font-size: 1.2rem;
}

/* Welcome message */
.welcome-message {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  color: var(--gray);
  font-weight: 500;
}

/* Main menu */
.main-menu {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

/* Quick start section */
.quick-start {
  margin-top: 2rem;
}

.quick-start h2 {
  font-size: 1.8rem;
  color: var(--secondary);
  margin-bottom: 1rem;
  position: relative;
  padding-left: 1rem;
}

.quick-start h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--gradient);
  border-radius: 2px;
}

/* Recent matches */
.recent-matches {
  margin-top: 2rem;
}

.recent-matches h2 {
  font-size: 1.8rem;
  color: var(--secondary);
  margin-bottom: 1rem;
  position: relative;
  padding-left: 1rem;
}

.recent-matches h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 4px;
  background: var(--gradient);
  border-radius: 2px;
}

.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.match-card {
  background-color: white;
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  text-decoration: none;
  color: var(--dark);
  border: 1px solid var(--gray-light);
  display: flex;
  flex-direction: column;
}

.match-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.match-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

.match-card p {
  font-size: 0.95rem;
  color: var(--gray);
  margin-bottom: 0.5rem;
}

.match-card .match-date {
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--gray);
  padding-top: 0.75rem;
  border-top: 1px dashed var(--gray-light);
}

/* No matches message */
.no-matches {
  color: var(--gray);
  font-style: italic;
  margin-top: 1rem;
  text-align: center;
  padding: 2rem;
  background-color: var(--gray-light);
  border-radius: var(--radius-sm);
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--gray);
  font-size: 0.9rem;
  margin-top: 3rem;
}

/* Responsive design */
@media (min-width: 768px) {
  .main-menu {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 767px) {
  html {
    font-size: 14px;
  }
  
  .container {
    padding: 1rem;
  }
  
  header {
    padding: 1.5rem 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
}

/* Statistiche page styles */
.filters {
  background-color: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

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

.filter-group {
  margin-bottom: 1rem;
}

.filter-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--gray-dark);
  font-size: 1.1rem;
}

.filter-group select,
.filter-group input {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--gray-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 1.1rem;
  transition: var(--transition);
  height: auto;
  min-height: 3.2rem;
}

.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.stats-summary {
  margin-bottom: 2.5rem;
}

.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background-color: white;
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: var(--transition);
  border: 1px solid var(--gray-light);
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
}

.stat-card h3 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.25rem;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: bold;
  margin: 0.5rem 0;
}

.stat-detail {
  font-size: 0.9rem;
  color: var(--gray);
}

.stat-card h3 {
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  color: var(--gray);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: bold;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0.5rem;
  word-break: break-word;
  overflow-wrap: break-word;
}

.stat-detail {
  font-size: 0.9rem;
  color: var(--gray);
}

.chart-container {
  background-color: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.chart-container h3 {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  color: var(--secondary);
  text-align: center;
  position: relative;
}

.chart-container h3::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background: var(--gradient);
  border-radius: 3px;
}

.game-stats {
  margin-top: 2.5rem;
}

.game-stat-card {
  background-color: white;
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid var(--gray-light);
}

.game-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.game-stat-card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.game-stat-card p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  white-space: normal;
  overflow: visible;
  color: var(--gray);
  padding: 0 0.25rem;
}

.back-link {
  margin-top: 2rem;
  text-align: center;
}

.back-link a {
  display: inline-block;
  margin: 0 0.75rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.back-link a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient);
  transition: var(--transition);
}

.back-link a:hover {
  color: var(--secondary);
}

.back-link a:hover::after {
  width: 100%;
}

/* Error message */
.error-message {
  background-color: #fff5f5;
  color: var(--danger);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--danger);
  font-weight: 500;
}

/* Loader */
.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100px;
}

.loader::after {
  content: '';
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Animazioni */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.card, .match-card, .stat-card, .game-stat-card {
  animation: fadeIn 0.5s ease forwards;
}

/* Temi */
.default-theme {
  /* Default theme colors are already set */
}

.dark-theme {
  --primary: #4cc9f0;
  --primary-dark: #3bb4d8;
  --secondary: #f72585;
  --accent: #7209b7;
  --light: #e9ecef;
  --dark: #f8f9fa;
  --gray: #adb5bd;
  --gray-light: #495057;
  --gray-dark: #dee2e6;
  --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  
  background-color: #121212;
  color: var(--light);
}

.dark-theme header,
.dark-theme .card,
.dark-theme .match-card,
.dark-theme .stat-card,
.dark-theme .game-stat-card,
.dark-theme .chart-container,
.dark-theme .filters {
  background-color: #1e1e1e;
  border-color: #333;
}

.dark-theme .no-matches {
  background-color: #333;
}

.dark-theme .filter-group select,
.dark-theme .filter-group input {
  background-color: #333;
  border-color: #444;
  color: var(--light);
}

/* Installazione PWA */
.install-prompt {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 90%;
  width: 400px;
  z-index: 1000;
  animation: slideUp 0.3s ease forwards;
}

.install-prompt p {
  margin: 0;
  margin-right: 1rem;
}

.install-actions {
  display: flex;
  gap: 0.5rem;
}

.install-actions button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.install-actions .install-yes {
  background-color: var(--primary);
  color: white;
}

.install-actions .install-no {
  background-color: var(--gray-light);
  color: var(--gray-dark);
}

@keyframes slideUp {
  from { transform: translate(-50%, 100%); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Offline indicator */
.offline-indicator {
  position: fixed;
  top: 10px;
  right: 10px;
  background-color: var(--danger);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  z-index: 1000;
  box-shadow: var(--shadow);
  animation: fadeIn 0.3s ease forwards;
}

/* Splash screen */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--primary);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.splash-logo {
  width: 120px;
  height: 120px;
  margin-bottom: 2rem;
  animation: pulse 1.5s infinite;
}

.splash-title {
  font-size: 2.5rem;
  color: white;
  margin-bottom: 1rem;
}

.splash-subtitle {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}