/* Manifold Tournaments CSS - Following product brief styling guidelines */

:root {
  /* Color palette from product brief */
  --bg-primary: #FCFDFF;
  --text-primary: #111111;
  --divider-light: #E1E6F7;
  --text-secondary: #6D6E80;
  --brand-gradient: linear-gradient(90deg, #5E63EF 0%, #875AEF 50%, #C94AEF 100%);
  --positive-pill: #249B90;
  --negative-pill: #F04127;
  --selected-highlight: #F4F4FA;
  
  /* Typography */
  --font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  line-height: 1.5;
}

/* Two-pane grid layout */
.tournaments-app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/* Left sidebar */
.sidebar {
  background: var(--bg-primary);
  border-right: 1px solid var(--divider-light);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-logo {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.tourney-logo {
  width: 48px;
  height: 48px;
  margin-right: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 16px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: var(--selected-highlight);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--selected-highlight);
  color: var(--text-primary);
  font-weight: 500;
}

/* Main content area */
.main-content {
  padding: 24px 32px;
  overflow-y: auto;
}

/* Top navigation pills */
.top-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--divider-light);
  padding-bottom: 16px;
}

.nav-pill {
  padding: 8px 16px;
  border-radius: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.nav-pill:hover {
  color: var(--text-primary);
}

.nav-pill.active {
  color: var(--text-primary);
  font-weight: 500;
}

.nav-pill.active::after {
  content: '';
  position: absolute;
  bottom: -17px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 2px;
  background: var(--brand-gradient);
}

/* Search bar */
.search-container {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.search-bar {
  width: 100%;
  max-width: 400px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--divider-light);
  border-radius: 8px;
  font-size: 16px;
  background: white;
  transition: border-color 0.2s ease;
}

.search-bar:focus {
  outline: none;
  border-color: #5E63EF;
}

/* Filter chips */
.filter-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  color: var(--text-primary);
}

.filter-chip.active {
  border-color: #5E63EF;
  color: var(--text-primary);
}

/* Page headers */
.page-header {
  margin-bottom: 32px;
}

.page-title {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.page-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--brand-gradient);
  color: white;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--divider-light);
}

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

/* Tournament table */
.tournaments-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tournaments-table th {
  background: var(--selected-highlight);
  padding: 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--divider-light);
}

.tournaments-table td {
  padding: 16px;
  border-bottom: 1px solid var(--divider-light);
}

.tournaments-table tr:hover {
  background: var(--selected-highlight);
  cursor: pointer;
}

.tournaments-table tr:last-child td {
  border-bottom: none;
}

/* Status pills */
.status-pill {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  display: inline-block;
}

.status-coming-up {
  background: #FEF3C7;
  color: #92400E;
}

.status-active {
  background: #D1FAE5;
  color: #065F46;
}

.status-finished {
  background: #E5E7EB;
  color: #374151;
}

/* Forms */
.form-group {
  margin-bottom: 24px;
}

.required-asterisk {
  color: #DC2626;
  margin-left: 4px;
}

.form-group-columns {
  display: flex;
  gap: 24px;
}

.form-column {
  flex: 1;
  min-width: 0; /* Prevents flex items from overflowing */
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-sub-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 400;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-label-subtext {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  margin: 4px 0 0 0;
  line-height: 1.4;
}

.form-error-message {
  background: #FEE2E2;
  color: #DC2626;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--divider-light);
  border-radius: 8px;
  font-size: 16px;
  background: white;
  transition: border-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: #5E63EF;
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

.tournament-status-select {
  max-width: 240px;
}

.form-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 24px;
  max-width: 75%;
}

.card-header {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--divider-light);
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

/* Loading states */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px;
  color: var(--text-secondary);
}

/* Responsive design */
@media (max-width: 768px) {
  .tournaments-app {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: none;
  }
  
  .main-content {
    padding: 16px;
  }
}

/* Tooltip Component */
.tooltip-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tooltip-icon {
  cursor: help;
  margin-left: 4px;
  color: var(--text-secondary);
}

.tooltip-text {
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-5%);
  background-color: #1f2937;
  color: #f9fafb;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}


