/* Equal Playing Time Calculator Styles */

.coach-tool-section {
  background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
}

#eptc-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid #e5e7eb;
}

.card-header {
  text-align: center;
  border-bottom: 2px solid #e5e7eb;
  padding-bottom: 1.5rem;
}

.card-header h2 {
  color: var(--dark-blue);
  margin-bottom: 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
}

.card-header p {
  color: var(--text-gray);
  font-size: 1.05rem;
}

/* Grid Layout */
.eptc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 1024px) {
  .eptc-grid {
    grid-template-columns: 1fr 1.2fr;
  }
}

/* Form Section */
.eptc-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.eptc-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.eptc-field-group label {
  font-weight: 600;
  color: var(--dark-blue);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.eptc-field-group input[type="number"] {
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: #ffffff;
}

.eptc-field-group input[type="number"]:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(30, 120, 255, 0.1);
}

.eptc-field-group input[type="number"]:hover {
  border-color: #d1d5db;
}

.eptc-help {
  font-size: 0.875rem;
  color: var(--text-gray);
  font-style: italic;
}

.eptc-error {
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 500;
  min-height: 1.25rem;
}

/* Mode Toggle */
.eptc-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f3f4f6;
  border-radius: 10px;
  margin: 0.5rem 0;
}

.eptc-mode-btn {
  padding: 0.75rem 1rem;
  border: 2px solid transparent;
  background: transparent;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--dark-gray);
  cursor: pointer;
  transition: all 0.2s ease;
}

.eptc-mode-btn:hover {
  background: #e5e7eb;
}

.eptc-mode-btn.is-active {
  background: var(--primary-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(30, 120, 255, 0.3);
}

/* Players Panel */
.eptc-players-panel {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem;
  background: #f9fafb;
}

.eptc-players-panel summary {
  font-weight: 600;
  color: var(--dark-blue);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.eptc-players-panel summary:hover {
  background: #e5e7eb;
}

.eptc-players-panel summary::after {
  content: '▼';
  font-size: 0.75rem;
  transition: transform 0.2s ease;
}

.eptc-players-panel[open] summary::after {
  transform: rotate(180deg);
}

.eptc-players-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.eptc-save-names {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--dark-gray);
  cursor: pointer;
}

.eptc-save-names input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-blue);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  font-weight: 500;
}

.btn-link:hover {
  color: var(--primary-blue-hover);
}

.eptc-players-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  max-height: 400px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 0.5rem;
  width: 100%;
  box-sizing: border-box;
}

.eptc-player-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: background-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.eptc-player-row:hover {
  background: #f3f4f6;
}

.eptc-player-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 500;
}

.eptc-player-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  background: var(--light-blue);
  color: var(--dark-blue);
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.875rem;
}

.eptc-player-name {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.eptc-player-name:focus {
  outline: none;
  border-color: var(--primary-blue);
}

.eptc-player-fixed {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-gray);
  padding-left: 2.5rem;
  cursor: pointer;
}

.eptc-player-fixed-checkbox {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #9ca3af;
  border-radius: 4px;
  background-color: #ffffff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
  display: inline-block;
  vertical-align: middle;
}

.eptc-player-fixed-checkbox:checked {
  background-color: #1e78ff;
  border-color: #1e78ff;
}

.eptc-player-fixed-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.eptc-player-fixed-checkbox:focus {
  outline: 2px solid #1e78ff;
  outline-offset: 2px;
}

.eptc-player-fixed-checkbox:hover {
  border-color: #1e78ff;
}

/* Actions */
.eptc-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.eptc-actions .btn {
  flex: 1;
  min-width: 140px;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.2s ease;
}

/* Alert */
.eptc-alert {
  padding: 1rem 1.25rem;
  background: #fee2e2;
  border: 2px solid #fca5a5;
  border-radius: 8px;
  color: #7f1d1d;
  font-weight: 500;
  margin-top: 1rem;
}

/* Results Section */
.eptc-results {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.eptc-summary-box {
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
  border: 2px solid #93c5fd;
  border-radius: 12px;
  padding: 1.5rem;
}

.eptc-summary-box h3 {
  color: var(--dark-blue);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.eptc-summary-box h3::before {
  content: '📊';
  font-size: 1.5rem;
}

.eptc-summary-info {
  color: #1e3a8a;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.eptc-summary p {
  margin: 0.5rem 0;
  color: #1e40af;
  font-size: 0.95rem;
  line-height: 1.6;
}

.eptc-summary strong {
  color: var(--dark-blue);
  font-weight: 700;
}

/* Tables */
.eptc-table-wrapper {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.eptc-table-wrapper h3 {
  background: #f3f4f6;
  color: var(--dark-blue);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 1rem 1.25rem;
  margin: 0;
  border-bottom: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.eptc-table-wrapper h3:first-child::before {
  content: '🔄';
}

.eptc-table-wrapper:last-child h3::before {
  content: '👥';
}

.eptc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.eptc-table thead {
  background: #f9fafb;
}

.eptc-table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--dark-gray);
  border-bottom: 2px solid #e5e7eb;
}

.eptc-table tbody tr {
  border-bottom: 1px solid #e5e7eb;
  transition: background-color 0.15s ease;
}

.eptc-table tbody tr:hover {
  background-color: #f9fafb;
}

.eptc-table tbody tr:last-child {
  border-bottom: none;
}

.eptc-table td {
  padding: 0.875rem 1rem;
  color: var(--dark-gray);
  vertical-align: top;
}

.eptc-table td:first-child {
  font-weight: 600;
  color: var(--dark-blue);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  #eptc-card {
    padding: 1.5rem;
    border-radius: 12px;
  }

  .card-header h2 {
    font-size: 1.5rem;
  }

  .eptc-grid {
    gap: 1.5rem;
  }

  .eptc-mode-toggle {
    grid-template-columns: 1fr;
  }

  .eptc-actions {
    flex-direction: column;
  }

  .eptc-actions .btn {
    width: 100%;
  }

  /* Player inputs mobile fix */
  .eptc-players-panel {
    padding: 0.875rem;
  }

  .eptc-players-container {
    padding-right: 0.25rem;
    max-height: 350px;
  }

  .eptc-player-row {
    padding: 0.625rem;
  }

  .eptc-player-label {
    gap: 0.5rem;
  }

  .eptc-player-index {
    min-width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }

  .eptc-player-name {
    font-size: 0.9rem;
    padding: 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .eptc-player-fixed {
    padding-left: 2rem;
    font-size: 0.8rem;
  }

  .eptc-table {
    font-size: 0.85rem;
  }

  .eptc-table th,
  .eptc-table td {
    padding: 0.75rem 0.5rem;
  }

  .eptc-table th {
    font-size: 0.75rem;
  }

  /* Stack table on very small screens */
  @media (max-width: 480px) {
    #eptc-card {
      padding: 1rem;
    }

    /* Extra small player inputs */
    .eptc-players-panel {
      padding: 0.75rem;
    }

    .eptc-players-container {
      max-height: 300px;
    }

    .eptc-player-row {
      padding: 0.5rem;
      gap: 0.4rem;
    }

    .eptc-player-label {
      gap: 0.4rem;
    }

    .eptc-player-index {
      min-width: 26px;
      height: 26px;
      font-size: 0.75rem;
    }

    .eptc-player-name {
      font-size: 0.875rem;
      padding: 0.45rem 0.5rem;
    }

    .eptc-player-fixed {
      padding-left: 1.75rem;
      font-size: 0.75rem;
    }

    .eptc-player-fixed-checkbox {
      width: 18px;
      height: 18px;
    }

    .eptc-table thead {
      display: none;
    }

    .eptc-table,
    .eptc-table tbody,
    .eptc-table tr,
    .eptc-table td {
      display: block;
      width: 100%;
    }

    .eptc-table tr {
      margin-bottom: 1rem;
      border: 1px solid #e5e7eb;
      border-radius: 8px;
      padding: 0.75rem;
      background: #ffffff;
    }

    .eptc-table td {
      padding: 0.5rem 0;
      border: none;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
    }

    .eptc-table td::before {
      content: attr(data-label);
      font-weight: 700;
      color: var(--dark-blue);
      margin-right: 1rem;
      flex-shrink: 0;
    }

    .eptc-table td:first-child {
      font-size: 1.05rem;
      padding-bottom: 0.75rem;
      border-bottom: 1px solid #e5e7eb;
      margin-bottom: 0.5rem;
    }
  }
}

/* Print Styles */
@media print {
  .eptc-form,
  .eptc-actions,
  .btn,
  .eptc-alert {
    display: none !important;
  }

  .eptc-grid {
    grid-template-columns: 1fr;
  }

  .eptc-table-wrapper {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }

  .eptc-summary-box {
    background: #ffffff;
    border: 1px solid #000;
    page-break-inside: avoid;
  }
}

/* Loading State */
.eptc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: var(--text-gray);
  font-style: italic;
}

/* Empty State */
.eptc-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-gray);
}

.eptc-empty-state::before {
  content: '⚽';
  font-size: 3rem;
  display: block;
  margin-bottom: 1rem;
  opacity: 0.5;
}

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

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.eptc-results > * {
  animation: fadeIn 0.3s ease-out;
}

.eptc-player-row {
  animation: fadeIn 0.2s ease-out;
}

#eptc-print {
  animation: slideIn 0.3s ease-out;
}

/* Accessibility */
.eptc-mode-btn:focus-visible,
.eptc-field-group input:focus-visible,
.btn:focus-visible {
  outline: 3px solid var(--primary-blue);
  outline-offset: 2px;
}

/* Scrollbar Styling */
.eptc-players-container::-webkit-scrollbar {
  width: 8px;
}

.eptc-players-container::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

.eptc-players-container::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.eptc-players-container::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Match Timer Panel */
.eptc-timer-panel {
  background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
  border-radius: 16px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 24px rgba(30, 64, 175, 0.3);
  animation: fadeIn 0.4s ease-out;
}

.eptc-timer-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.eptc-timer-display,
.eptc-rotation-display {
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  border-radius: 12px;
  backdrop-filter: blur(10px);
}

.eptc-timer-label {
  color: #dbeafe;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.eptc-timer-value {
  color: #ffffff;
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.eptc-rotation-value {
  color: #ffffff;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.eptc-timer-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.eptc-timer-controls .btn {
  flex: 1;
  min-width: 120px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.eptc-timer-progress {
  margin-bottom: 1rem;
}

.eptc-progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.eptc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  border-radius: 999px;
  transition: width 0.3s ease;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

.eptc-next-change {
  text-align: center;
  color: #dbeafe;
  font-size: 1rem;
  font-weight: 600;
}

/* Next Rotation Display */
.eptc-next-rotation {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 1.5rem;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.eptc-next-rotation-header {
  text-align: center;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.eptc-next-rotation-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.eptc-next-on,
.eptc-next-off {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1rem;
}

.eptc-next-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #dbeafe;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.eptc-next-label i {
  font-size: 1rem;
}

.eptc-next-on .eptc-next-label {
  color: #86efac;
}

.eptc-next-on .eptc-next-label i {
  color: #22c55e;
}

.eptc-next-off .eptc-next-label {
  color: #fca5a5;
}

.eptc-next-off .eptc-next-label i {
  color: #ef4444;
}

.eptc-next-players {
  color: #ffffff;
  font-size: 0.95rem;
  line-height: 1.6;
  font-weight: 500;
  min-height: 2.5rem;
}

.eptc-next-players:empty::before {
  content: 'No changes';
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.eptc-timer-notification {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  border: 3px solid #ffffff;
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  color: #78350f;
  font-weight: 700;
  font-size: 1.125rem;
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.5);
  animation: pulse 1s ease-in-out infinite, shake 0.5s ease-in-out;
}

.eptc-timer-notification i {
  font-size: 1.5rem;
  margin-right: 0.75rem;
  animation: ring 1s ease-in-out infinite;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes ring {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-15deg); }
  20%, 40% { transform: rotate(15deg); }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(251, 191, 36, 0.5); }
  50% { box-shadow: 0 0 40px rgba(251, 191, 36, 0.8); }
}

/* Mobile Timer Adjustments */
@media (max-width: 768px) {
  .eptc-timer-panel {
    padding: 1.5rem;
    border-radius: 12px;
  }

  .eptc-timer-header {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .eptc-timer-display,
  .eptc-rotation-display {
    padding: 1.25rem;
  }

  .eptc-timer-value {
    font-size: 2.5rem;
  }

  .eptc-rotation-value {
    font-size: 2rem;
  }

  .eptc-timer-controls {
    flex-direction: column;
    gap: 0.75rem;
  }

  .eptc-timer-controls .btn {
    width: 100%;
    padding: 0.875rem 1.25rem;
    font-size: 0.95rem;
  }

  .eptc-next-rotation-content {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .eptc-next-rotation {
    padding: 1rem;
  }

  .eptc-next-rotation-header {
    font-size: 0.9rem;
  }

  .eptc-next-players {
    font-size: 0.875rem;
  }

  .eptc-timer-notification {
    padding: 1rem;
    font-size: 1rem;
  }

  .eptc-timer-notification i {
    font-size: 1.25rem;
  }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
  .eptc-timer-panel {
    padding: 1rem;
  }

  .eptc-timer-value {
    font-size: 2rem;
  }

  .eptc-rotation-value {
    font-size: 1.5rem;
  }

  .eptc-timer-label {
    font-size: 0.75rem;
  }

  .eptc-timer-controls .btn {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
  }

  .eptc-next-change {
    font-size: 0.875rem;
  }

  .eptc-progress-bar {
    height: 10px;
  }

  /* Mode toggle buttons */
  .eptc-mode-btn {
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
  }

  /* Timer info box */
  #eptc-timer-info {
    padding: 0.875rem;
  }

  #eptc-timer-info h4 {
    font-size: 0.9rem;
  }

  #eptc-timer-info p {
    font-size: 0.85rem;
  }

  #eptc-timer-info .fas.fa-stopwatch {
    font-size: 1rem;
  }

  #eptc-timer-info > div > div:first-child {
    width: 36px;
    height: 36px;
  }
}
