/* ==========================================================================
   Sim Racing Nation - Competitions Hub Styles
   Architecture:
   - Interactive Dropdown Profile Cards (Desktop & Mobile)
   - Circle Game Logo Avatar
   - Game Theme Color Borders (GT7 Blue, iRacing Red, LMU Orange, etc.)
   - Clean Custom Web Dropdown Filter
   - Crisp Rectangles & Buttons (Zero Pill Capsules, Zero AI Badges)
   ========================================================================== */

/* Main Section */
.competitions-main-section {
  padding-top: 40px;
  padding-bottom: 84px;
}

/* Page Header */
.comp-page-header {
  margin-bottom: 28px;
}

.comp-page-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: clamp(2rem, 3.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text-main, #0F172A);
  line-height: 1.15;
  margin: 0 0 8px 0;
}

.comp-page-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted, #475569);
  line-height: 1.55;
  margin: 0;
  max-width: 680px;
}

.comp-page-contact-sub {
  font-size: 0.875rem;
  color: var(--text-muted, #64748B);
  margin: 6px 0 0 0;
}

.comp-contact-link {
  color: var(--srn-red, #D3222A);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 150ms ease;
  cursor: pointer;
}

.comp-contact-link:hover {
  color: #B91C1C;
}

/* Toolbar */
.comp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-light, #E2E8F0);
  padding-bottom: 16px;
}

/* Status Tabs (Clean Rectangles, Zero Pill Capsules, Zero Numbers) */
.comp-tabs {
  display: inline-flex;
  gap: 4px;
  background: #F1F5F9;
  padding: 3px;
  border-radius: 6px;
}

.comp-tab {
  background: transparent;
  border: none;
  color: #64748B;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast, 150ms ease);
}

.comp-tab:hover {
  color: #0F172A;
}

.comp-tab.active {
  background: #FFFFFF;
  color: #0F172A;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Controls: Search & Custom Dropdown */
.comp-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 580px;
  justify-content: flex-end;
}

.comp-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.comp-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #94A3B8;
  pointer-events: none;
}

.comp-search input {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid var(--border-light, #E2E8F0);
  border-radius: 6px;
  color: var(--text-main, #0F172A);
  font-size: 0.875rem;
  padding: 9px 12px 9px 36px;
  outline: none;
  transition: all var(--transition-fast, 150ms ease);
  box-sizing: border-box;
}

.comp-search input:focus {
  border-color: #0F172A;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.06);
}

/* Custom Web Dropdown (Converts seamlessly without mobile OS overlay) */
.custom-select-container {
  position: relative;
  min-width: 170px;
}

.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #FFFFFF;
  border: 1px solid var(--border-light, #E2E8F0);
  border-radius: 6px;
  color: var(--text-main, #0F172A);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 9px 12px;
  cursor: pointer;
  outline: none;
  transition: all var(--transition-fast, 150ms ease);
  box-sizing: border-box;
}

.custom-select-trigger:focus,
.custom-select-container.open .custom-select-trigger {
  border-color: #0F172A;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.08);
}

.custom-select-arrow {
  width: 14px;
  height: 14px;
  color: #64748B;
  transition: transform 150ms ease;
  flex-shrink: 0;
}

.custom-select-container.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 60;
  background: #FFFFFF;
  border: 1px solid var(--border-light, #E2E8F0);
  border-radius: 6px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  display: none;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 0;
}

.custom-select-container.open .custom-select-menu {
  display: block;
}

.custom-select-option {
  padding: 8px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: background 120ms ease;
}

.custom-select-option:hover {
  background: #F1F5F9;
  color: #0F172A;
}

.custom-select-option.active {
  background: #F8FAFC;
  color: var(--srn-red, #D3222A);
  font-weight: 800;
}

/* ==========================================================================
   Profile Card List Container
   ========================================================================== */
.comp-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Profile Card with Game Themed Color Borders */
.comp-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: border-color var(--transition-fast, 150ms ease), box-shadow var(--transition-fast, 150ms ease);
  overflow: hidden;
}

.comp-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

/* Game Category Theme Borders */
.comp-card.theme-gt7 {
  border-color: #2563EB; /* GT7 Blue */
}

.comp-card.theme-iracing {
  border-color: #E10600; /* iRacing Red */
}

.comp-card.theme-lmu {
  border-color: #F97316; /* LMU Orange */
}

.comp-card.theme-ac {
  border-color: #64748B; /* AC Slate */
}

.comp-card.theme-acc {
  border-color: #DC2626; /* ACC Crimson */
}

.comp-card.theme-acevo {
  border-color: #0EA5E9; /* AC EVO Sky Blue */
}

.comp-card.theme-raceroom {
  border-color: #BE123C; /* RaceRoom Burgundy */
}

.comp-card.theme-f1 {
  border-color: #E10600; /* F1 25 Red */
}

/* Main Title / Card Header Row (Clickable Accordion Trigger) */
.comp-card-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--transition-fast, 150ms ease);
  box-sizing: border-box;
}

.comp-card-header:hover {
  background-color: #F8FAFC;
}

.comp-card-header:focus-visible {
  outline: 2px solid var(--srn-red, #D3222A);
  outline-offset: -2px;
}

/* Left Group: Circular Logo + Shorthand Game + Title */
.comp-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.comp-circle-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease;
}

.comp-header-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.comp-game-shorthand {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748B;
}

.comp-item-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0F172A;
  margin: 0;
  line-height: 1.3;
}

.comp-card:hover .comp-item-title {
  color: var(--srn-red, #D3222A);
}

/* Right Group: Time Remaining Badge + Chevron */
.comp-header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

/* Ending Badge in Title Row (Clean Rectangles, Zero Round Pills) */
.comp-ending-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

/* 1. Normal (>= 48h) in Green */
.comp-ending-badge.normal {
  background: #F0FDF4;
  color: #16A34A;
  border: 1px solid #BBF7D0;
}

/* 2. Urgent (< 48h) in Red */
.comp-ending-badge.urgent {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px solid #FECACA;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  font-weight: 800;
}

/* 3. Ended / Archived in Muted Slate */
.comp-ending-badge.ended {
  background: #F1F5F9;
  color: #64748B;
  border: 1px solid #E2E8F0;
}

/* Chevron */
.comp-arrow-chevron {
  width: 18px;
  height: 18px;
  color: #64748B;
  transition: transform var(--transition-fast, 200ms ease);
  flex-shrink: 0;
}

.comp-card.is-open .comp-arrow-chevron {
  transform: rotate(180deg);
  color: #0F172A;
}

/* ==========================================================================
   Expandable Dropdown Details Panel
   ========================================================================== */
.comp-card-body {
  display: none;
}

.comp-card.is-open .comp-card-body {
  display: block;
}

.comp-body-inner {
  padding: 16px 20px 20px 20px;
  border-top: 1px solid #F1F5F9;
  background: #FFFFFF;
}

/* Detail Row */
.comp-detail-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.comp-label {
  font-weight: 800;
  color: #0F172A;
  min-width: 55px;
}

.comp-val {
  color: #334155;
}

/* Prize Row */
.comp-prize-row {
  margin-bottom: 8px;
}

.comp-prize-val {
  font-weight: 800;
  color: #15803D;
  font-size: 0.95rem;
}

/* Unlabeled Description (Direct text underneath without label) */
.comp-unlabeled-desc {
  margin: 10px 0 16px 0;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.6;
  max-width: 780px;
}

/* Dates & Ending Breakdown */
.comp-dates-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.comp-dates-list .comp-label {
  min-width: 140px;
  flex-shrink: 0;
}

.comp-live-ending {
  font-weight: 700;
  color: #0F172A;
}

/* Action: See Details Button */
.comp-action-bottom {
  padding-top: 4px;
}

.btn-see-details {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--srn-red, #D3222A);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 0.875rem;
  padding: 9px 22px;
  border-radius: 6px;
  text-decoration: none;
  transition: background var(--transition-fast, 150ms ease), transform var(--transition-fast, 150ms ease);
}

.btn-see-details:hover {
  background: #B91C1C;
  color: #FFFFFF;
  transform: translateY(-1px);
}

/* Empty State */
.comp-empty-state {
  text-align: center;
  padding: 56px 20px;
  background: #FFFFFF;
  border-radius: 8px;
  border: 1px solid var(--border-light, #E2E8F0);
  color: var(--text-muted, #64748B);
}

.comp-empty-state svg {
  width: 44px;
  height: 44px;
  color: #94A3B8;
  margin-bottom: 12px;
}

.comp-empty-state h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main, #0F172A);
  margin: 0 0 6px 0;
}

.comp-empty-state p {
  font-size: 0.9rem;
  margin: 0;
}

/* ==========================================================================
   Responsive Adaptations (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 768px) {
  .comp-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .comp-controls {
    max-width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  .comp-search {
    width: 100%;
  }

  .custom-select-container {
    width: 100%;
  }

  .comp-card-header {
    padding: 14px 16px;
    gap: 12px;
  }

  .comp-header-main {
    gap: 10px;
  }

  .comp-circle-avatar {
    width: 44px;
    height: 44px;
  }

  .comp-item-title {
    font-size: 0.95rem;
  }

  .comp-ending-badge {
    font-size: 0.75rem;
    padding: 3px 7px;
  }

  .comp-body-inner {
    padding: 14px 16px 16px 16px;
  }

  .btn-see-details {
    width: 100%;
    box-sizing: border-box;
  }
}
