/* Generic Blotter Components Styles */

/* Define color variables */
:root {
  --lapsplits-red: #DC3545;
}

/* Utility classes */
.text-lapsplits-red {
  color: var(--lapsplits-red) !important;
}

.bg-lapsplits-red {
  background-color: var(--lapsplits-red) !important;
}

.border-lapsplits-red {
  border-color: var(--lapsplits-red) !important;
}

/* Fix body and html to use full height properly */
html, body {
    height: 100%;
}

/* Prevent horizontal scrollbar when blotter is present */
html:has(.blotter-container) {
    overflow-x: hidden;
}

/* Override Bootstrap pb-3 padding when containing blotter */
.pb-3 .blotter-container {
    margin-bottom: -1rem; /* Compensate for parent's pb-3 padding */
}

/* Alternative approach: target the main element directly when it contains blotter */
main.pb-3:has(.blotter-container) {
    padding-bottom: 0 !important;
}

/* Fix footer positioning */
body {
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.footer {
    margin-top: auto;
    position: relative; /* Ensure z-index takes effect */
}

.blotter-container {
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
  height: 100vh; /* Take full viewport height */
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  z-index: 900; /* Below navbar dropdowns but above other content */
}

.blotter-header {
  background: white;
  border-bottom: 1px solid #dee2e6;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 60px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.blotter-title h4 {
  color: #495057;
  font-weight: 600;
}

.blotter-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.blotter-main {
  flex: 1;
  display: flex;
  height: calc(100vh - 116px); /* Full height minus navbar and header */
  overflow: hidden;
}

.results-panel {
  flex: 1;
  background: white;
  border-right: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Important for flex children */
}

.splitter {
  width: 4px;
  background: #dee2e6;
  cursor: col-resize;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.splitter:hover {
  background: var(--lapsplits-red);
}

.filters-panel {
  width: 350px;
  min-width: 250px;
  max-width: 500px;
  background: white;
  border-left: 1px solid #dee2e6;
  overflow-y: auto;
  flex-shrink: 0;
}

.filters-content {
  padding: 20px;
}

/* Custom styling for multi-select dropdowns */
.filters-content select[multiple] {
  min-height: 120px;
  max-height: 200px;
}

.filters-content select[multiple] option {
  padding: 4px 8px;
}

.filters-content select[multiple] option:checked {
  background: var(--lapsplits-red);
  color: white;
}

/* Form styling */
.filters-content .form-label {
  font-weight: 500;
  color: #495057;
  margin-bottom: 5px;
}

.filters-content .text-muted {
  color: #6c757d !important;
  font-weight: 500;
}

.filters-content .form-text {
  font-size: 0.875em;
  color: #6c757d;
}

/* Button styling */
.btn-group .btn-check:checked + .btn {
  background-color: var(--lapsplits-red);
  border-color: var(--lapsplits-red);
  color: white;
}

/* Badge styling */
.badge.bg-primary {
  background-color: var(--lapsplits-red) !important;
}

.badge .btn-close {
  font-size: 0.6em;
  margin-left: 0.3em;
}

/* Distance/Time filter styling */
.distance-time-filter {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
}

.distance-time-filter .btn-outline-danger {
  font-size: 1.2em;
  line-height: 1;
  padding: 0.2em 0.5em;
}

/* Dropdown styling for athlete search */
.dropdown-menu.show {
  display: block;
  border: 1px solid #ced4da;
  border-radius: 0.25rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  max-height: 200px;
  overflow-y: auto;
}

.dropdown-item {
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: #495057;
  text-decoration: none;
  cursor: pointer;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
}

.dropdown-item:disabled {
  color: #6c757d;
  background-color: transparent;
  cursor: not-allowed;
}

.dropdown-item-text {
  padding: 0.5rem 1rem;
  color: #6c757d;
}

/* AG Grid customizations */
.ag-theme-quartz {
  --ag-font-family: inherit;
  --ag-font-size: 13px;
  --ag-header-height: 40px;
  --ag-row-height: 35px;
}

.ag-theme-quartz .ag-header-cell {
  padding-left: 8px;
  padding-right: 8px;
}

.ag-theme-quartz .ag-cell {
  padding-left: 8px;
  padding-right: 8px;
}

.ag-theme-quartz .ag-cell.text-center {
  text-align: center;
}

/* Loading and no-data overlays */
.ag-overlay-loading-wrapper {
  background: rgba(255, 255, 255, 0.9);
}

.ag-overlay-no-rows-wrapper {
  background: white;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .blotter-main {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  
  .filters-panel {
    width: 100%;
    max-width: none;
    border-left: none;
    border-top: 1px solid #dee2e6;
    overflow-y: visible;
  }
  
  .splitter {
    width: 100%;
    height: 4px;
    cursor: row-resize;
  }
  
  .blotter-controls {
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .blotter-controls .btn-group {
    margin-right: 0 !important;
    margin-bottom: 5px;
  }
}

/* Scrollbar styling for webkit browsers */
.filters-panel::-webkit-scrollbar {
  width: 6px;
}

.filters-panel::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.filters-panel::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.filters-panel::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Navbar styling for proper z-index hierarchy */
.navbar {
  z-index: 1050; /* Above blotter-container */
  position: relative;
}

/* Ensure navbar dropdowns appear above blotters */
.navbar .dropdown-menu {
  z-index: 1060; /* Higher than navbar and blotter */
}

/* Athlete surname styling in intermediate times */
.intermediate-athlete-name {
  font-size: 0.85em !important;
  font-weight: normal !important;
  color: #666 !important;
  margin-left: 4px;
}

/* Column settings modal - z-index handled by React Portal */

