/* Scoped CSS for Chess Tournament Calendar */
.ctc-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e293b;
  line-height: 1.5;
}

.ctc-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.ctc-hero-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #1e3a8a;
  background-color: #dbeafe;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.ctc-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.5rem;
  letter-spacing: -0.025em;
}

.ctc-subtitle {
  font-size: 1.125rem;
  color: #64748b;
  max-width: 650px;
  margin: 0 auto;
}

/* Tabs */
.ctc-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 1.75rem;
  overflow-x: auto;
}

.ctc-tab {
  background: none;
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ctc-tab:hover {
  color: #0f172a;
}

.ctc-tab-active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* Views */
.ctc-view {
  display: none;
}

.ctc-view-active {
  display: block;
}

/* Cards & Controls */
.ctc-card, .ctc-controls-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ctc-controls-card {
  margin-bottom: 1.5rem;
}

.ctc-filter-group {
  margin-bottom: 1rem;
}

.ctc-filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.ctc-filter-item {
  display: flex;
  flex-direction: column;
}

.ctc-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.375rem;
}

.ctc-input, .ctc-select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.625rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.375rem;
  font-size: 0.9375rem;
  background-color: #ffffff;
  color: #0f172a;
}

.ctc-input:focus, .ctc-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.ctc-stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.ctc-stats-text {
  font-size: 0.875rem;
  color: #64748b;
  font-weight: 500;
}

/* Tournaments Grid */
.ctc-tournaments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.ctc-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.ctc-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 0.25rem;
}

.ctc-tag-classical {
  background-color: #e0f2fe;
  color: #0369a1;
}

.ctc-tag-rapid {
  background-color: #fef3c7;
  color: #b45309;
}

.ctc-tag-blitz {
  background-color: #fee2e2;
  color: #b91c1c;
}

.ctc-tag-fischer {
  background-color: #f3e8ff;
  color: #7e22ce;
}

.ctc-tag-region {
  font-size: 0.8125rem;
  color: #64748b;
}

.ctc-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem;
}

.ctc-card-dates {
  font-size: 0.875rem;
  color: #2563eb;
  margin: 0 0 0.5rem;
}

.ctc-card-desc {
  font-size: 0.875rem;
  color: #475569;
  margin: 0 0 1rem;
  min-height: 2.6rem;
}

.ctc-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: #64748b;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
  margin-bottom: 1rem;
}

.ctc-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.ctc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  background-color: #2563eb;
  border: 1px solid #2563eb;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.ctc-btn:hover {
  background-color: #1d4ed8;
}

.ctc-btn-secondary {
  background-color: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}

.ctc-btn-secondary:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.ctc-btn-danger {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.ctc-btn-danger:hover {
  background-color: #fecaca;
}

.ctc-btn-sm {
  padding: 0.375rem 0.625rem;
  font-size: 0.8125rem;
}

.ctc-btn-block {
  width: 100%;
}

/* Ad slots */
.ctc-ad-slot {
  min-height: 280px;
  background-color: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1.5rem 0;
  color: #94a3b8;
  font-size: 0.875rem;
}

/* Section titles */
.ctc-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 0.5rem;
}

.ctc-section-desc {
  font-size: 0.9375rem;
  color: #64748b;
  margin: 0 0 1.25rem;
}

.ctc-subhead {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 0.75rem;
}

/* Simulator layout */
.ctc-sim-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.ctc-badge {
  padding: 0.375rem 0.75rem;
  background-color: #eff6ff;
  color: #1d4ed8;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-left: auto;
}

.ctc-sim-add-box {
  margin-bottom: 1.5rem;
  background-color: #f8fafc;
  padding: 1rem;
  border-radius: 0.5rem;
}

.ctc-input-group {
  display: flex;
  gap: 0.5rem;
}

.ctc-input-w-sm {
  max-width: 120px;
}

.ctc-sim-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .ctc-sim-columns {
    grid-template-columns: 1fr;
  }
}

.ctc-table-wrapper {
  overflow-x: auto;
}

.ctc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.ctc-table th {
  background-color: #f1f5f9;
  color: #475569;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  border-bottom: 1px solid #cbd5e1;
}

.ctc-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
}

.ctc-text-center {
  text-align: center;
}

.ctc-muted {
  color: #94a3b8;
  font-size: 0.875rem;
  font-style: italic;
}

.ctc-pairings-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
}

.ctc-match-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.75rem;
}

.ctc-match-score {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ctc-score-btn {
  flex: 1;
  padding: 0.375rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  cursor: pointer;
}

.ctc-score-btn:hover {
  background-color: #f1f5f9;
}

.ctc-score-btn-active {
  background-color: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}

/* Calculator Grid */
.ctc-calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 768px) {
  .ctc-calc-grid {
    grid-template-columns: 1fr;
  }
}

.ctc-form-group {
  margin-bottom: 1.25rem;
}

.ctc-opponents-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ctc-opp-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ctc-opp-remove {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0 0.25rem;
}

.ctc-result-box {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.ctc-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.9375rem;
}

.ctc-result-total {
  font-size: 1.125rem;
  font-weight: 700;
  color: #0f172a;
  border-bottom: 2px solid #cbd5e1;
}

.ctc-text-positive {
  color: #16a34a;
}

.ctc-text-negative {
  color: #dc2626;
}

.ctc-text-success {
  color: #16a34a;
}

/* Modal */
.ctc-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.ctc-modal-open {
  display: flex;
}

.ctc-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
}

.ctc-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 0.75rem;
  max-width: 550px;
  width: 90%;
  padding: 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  z-index: 10000;
}

.ctc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
}

.ctc-modal-heading {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.ctc-modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}

.ctc-modal-body {
  font-size: 0.9375rem;
  color: #334155;
  margin-bottom: 1.5rem;
}

.ctc-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 1rem;
}

/* Utilities */
.ctc-mt-2 { margin-top: 0.5rem; }
.ctc-mt-3 { margin-top: 0.75rem; }
.ctc-mt-4 { margin-top: 1.5rem; }
.ctc-mb-4 { margin-bottom: 1.5rem; }

.ctc-calc-col {
  flex: 1;
}

.ctc-calc-results-col {
  flex: 1;
}

.ctc-event-details-btn {
  font-size: 0.8125rem;
}

.ctc-event-ics-btn {
  font-size: 0.8125rem;
}

.ctc-opp-rating {
  flex: 1;
}

.ctc-opp-result {
  width: 140px;
}

.ctc-sim-col {
  display: flex;
  flex-direction: column;
}

