/* KOFC Squares Frontend Styles */

.kofc-squares-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.kofc-game-header {
  text-align: center;
  margin-bottom: 30px;
}

.kofc-game-header h2 {
  margin-bottom: 15px;
  color: #333;
}

.kofc-game-details {
  background: #f9f9f9;
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.kofc-game-details p {
  margin: 8px 0;
}

.kofc-status {
  padding: 12px;
  border-radius: 4px;
  font-weight: bold;
  margin: 15px 0;
}

.kofc-status-open {
  background: #e3f2fd;
  color: #1976d2;
  border: 2px solid #1976d2;
}

.kofc-status-locked {
  background: #fff3e0;
  color: #f57c00;
  border: 2px solid #f57c00;
}

.kofc-status-randomized {
  background: #e8f5e9;
  color: #388e3c;
  border: 2px solid #388e3c;
}

/* Master 13x13 Grid Container */
.kofc-master-grid {
  display: grid;
  grid-template-columns: repeat(13, minmax(60px, 100px));
  grid-template-rows: repeat(13, 1fr);
  margin: 20px auto;
  max-width: 100%;
  justify-content: center;
}

/* Team Header - Top (Away Team) */
.kofc-team-header-top {
  grid-area: 1 / 3 / 3 / 14;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  place-self: center;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
}

.kofc-team-header-top .kofc-team-logo {
  max-width: 80px;
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.kofc-team-header-top .kofc-team-name {
  color: #333;
  text-transform: uppercase;
}

/* Team Header - Side (Home Team) */
.kofc-team-header-side {
  grid-area: 3 / 1 / 14 / 3;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  place-self: center;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.kofc-team-header-side .kofc-team-logo {
  max-width: 80px;
  max-height: 80px;
  width: auto;
  height: auto;
  object-fit: contain;
  rotate: 90deg;
}

.kofc-team-header-side .kofc-team-name {
  color: #333;
  text-transform: uppercase;
}

/* 11x11 Grid Container */
.kofc-grid-container {
  grid-area: 3 / 3 / 14 / 14;
}

.kofc-grid-11x11 {
  display: grid;
  grid-template-columns: repeat(11, minmax(60px, 100px));
  grid-template-rows: repeat(11, 60px);
  gap: 2px;
  background: #ddd;
  padding: 2px;
  border-radius: 4px;
}

/* Corner cell (empty) */
.kofc-grid-corner {
  background: transparent;
}

/* Top row numbers */
.kofc-top-number {
  background: #2196f3;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  border-radius: 4px;
}

/* Side column numbers */
.kofc-side-number {
  background: #4caf50;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  border-radius: 4px;
}

/* Individual Player Squares */
.kofc-square {
  background: white;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  padding: 4px;
  overflow: hidden;
  position: relative;
  transition: all 0.2s ease;
}

.kofc-square.open {
  background: #e8f5e9;
  border-color: #4caf50;
}

.kofc-square.taken {
  background: #fff3e0;
  border-color: #ff9800;
}

.kofc-square.clickable {
  cursor: pointer;
}

.kofc-square.clickable:hover {
  background: #a5d6a7;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.kofc-square .player-name {
  font-weight: bold;
  color: #333;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.kofc-square.just-claimed {
  animation: claim-pulse 1s ease;
}

@keyframes claim-pulse {
  0% {
    background: #4caf50;
    transform: scale(1);
  }
  50% {
    background: #66bb6a;
    transform: scale(1.1);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.8);
  }
  100% {
    background: #fff3e0;
    transform: scale(1);
  }
}

/* Payouts Section */
.kofc-payouts {
  margin-top: 30px;
  padding: 20px;
  background: #f5f5f5;
  border-radius: 4px;
  text-align: center;
}

.kofc-payouts h3 {
  margin-top: 0;
  color: #333;
}

.kofc-payouts ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: inline-block;
  text-align: left;
}

.kofc-payouts li {
  padding: 5px 0;
  font-size: 16px;
}

/* Modal Styles */
.kofc-modal {
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
}

.kofc-modal-content {
  background-color: #fefefe;
  margin: 10% auto;
  padding: 30px;
  border: 1px solid #888;
  width: 90%;
  max-width: 500px;
  border-radius: 8px;
  position: relative;
}

.kofc-modal-close {
  color: #aaa;
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
}

.kofc-modal-close:hover,
.kofc-modal-close:focus {
  color: #000;
}

.kofc-modal-content h3 {
  margin-top: 0;
  color: #333;
}

.kofc-form-field {
  margin-bottom: 20px;
}

.kofc-form-field label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #333;
}

.kofc-form-field input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
  box-sizing: border-box;
}

.kofc-form-field input:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 5px rgba(33, 150, 243, 0.3);
}

.kofc-form-actions {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.kofc-button {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.kofc-button-primary {
  background: #2196f3;
  color: white;
}

.kofc-button-primary:hover {
  background: #1976d2;
}

.kofc-button-secondary {
  background: #f5f5f5;
  color: #333;
  border: 1px solid #ddd;
}

.kofc-button-secondary:hover {
  background: #e0e0e0;
}

.kofc-button-clear {
  background: #ff5722;
  color: white;
  border: 1px solid #e64a19;
}

.kofc-button-clear:hover {
  background: #e64a19;
}

.kofc-message {
  margin-top: 15px;
  padding: 12px;
  border-radius: 4px;
  text-align: center;
}

.kofc-message.success {
  background: #e8f5e9;
  color: #388e3c;
  border: 1px solid #4caf50;
}

.kofc-message.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #f44336;
}

.kofc-error {
  color: #c62828;
  padding: 15px;
  background: #ffebee;
  border: 1px solid #f44336;
  border-radius: 4px;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .kofc-master-grid {
    grid-template-columns: repeat(13, minmax(35px, 1fr));
  }

  .kofc-grid-11x11 {
    grid-template-columns: repeat(11, minmax(35px, 1fr));
    grid-template-rows: repeat(11, 35px);
  }

  .kofc-square {
    font-size: 9px;
    padding: 2px;
  }

  .kofc-top-number,
  .kofc-side-number {
    font-size: 14px;
  }

  .kofc-team-header-top,
  .kofc-team-header-side {
    font-size: 1.5rem;
  }

  .kofc-team-header-top .kofc-team-logo,
  .kofc-team-header-side .kofc-team-logo {
    max-width: 50px;
    max-height: 50px;
  }
}

@media (max-width: 480px) {
  .kofc-master-grid {
    grid-template-columns: repeat(13, minmax(25px, 1fr));
  }

  .kofc-grid-11x11 {
    grid-template-columns: repeat(11, minmax(25px, 1fr));
    grid-template-rows: repeat(11, 25px);
    gap: 1px;
  }

  .kofc-square {
    font-size: 8px;
    padding: 1px;
  }

  .kofc-top-number,
  .kofc-side-number {
    font-size: 12px;
  }

  .kofc-team-header-top,
  .kofc-team-header-side {
    font-size: 1rem;
    gap: 0.25rem;
  }

  .kofc-team-header-top .kofc-team-logo,
  .kofc-team-header-side .kofc-team-logo {
    max-width: 30px;
    max-height: 30px;
  }
}

/* Trophy icon on winning squares */
.kofc-trophy {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 24px;
  height: 24px;
  opacity: 0.9;
  pointer-events: none;
  z-index: 10;
}

.kofc-trophy svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

/* Winning square highlight */
.kofc-square.has-winner {
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
  border: 2px solid #FFD700 !important;
}

/* Winners summary on frontend */
.kofc-winners-summary {
  margin: 30px 0;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
}

.kofc-winners-summary h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.3em;
}

.kofc-winners-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.kofc-winners-table th,
.kofc-winners-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.kofc-winners-table th {
  background: #4CAF50;
  color: white;
  font-weight: 600;
}

.kofc-winners-table tbody tr:hover {
  background: #f5f5f5;
}

/* Responsive design for winners table */
@media (max-width: 768px) {
  .kofc-winners-table {
    font-size: 0.9em;
  }

  .kofc-winners-table th,
  .kofc-winners-table td {
    padding: 8px;
  }

  /* Hide trophy icon on mobile, keep gold border */
  .kofc-trophy {
    display: none;
  }
}
