/**
 * Column Type Panel Styles
 */

/* Column Type Panel */
.column-type-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1050;
  display: flex;
  flex-direction: column;
}

.column-type-panel::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.column-type-panel.hidden {
  display: none;
}

.column-type-header {
  padding: 20px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.column-type-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.2em;
}

.column-type-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.column-type-actions .btn-small {
  padding: 6px 12px;
  font-size: 0.9em;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.column-type-actions .btn-small:hover {
  background: #e5e5e5;
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 1.2em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.close-btn:hover {
  background: #e74c3c;
  color: white;
}

.column-type-content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.column-type-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.column-type-item {
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 15px;
  display: grid;
  grid-template-columns: 1fr auto 150px;
  gap: 15px;
  align-items: center;
  transition: all 0.2s;
}

.column-type-item:hover {
  border-color: #3498db;
  background: #f0f7ff;
}

.column-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-name {
  font-weight: 500;
  color: #333;
}

.auto-detect-hint {
  color: #f39c12;
  cursor: help;
  font-size: 1.2em;
}

.column-type-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.column-type-select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  font-size: 0.95em;
  cursor: pointer;
}

.type-options-btn {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  cursor: pointer;
  font-size: 1.1em;
  transition: all 0.2s;
}

.type-options-btn:not(:disabled):hover {
  background: #3498db;
  border-color: #3498db;
  color: white;
}

.type-options-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.type-preview {
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #666;
  text-align: right;
}

.preview-value {
  background: white;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
}

.no-preview {
  color: #999;
  font-style: italic;
}

.column-type-footer {
  padding: 20px;
  border-top: 1px solid #e5e5e5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
}

.btn-secondary {
  background: #ecf0f1;
  color: #333;
}

.btn-secondary:hover {
  background: #bdc3c7;
}

/* Type Options Dialog */
.type-options-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
}

.type-options-content {
  background: white;
  padding: 25px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  min-width: 300px;
}

.type-options-content h4 {
  margin: 0 0 20px 0;
  color: #333;
}

.type-options-content label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
  color: #555;
}

.type-options-content input,
.type-options-content select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1em;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Time Range Slider Styles */
.time-range-slider {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 20px;
  padding: 15px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.time-range-slider.hidden {
  display: none;
}

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

.slider-header h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #2d3748;
}

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

.date-column-select {
  padding: 6px 10px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 0.85rem;
  background: white;
  cursor: pointer;
}

.date-column-select:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.reset-btn {
  padding: 6px 12px;
  font-size: 0.85rem;
  background: #edf2f7;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.reset-btn:hover {
  background: #e2e8f0;
  border-color: #a0aec0;
}

.slider-container {
  position: relative;
  padding: 20px 0;
}

.slider-track {
  position: relative;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  margin: 10px 0 30px 0;
  cursor: pointer;
}

.slider-range {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, #3182ce, #2b77cb);
  border-radius: 4px;
  pointer-events: none;
}

.slider-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border: 2px solid #3182ce;
  border-radius: 50%;
  cursor: grab;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.slider-handle:hover {
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.slider-handle.active {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.15);
  border-color: #2c5aa0;
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.3);
}

.time-range-slider.dragging .slider-handle {
  transition: none;
}

.handle-tooltip {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: #2d3748;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.handle-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #2d3748;
}

.slider-handle:hover .handle-tooltip,
.slider-handle.active .handle-tooltip {
  opacity: 1;
}

.slider-labels {
  position: relative;
  height: 20px;
  margin-top: 10px;
}

.year-label {
  position: absolute;
  font-size: 0.75rem;
  color: #718096;
  transform: translateX(-50%);
  user-select: none;
}

/* Removed problematic first/last child positioning rules that caused misalignment */
.year-label:first-child,
.year-label:last-child {
  transform: translateX(-50%); /* Use standard centering for all labels */
}

.slider-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.85rem;
  color: #4a5568;
}

.current-range strong {
  color: #2d3748;
  font-weight: 600;
}

.data-count {
  color: #718096;
}

.data-count span {
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .slider-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  
  .slider-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .date-column-select {
    flex: 1;
    margin-right: 10px;
  }
  
  .slider-info {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  
  .year-label {
    font-size: 0.7rem;
  }
}

/* Animation for smooth transitions */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.time-range-slider:not(.hidden) {
  animation: slideIn 0.3s ease;
}

/* Date Range Filter Styles */
.date-range-filter {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  max-height: 80vh;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1040;
  display: flex;
  flex-direction: column;
}

.date-range-filter::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: -1;
}

.date-range-filter.hidden {
  display: none;
}

.date-filter-header {
  padding: 15px;
  border-bottom: 1px solid #e5e5e5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.date-filter-header h4 {
  margin: 0;
  color: #333;
}

.date-filter-content {
  padding: 15px;
  max-height: 400px;
  overflow-y: auto;
}

.date-filter-item {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f0f0;
}

.date-filter-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.date-filter-item h5 {
  margin: 0 0 10px 0;
  color: #555;
  font-size: 1em;
}

.date-range-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.date-input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.date-input-group label {
  font-size: 0.85em;
  color: #666;
}

.date-input-group input[type="date"] {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9em;
}

.quick-ranges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.quick-range-btn {
  padding: 4px 10px;
  font-size: 0.8em;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-range-btn:hover {
  background: #3498db;
  color: white;
  border-color: #3498db;
}

.date-range-info {
  color: #999;
  font-size: 0.85em;
}

.date-filter-actions {
  padding: 15px;
  border-top: 1px solid #e5e5e5;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.no-date-columns {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 20px;
}

/* Button to show column types in main UI */
.column-types-btn {
  background: #3498db;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.column-types-btn:hover {
  background: #2980b9;
}

/* Date filter button in visualization panel */
.date-filter-btn {
  background: #9b59b6;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.date-filter-btn:hover {
  background: #8e44ad;
}

.date-filter-btn.active {
  background: #e74c3c;
}