/* Updated Volleyball Tracker Theme (Mobile-first, modern UI) */

:root {
  --primary-color: #0047AB;
  --primary-hover: #003e8a;
  --secondary-color: #FFD700;
  --text-color: #333333;
  --background-color: #FFFFFF;
  --border-color: #ddd;
  --transition-speed: 0.3s;
}

/* Utility class to hide elements */
.hidden {
  display: none !important;
}

/* Global resets and typography */
html, body, div, span, h1, h2, h3, p, input, button, table, th, td {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: var(--background-color);
  font-family: 'Roboto', sans-serif;
  color: var(--text-color);
  padding-bottom: 70px; /* space for navbar */
}

/* Header */
.header {
  text-align: center;
  padding: 16px;
  background: var(--primary-color);
  color: var(--background-color);
  position: relative;
}
.header h2 {
  margin: 0;
  font-size: 1.8em;
}

/* Container for cards */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

/* Card component */
.card {
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
  animation: fadeIn 0.5s ease-in-out;
}

/* Fade-in animation */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Team Names and Score Board */
.team-names {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
  margin-bottom: 16px;
}
.team-names input {
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  width: 100%;
  max-width: 260px;
  transition: border-color var(--transition-speed) ease;
}
.team-names input:focus {
  outline: none;
  border-color: var(--primary-color);
}
.score-board {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.score-container {
  text-align: center;
}
.team-label {
  font-size: 20px;
  margin-bottom: 10px;
  font-weight: 500;
}
.score {
  font-size: 52px;
  font-weight: 700;
  background: var(--secondary-color);
  padding: 20px;
  width: 110px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
}

/* Score Buttons (Round) */
.score-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}
.round-btn {
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--primary-color);
  color: var(--background-color);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform var(--transition-speed) ease;
}
.round-btn:active {
  transform: scale(0.95);
}

/* Info Display */
.info-display {
  text-align: center;
  font-size: 16px;
  margin-top: 8px;
}

/* Console Input */
.console-container {
  text-align: center;
  margin-bottom: 16px;
}
.console-container input {
  width: 80%;
  max-width: 400px;
  padding: 10px;
  font-size: 16px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

/* Autocomplete suggestion area */
#autocompleteContainer {
  color: #888;
  font-size: 14px;
  margin-top: 5px;
  height: 18px;
}

/* Chart Section */
.chart-toggle-btn {
  margin: 10px auto;
  padding: 10px 20px;
  background: var(--primary-color);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--background-color);
  cursor: pointer;
  transition: background var(--transition-speed) ease;
  display: block;
}
.chart-toggle-btn:hover {
  background: var(--primary-hover);
}
.chart-section {
  display: none;
}
.chart-container {
  position: relative;
  height: 320px;
  margin: 20px auto;
  padding: 10px;
  background: var(--background-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-width: 100%;
}
#chartLegend {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
#chartLegend span {
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 100px;
  text-align: center;
}
#chartLegend span.active {
  border-color: #333;
  background: #e0e0e0;
}
#chartLegend span span {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  vertical-align: middle;
}

/* Player Upload */
.player-upload input[type="file"] {
  margin: 10px auto;
}
#teamARoster {
  margin-top: 10px;
}

/* Player Manager */
#playerManagerList {
  margin-top: 10px;
}
.player-item {
  padding: 10px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
}
.player-item:last-child {
  border-bottom: none;
}
.player-number, .player-name, .player-pos {
  font-size: 16px;
}

/* Timeline / Notes */
.timeline {
  margin: 20px auto;
  padding-left: 40px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--background-color);
  max-width: 100%;
  text-align: left;
}
.note {
  margin-bottom: 20px;
  position: relative;
}
.note::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 10px;
  width: 10px;
  height: 10px;
  background: var(--background-color);
  border: 2px solid var(--primary-color);
  border-radius: 50%;
  z-index: 1;
}
.note-content {
  margin-left: 20px;
  border: 1px solid var(--primary-color);
  padding: 10px;
  border-radius: 4px;
  background: #f9f9f9;
}

/* Event Log */
.event-log-container {
  margin: 20px auto;
  padding: 10px;
  border: 1px solid var(--border-color);
  background: var(--background-color);
  border-radius: 4px;
  max-width: 100%;
  text-align: left;
}
.event-log-buttons {
  text-align: center;
  margin-bottom: 10px;
}
.event-log-container button {
  padding: 8px 16px;
  background: var(--primary-color);
  color: var(--background-color);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition-speed) ease;
  margin: 0 10px;
  min-width: 130px;
}
.event-log-container button:hover {
  background: var(--primary-hover);
}
.event-log {
  max-height: 200px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 14px;
  margin-top: 10px;
  white-space: pre-wrap;
  padding: 5px;
}

/* Download Button */
#downloadStatsBtn {
  padding: 14px;
  background: var(--primary-color);
  border: none;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 500;
  color: var(--background-color);
  cursor: pointer;
  transition: background var(--transition-speed) ease;
  min-width: 180px;
  margin: 20px auto;
  display: block;
}
#downloadStatsBtn:hover {
  background: var(--primary-hover);
}

/* Floating Action Button (FAB) */
.fab-undo {
  position: fixed;
  bottom: 72px;
  right: 16px;
  background: linear-gradient(var(--primary-color), var(--secondary-color));
  color: var(--background-color);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: transform 0.3s ease;
}
.fab-undo:active {
  transform: scale(0.9);
}

/* Bottom Navbar */
.navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 56px;
  display: flex;
  justify-content: space-around;
  background: var(--background-color);
  box-shadow: 0 -1px 4px rgba(0,0,0,0.1);
}
.navbar-item {
  flex: 1;
  text-align: center;
  line-height: 56px;
  color: var(--text-color);
  position: relative;
  cursor: pointer;
}
.navbar-item .icon {
  display: block;
  font-size: 20px;
}
.navbar-item .nav-label {
  font-size: 10px;
}
.navbar-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 25%;
  width: 50%;
  height: 4px;
  background: var(--secondary-color);
  border-radius: 2px 2px 0 0;
}

/* Cloud Authentication Card Styling */
#cloudCard {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}
#cloudCard h3 {
  margin-bottom: 10px;
}
#cloudCard .auth-info {
  font-size: 14px;
  color: var(--text-color);
  margin-bottom: 10px;
}
#cloudCard input[type="email"],
#cloudCard input[type="password"],
#cloudCard input[type="text"] {
  width: 100%;
  max-width: 300px;
  padding: 10px;
  margin: 5px 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 16px;
}
#cloudCard button {
  padding: 10px 20px;
  margin: 5px 5px 5px 0;
  background: var(--primary-color);
  color: var(--background-color);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition-speed) ease;
}
#cloudCard button:hover {
  background: var(--primary-hover);
}
#cloudCard select {
  width: 100%;
  max-width: 300px;
  padding: 10px;
  margin: 5px 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 16px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  .round-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
}
@media (max-width: 480px) {
  .header h2 {
    font-size: 1.5em;
  }
  .score {
    font-size: 36px;
    width: 90px;
    padding: 15px;
  }
  .round-btn {
    font-size: 18px;
  }
  /* Cloud Card Responsive */
  #cloudCard input,
  #cloudCard button,
  #cloudCard select {
    max-width: 100%;
    width: 100%;
  }
}
