@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');

:root {
  --bg: #f4f6f8;
  --card-bg: #ffffff;
  --card-border: #e0e5ea;
  --text: #2c3e50;
  --text-dim: #7f8c8d;
  --text-light: #95a5a6;
  --accent: #27ae60;
  --accent-glow: rgba(39, 174, 96, 0.3);
  --red: #e74c3c;
  --score-bg: #ecf0f1;
  --live-red: #e74c3c;
  --header-bg: #ffffff;
  --shadow: 0 4px 15px rgba(0,0,0,0.05);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header */
.header {
  width: 100%;
  background: var(--header-bg);
  padding: 1.2rem 0;
  text-align: center;
  border-bottom: 1px solid var(--card-border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}

.header h1 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text);
}

.header h1 span {
  color: var(--accent);
}

/* Live Badge & Timer */
.match-info-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
  gap: 0.5rem;
}

.live-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(231, 76, 60, 0.1);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(231, 76, 60, 0.2);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--live-red);
  border-radius: 50%;
  animation: livePulse 1.5s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 5px rgba(231, 76, 60, 0); }
}

.live-text {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--live-red);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.timer {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  background: #fff;
  padding: 0.3rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
}

.status-text {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
}

/* Match Card */
.match-card {
  width: 90%;
  max-width: 600px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  margin-top: 1.5rem;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s;
}

.match-header {
  background: #fafbfc;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 1px solid var(--card-border);
}

.match-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.match-details .date {
  color: var(--text);
}

.match-details .recorder {
  font-size: 0.65rem;
  color: var(--text-light);
}

.match-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  gap: 1.5rem;
}

.team {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.team-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 900;
  transition: transform 0.3s, box-shadow 0.3s;
  background: #f1f3f5;
  color: var(--text);
  border: 2px solid var(--card-border);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.team-logo.home-team {
  background: linear-gradient(135deg, #FF9800, #FF5722);
  color: #fff;
  border: none;
  box-shadow: 0 6px 15px rgba(255, 87, 34, 0.2);
}

.team-logo.away-team {
  background: linear-gradient(135deg, #4CAF50, #2E7D32);
  color: #fff;
  border: none;
  box-shadow: 0 6px 15px rgba(46, 125, 50, 0.2);
}

.team-name {
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  line-height: 1.3;
}

/* Score Area */
.score-area {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  justify-content: center;
}

.score-box {
  width: 56px;
  height: 64px;
  background: var(--text);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 900;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(44, 62, 80, 0.2);
}

.score-separator {
  font-size: 1.8rem;
  font-weight: 400;
  color: var(--text-light);
}

/* Footer */
.footer {
  margin-top: 2rem;
  padding: 1rem;
  text-align: center;
}

.admin-link {
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.3s;
}

.admin-link:hover {
  color: var(--accent);
}

/* ========= GOAL ANIMATIONS ========= */
.score-box.goal-scored {
  animation: scoreFlipLight 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  background: linear-gradient(135deg, #ff0055, #ff0088);
  box-shadow: 0 0 40px rgba(255,0,85, 0.8);
  transform: scale(1.2);
}

@keyframes scoreFlipLight {
  0% { transform: scale(1) perspective(400px) rotateX(90deg); opacity: 0; }
  40% { transform: scale(1.3) perspective(400px) rotateX(-10deg); }
  70% { transform: scale(1.1) perspective(400px) rotateX(5deg); }
  100% { transform: scale(1.2) perspective(400px) rotateX(0); opacity: 1; }
}

.team-logo.goal-bounce {
  animation: logoBounceLight 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes logoBounceLight {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  50% { transform: scale(0.95); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.match-card.goal-glow {
  animation: cardGlowLight 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes cardGlowLight {
  0% { transform: scale(1); box-shadow: var(--shadow); border-color: var(--card-border); }
  10% { transform: scale(1.05); box-shadow: 0 10px 50px rgba(255, 0, 85, 0.5); border-color: #ff0055; }
  50% { transform: scale(1.05); box-shadow: 0 10px 50px rgba(255, 0, 85, 0.5); border-color: #ff0055; }
  100% { transform: scale(1); box-shadow: var(--shadow); border-color: var(--card-border); }
}

/* Goal notification banner */
#goalBanner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 0;
  height: 0;
  background: linear-gradient(90deg, #ff0055, #ff0000, #ff0055, #9b59b6);
  background-size: 300% auto;
  animation: bgPan 2s linear infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 1000;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 10px 30px rgba(255, 0, 85, 0.6);
  transform: skewY(-2deg) translateY(-20px);
  opacity: 0;
}

#goalBanner.show {
  height: 80px;
  padding: 0 1rem;
  transform: skewY(-2deg) translateY(0) scale(1.02);
  opacity: 1;
}

@keyframes bgPan {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

#goalBanner .banner-text {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  text-transform: uppercase;
  white-space: nowrap;
}

#goalBanner .banner-icon {
  font-size: 1.5rem;
  margin: 0 0.8rem;
  animation: iconBounceLight 0.5s ease infinite alternate;
}

@keyframes iconBounceLight {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;
}

.screen-flash {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.85);
  z-index: 9998;
  animation: flashAnim 0.8s ease-out forwards;
}

@keyframes flashAnim {
  0% { opacity: 1; backdrop-filter: blur(10px); }
  100% { opacity: 0; backdrop-filter: blur(0); }
}

/* Admin Styles */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media(min-width: 600px) {
  .admin-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-group {
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

input, select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  color: var(--text);
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.3s;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

button {
  background: var(--text);
  border: none;
  border-radius: 10px;
  padding: 1rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(44,62,80,0.2);
}

button:active {
  transform: translateY(0);
}

.btn-primary { background: var(--accent); }
.btn-primary:hover { box-shadow: 0 4px 15px var(--accent-glow); }

.btn-danger { background: var(--red); }
.btn-danger:hover { box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3); }

/* Login container */
.login-container {
  width: 90%;
  max-width: 400px;
  margin-top: 4rem;
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
}

.login-container h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 2rem;
  color: var(--text);
  text-align: center;
}

.error-msg, .success-msg {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  padding: 0.8rem;
  border-radius: 8px;
  margin-top: 1rem;
  display: none;
}

.error-msg { background: #fdeceb; color: var(--red); }
.success-msg { background: #eefafe; color: var(--accent); }

.admin-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--card-border);
}

.admin-actions a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color 0.2s;
}

.admin-actions a:hover {
  color: var(--text);
}

/* League & Stats Additions */
.league-section {
  width: 90%;
  max-width: 1000px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}

@media(min-width: 800px) {
  .league-section {
    grid-template-columns: 2fr 1fr;
  }
}

.table-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.table-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 1rem;
  text-transform: uppercase;
  border-bottom: 2px solid var(--card-border);
  padding-bottom: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

th, td {
  padding: 0.8rem 0.5rem;
  border-bottom: 1px solid var(--card-border);
}

th {
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
}

td {
  font-weight: 600;
  color: var(--text);
}

.pts {
  color: var(--accent);
  font-weight: 800;
  font-size: 1rem;
}

.events-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 1.5rem;
  text-align: center;
  width: 100%;
}

.event-item {
  background: var(--bg);
  padding: 0.3rem 0.8rem;
  border-radius: 12px;
  display: inline-block;
  margin: 0 auto;
}

.scorer-name {
  font-weight: 700;
  color: var(--text);
}
