/*


 */

/* ===== Reset & Base ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  overflow: hidden;
}

/* ===== Header ===== */
.header {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  padding: 20px 30px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.header img {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.header-text h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

.header-text p {
  opacity: 0.9;
  font-size: 14px;
}

/* ===== Navigation ===== */
.nav-bar {
  background: #1e3c72;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.3s;
}

.nav-link:hover {
  background: rgba(255,255,255,0.15);
}

/* ===== Flash messages ===== */
.flash {
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
}

.flash-notice {
  background: #d1fae5;
  color: #065f46;
}

.flash-alert {
  background: #fee2e2;
  color: #991b1b;
}

/* ===== Content ===== */
.content {
  padding: 30px;
}

/* ===== Live indicator ===== */
.live-indicator {
  background: #10b981;
  color: white;
  padding: 8px 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

/* ===== Forms ===== */
.form-section {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 30px;
}

.form-section h2 {
  color: #1e3c72;
  margin-bottom: 20px;
  font-size: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
  font-size: 14px;
}

input, select, textarea {
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #667eea;
}

/* ===== Buttons ===== */
.btn {
  padding: 14px 28px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-edit {
  background: #3b82f6;
  color: white;
}

.btn-edit:hover {
  background: #2563eb;
}

.btn-delete {
  background: #ef4444;
  color: white;
}

.btn-delete:hover {
  background: #dc2626;
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

/* ===== Filter Section ===== */
.filter-section {
  margin-bottom: 20px;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 12px;
}

.filter-section h3 {
  font-size: 16px;
  color: #1e3c72;
  margin-bottom: 12px;
  font-weight: 600;
}

.filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 10px 18px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  font-size: 14px;
  flex: 1;
  min-width: 140px;
  text-decoration: none;
  text-align: center;
  color: #333;
}

.filter-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.filter-btn:hover:not(.active) {
  border-color: #667eea;
  background: #f0f4ff;
}

.filter-btn-comp {
  padding: 10px 18px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  font-size: 14px;
  flex: 1;
  min-width: 140px;
  text-decoration: none;
  text-align: center;
  color: #333;
}

.filter-btn-comp.active {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.filter-btn-comp:hover:not(.active) {
  border-color: #10b981;
  background: #d1fae5;
}

/* ===== Competitor Cards ===== */
.competitor-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 15px;
  transition: all 0.3s;
}

.competitor-card.mine {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.competitor-card.done {
  background: #d1d5db;
  border-color: #9ca3af;
  opacity: 0.9;
}

.competitor-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.competitor-card.done:hover {
  border-color: #6b7280;
}

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

.competitor-name {
  font-size: 20px;
  font-weight: 700;
  color: #1e3c72;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.my-child-badge {
  background: #667eea;
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.competitor-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 15px;
  font-size: 14px;
}

.detail-item {
  display: flex;
  gap: 6px;
}

.detail-item.full-width {
  grid-column: 1 / -1;
}

.detail-label {
  font-weight: 600;
  color: #666;
}

.detail-value {
  color: #333;
}

.belt-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.ring-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  background: #f59e0b;
  color: white;
  margin-top: 8px;
}

.ring-badge-waiting {
  background: #ef4444;
}

/* ===== Status Buttons ===== */
.status-section {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.status-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.status-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s;
  font-size: 13px;
  text-align: center;
}

.status-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.status-btn:hover:not(.active) {
  border-color: #667eea;
  background: #f0f4ff;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.actions .btn-delete {
  margin-left: auto;
}

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

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h3 {
  color: #1e3c72;
  margin-bottom: 20px;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-buttons .btn {
  flex: 1;
}

/* ===== Empty & Loading states ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

/* ===== Auth pages ===== */
.auth-container {
  max-width: 400px;
  margin: 0 auto;
}

.auth-container h2 {
  color: #1e3c72;
  margin-bottom: 20px;
  text-align: center;
}

.auth-form .form-group {
  margin-bottom: 15px;
}

.auth-form .remember-me {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.auth-form .remember-me input {
  width: auto;
}

.auth-form .actions {
  margin-top: 20px;
}

.auth-container a {
  color: #667eea;
}

/* ===== Tournament selector ===== */
.tournament-selector {
  margin-bottom: 25px;
}

.tournament-selector select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
}

.tournament-selector label {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  color: #1e3c72;
  font-weight: 700;
}

/* ===== Section headers ===== */
.section-title {
  color: #1e3c72;
  margin-bottom: 20px;
  font-size: 20px;
}

.section-divider {
  border: none;
  border-top: 2px solid #e0e0e0;
  margin: 30px 0;
}

/* ===== Admin stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.stat-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
}

.stat-number {
  font-size: 36px;
  font-weight: 800;
}

.stat-label {
  font-size: 14px;
  opacity: 0.9;
}

/* ===== Coach table ===== */
.coach-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.coach-table th {
  background: #1e3c72;
  color: white;
  padding: 12px;
  text-align: left;
}

.coach-table td {
  padding: 12px;
  border-bottom: 1px solid #e0e0e0;
}

.coach-table tr:hover {
  background: #f0f4ff;
}

/* ===== Onboarding ===== */
.onboarding-section {
  margin-bottom: 30px;
}

.child-list {
  margin-bottom: 20px;
}

.child-item {
  background: #f0f4ff;
  border: 2px solid #667eea;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 15px 0;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.tournament-reg-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 15px;
}

.tournament-reg-card h4 {
  color: #1e3c72;
  margin-bottom: 10px;
}

/* ===== Placement highlight ===== */
.placement-value {
  font-weight: 700;
  color: #f59e0b;
}

/* ===== Ring + Report Time row ===== */
.ring-report-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

/* ===== Needs-coach highlight ===== */
.competitor-card.needs-coach {
  border-color: #f59e0b;
  background-color: #fefce8;
}

/* ===== Coach assignment ===== */
.coach-assignment {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

.coach-assignment label {
  display: block;
  margin-bottom: 6px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .competitor-details {
    grid-template-columns: 1fr;
  }

  .status-buttons {
    flex-direction: column;
  }

  .actions {
    flex-direction: column;
  }

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

  .nav-bar {
    flex-direction: column;
  }
}
