/* Ajax Champions League Tracker - Styles */
/* Brand colors based on Cotype Ajax rebrand 2024 */

:root {
  --ajax-red: #C41E3A;
  --ajax-red-dark: #9A1830;
  --ajax-red-light: #D64456;
  --white: #FFFFFF;
  --cream: #F5F0E8;
  --dark: #1A1A1A;
  --dark-light: #232323;
  --dark-lighter: #2E2E2E;
  --gray: #6B6B6B;
  --gray-light: #A3A3A3;

  --status-met: #22C55E;
  --status-not-met: #EF4444;
  --status-pending: #F59E0B;

  --font-display: 'Bebas Neue', Impact, sans-serif;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  font-family: var(--font-main);
  background: var(--dark);
  color: var(--white);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 20px 20px 10px;
  margin-bottom: 20px;
}

.hero-title {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4em;
  margin-bottom: 12px;
  line-height: 1;
  transition: filter 0.5s ease;
}

.ajax-wordmark {
  height: clamp(2.2rem, 8vw, 3.8rem);
  width: auto;
  position: relative;
  top: 0.05em;
}

.title-text {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 10vw, 4.5rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--cream);
}

.hero-title.qualified .title-text {
  color: var(--status-met);
}

.hero-title.eliminated .title-text {
  color: var(--ajax-red);
}


.hero-status {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gray-light);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

/* Qualification Meter */
.qualification-meter {
  max-width: 400px;
  margin: 0 auto;
}

.meter-progress {
  height: 12px;
  background: var(--dark-light);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.meter-bar {
  height: 100%;
  width: 0%;
  background: var(--ajax-red);
  border-radius: 6px;
  transition: width 0.5s ease, background 0.3s ease;
}

.meter-bar.qualified {
  background: var(--status-met);
}

.meter-label {
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--gray-light);
  text-align: center;
  letter-spacing: 0.05em;
}

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 0.8rem;
  color: var(--gray);
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .status-bar {
    gap: 8px 12px;
  }
}

.status-bar .last-updated {
  margin: 0;
}


.status-bar .api-status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-bar .status-label {
  position: relative;
  top: -1px;
}

.status-bar .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray);
}

.status-bar .api-status.connected .status-dot {
  background: var(--status-met);
}

.status-bar .api-status.error .status-dot {
  background: var(--status-not-met);
}

.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--dark-lighter);
  border: none;
  border-radius: 4px;
  color: var(--gray-light);
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-btn:hover:not(:disabled) {
  background: var(--dark-light);
  color: var(--white);
}

.refresh-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.refresh-btn.spinning svg {
  animation: spin 0.8s linear infinite;
}

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

/* Ajax Match Card */
.ajax-match {
  background: var(--ajax-red);
  border-radius: 4px;
  padding: 24px;
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
}

.ajax-match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.live-badge {
  background: var(--dark);
  color: var(--cream);
  padding: 6px 14px;
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.live-badge.live {
  background: var(--status-met);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.match-time {
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0.9;
}

.ajax-match-teams {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  position: relative;
  z-index: 1;
  padding: 0 10px;
}

.team {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  min-width: 80px;
  flex: 1;
}

.team-logo {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.team-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-placeholder {
  width: 60px;
  height: 60px;
  background: var(--dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gray-light);
}

.team-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.4rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
  word-break: break-word;
  color: var(--cream);
}

.score-display {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.score {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 400;
  min-width: 50px;
  text-align: center;
  color: var(--cream);
}

.score-separator {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 400;
  opacity: 0.5;
  color: var(--cream);
}

.ajax-requirement {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  z-index: 1;
}

.requirement-label {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.requirement-value {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.requirement-status {
  font-size: 1.5rem;
}

/* Section Title */
.section-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  text-align: center;
  color: var(--cream);
}

.section-subtitle {
  color: var(--gray);
  text-align: center;
  margin-bottom: 25px;
  font-size: 0.95rem;
}

/* Scenario Grid */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}

.scenario-card {
  background: var(--dark-light);
  border-radius: 4px;
  padding: 20px;
  position: relative;
  border: 1px solid var(--dark-lighter);
  transition: all 0.3s ease;
}

.scenario-card.met {
  border-color: var(--status-met);
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}

.scenario-card.not-met {
  border-color: var(--status-not-met);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.scenario-card.live {
  animation: card-pulse 2s ease-in-out infinite;
}

@keyframes card-pulse {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 255, 255, 0.1); }
  50% { box-shadow: 0 0 15px rgba(255, 255, 255, 0.1); }
}

.scenario-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.scenario-number {
  background: var(--ajax-red);
  color: var(--cream);
  width: 28px;
  height: 28px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
}

.scenario-status-badge {
  padding: 4px 12px;
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scenario-status-badge.met {
  background: var(--status-met);
  color: var(--white);
}

.scenario-status-badge.not-met {
  background: var(--status-not-met);
  color: var(--white);
}

.scenario-status-badge.pending {
  background: var(--dark-lighter);
  color: var(--gray);
}

.scenario-status-badge.live {
  background: var(--status-pending);
  color: var(--dark);
}

.scenario-match {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.scenario-team-with-logo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.scenario-team-with-logo.home {
  justify-content: flex-start;
}

.scenario-team-with-logo.away {
  justify-content: flex-end;
}

.scenario-team {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.95rem;
  line-height: 1.2;
  color: var(--cream);
}

.team-logo-home,
.team-logo-away {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.team-logo-home img,
.team-logo-away img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.scenario-score {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
}

.scenario-score span {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
  min-width: 24px;
  text-align: center;
  color: var(--cream);
}

.scenario-score .separator {
  font-weight: 400;
  opacity: 0.4;
}

.scenario-condition {
  background: var(--dark);
  padding: 10px 15px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.condition-label {
  font-size: 0.75rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.condition-value {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  color: var(--cream);
}

/* Controls */
.controls {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid var(--dark-lighter);
  text-align: center;
}

.control-row {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 2px;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--ajax-red);
  color: var(--cream);
}

.btn-primary:hover {
  background: var(--ajax-red-light);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--dark-lighter);
  color: var(--white);
}

.btn-secondary:hover {
  background: var(--gray);
}

.btn-icon {
  font-size: 1.1rem;
}

.last-updated {
  color: var(--gray);
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.api-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--gray);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-not-met);
}

.api-status.connected .status-dot {
  background: var(--status-met);
}

.api-status.error .status-dot {
  background: var(--status-pending);
}

/* Edit Mode Toggle */
.edit-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--dark-lighter);
  transition: 0.3s;
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: var(--white);
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--ajax-red);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

.toggle-label {
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.manual-mode-note {
  color: var(--gray);
  font-size: 0.8rem;
  margin-top: 15px;
}

/* Editable Score Inputs */
.score-input {
  background: transparent;
  border: none;
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 400;
  text-align: center;
  width: 60px;
  pointer-events: none;
  cursor: default;
}

.score-input::-webkit-outer-spin-button,
.score-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.score-input[type=number] {
  -moz-appearance: textfield;
}

.score-input::placeholder {
  color: var(--white);
  opacity: 0.8;
}

/* Ajax match score inputs */
.ajax-match .score-input {
  font-size: 3rem;
  width: 50px;
}

/* Scenario score inputs */
.scenario-score .score-input {
  font-size: 1.5rem;
  width: 30px;
}

/* Edit mode active */
body.edit-mode .score-input {
  pointer-events: auto;
  cursor: text;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

body.edit-mode .score-input:hover {
  border-color: var(--ajax-red);
}

body.edit-mode .score-input:focus {
  outline: none;
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.2);
}

body.edit-mode .editable-score {
  position: relative;
}

body.edit-mode .editable-score::after {
  content: '✎';
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 0.7rem;
  background: var(--ajax-red);
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.8;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--dark-light);
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 2px solid var(--dark-lighter);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--dark-lighter);
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--gray);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--white);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px;
  border-top: 1px solid var(--dark-lighter);
}

/* Manual Score Input */
.manual-match {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--dark-lighter);
}

.manual-match:last-child {
  border-bottom: none;
}

.manual-match-number {
  background: var(--ajax-red);
  color: var(--white);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

.manual-match-teams {
  flex: 1;
  font-size: 0.85rem;
}

.manual-match-teams .vs {
  color: var(--gray);
  margin: 0 5px;
}

.manual-score-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
}

.manual-score-inputs input {
  width: 40px;
  padding: 6px;
  background: var(--dark);
  border: 1px solid var(--dark-lighter);
  border-radius: 4px;
  color: var(--white);
  text-align: center;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 1rem;
}

.manual-score-inputs input:focus {
  outline: none;
  border-color: var(--ajax-red);
}

.manual-score-inputs span {
  color: var(--gray);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  .hero {
    padding: 20px 10px;
  }

  .hero-title {
    gap: 0.25em;
  }

  .ajax-wordmark {
    height: 1.4rem;
  }

  .title-text {
    font-size: 1.6rem;
  }

  /* Ajax Match Mobile */
  .ajax-match {
    padding: 15px;
  }

  .ajax-match-header {
    justify-content: center;
  }

  .ajax-match-header .match-time {
    display: none;
  }

  .ajax-match-teams {
    gap: 10px;
    padding: 0;
  }

  .team {
    min-width: 70px;
  }

  .team-logo {
    width: 50px;
    height: 50px;
  }

  .team-name {
    font-size: 0.95rem;
  }

  .score-display {
    gap: 5px;
  }

  .ajax-match .score-input {
    font-size: 2.5rem;
    width: 40px;
  }

  .score-separator {
    font-size: 1.5rem;
  }

  /* Scenario Grid Mobile */
  .scenario-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .scenario-card {
    padding: 12px;
  }

  .scenario-match {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 6px;
  }

  .scenario-team-with-logo {
    gap: 4px;
  }

  /* Mobile: Home team shows as "Name [logo]" aligned right */
  .scenario-team-with-logo.home {
    justify-content: flex-end;
  }

  .scenario-team-with-logo.home .team-logo-home {
    order: 2;
  }

  .scenario-team-with-logo.home .scenario-team {
    order: 1;
  }

  /* Mobile: Away team shows as "[logo] Name" aligned left */
  .scenario-team-with-logo.away {
    justify-content: flex-start;
  }

  .scenario-team-with-logo.away .team-logo-away {
    order: 1;
  }

  .scenario-team-with-logo.away .scenario-team {
    order: 2;
  }

  .scenario-team {
    font-size: 0.95rem;
    line-height: 1.1;
  }

  .scenario-team-with-logo {
    gap: 8px;
  }

  .team-logo-home,
  .team-logo-away {
    width: 22px;
    height: 22px;
  }

  .scenario-score .score-input {
    font-size: 1.3rem;
    width: 24px;
  }

  .scenario-score .separator {
    font-size: 1.2rem;
  }

  .scenario-condition {
    padding: 8px 10px;
    font-size: 0.7rem;
  }

  .condition-label,
  .condition-value {
    font-size: 0.7rem;
  }
}

/* Standings Table */
.standings {
  margin-top: 40px;
}

.standings-table {
  background: var(--dark-light);
  border-radius: 4px;
  overflow: hidden;
}

.standings-loading,
.standings-error {
  padding: 40px;
  text-align: center;
  color: var(--gray);
}

.standings-grid {
  width: 100%;
  border-collapse: collapse;
}

.standings-grid th,
.standings-grid td {
  padding: 10px 12px;
  text-align: left;
}

.standings-grid th {
  background: var(--dark-lighter);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-light);
}

.standings-grid tbody tr {
  border-bottom: 1px solid var(--dark-lighter);
  transition: background 0.2s;
}

.standings-grid tbody tr:hover {
  background: var(--dark-lighter);
}

.standings-grid tbody tr:last-child {
  border-bottom: none;
}

.col-pos {
  width: 40px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  color: var(--gray-light);
}

.col-team {
  display: flex;
  align-items: center;
  gap: 10px;
}

.col-gd,
.col-pts {
  width: 50px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  color: var(--cream);
}

.standings-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.standings-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1rem;
  color: var(--cream);
}

/* Row highlighting */
.top8-row {
  background: rgba(34, 197, 94, 0.1);
}

.top8-row .col-pos {
  color: var(--status-met);
}

.playoff-row {
  background: rgba(59, 130, 246, 0.1);
}

.playoff-row .col-pos {
  color: #3B82F6;
}

.ajax-row {
  background: rgba(210, 18, 46, 0.2) !important;
}

.ajax-row td {
  color: var(--white);
  font-weight: 600;
}

.ajax-row .col-pos {
  color: var(--ajax-red);
  font-weight: 800;
}

.ajax-row .standings-name {
  color: var(--ajax-red);
  font-weight: 700;
}

/* Legend */
.standings-legend {
  display: flex;
  gap: 20px;
  padding: 12px 16px;
  background: var(--dark-lighter);
  font-size: 0.75rem;
  color: var(--gray);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-item.top8 .legend-dot {
  background: var(--status-met);
}

.legend-item.playoff .legend-dot {
  background: #3B82F6;
}

/* Mobile standings */
@media (max-width: 480px) {
  .standings-grid th,
  .standings-grid td {
    padding: 8px 10px;
  }

  .standings-logo {
    width: 20px;
    height: 20px;
  }

  .standings-name {
    font-size: 0.8rem;
  }

  .standings-legend {
    flex-direction: column;
    gap: 8px;
  }
}
