/**
 * Sidebar Manager Styles
 * 
 * Styles for dynamic sidebar system with view switching
 * Uses ContextPanel styling for consistency
 */

/* Sidebar Container */
.context-panel-sidebar {
  width: 320px;
  background: #ffffff;
  border-left: 1px solid #e1e4e8;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

/* Compact sections for chart options */
.chart-options-view .context-section {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.chart-options-view .context-section:last-of-type {
  border-bottom: none;
}

.chart-options-view .context-form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-bottom: 0;
}

.chart-options-view .context-form-checkbox input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

.chart-options-view .context-form-checkbox span {
  font-weight: 500;
  color: #24292e;
  font-size: 14px;
}

.chart-options-view .context-form-group {
  margin-bottom: 8px;
}

.context-panel-sidebar.transitioning {
  opacity: 0;
  pointer-events: none;
}

/* Sidebar View Base */
.sidebar-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  animation: slideInRight 0.15s ease;
  background: #ffffff;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Sidebar Header - Match ContextPanel style */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid #e1e4e8;
  background: #f6f8fa;
  flex-shrink: 0;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #24292e;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-back-btn {
  padding: 4px 8px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: #57606a;
  font-size: 16px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-back-btn:hover {
  background: #e1e4e8;
  color: #24292e;
}

.sidebar-back-btn i {
  margin: 0;
}

/* Sidebar Content */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
}

.sidebar-content::-webkit-scrollbar {
  width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: #f6f8fa;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: #d0d7de;
  border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: #57606a;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #e1e4e8;
  background: #f6f8fa;
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

/* Use ContextPanel classes for consistency */

/* Chart Options View - reuse context-section */
.chart-options-view .chart-info {
  margin-bottom: 16px;
  padding: 12px;
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
}

.chart-options-view .chart-info h4 {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 600;
  color: #24292e;
}

.chart-options-view .chart-type-label {
  margin: 0;
  font-size: 12px;
  color: #57606a;
}

/* Option groups - use context-section styling */
.option-group {
  margin-bottom: 24px;
}

.option-group:last-child {
  margin-bottom: 0;
}

.option-group h5 {
  font-size: 12px;
  font-weight: 600;
  color: #57606a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

/* Option items - use context-form-group styling */
.option-item {
  margin-bottom: 16px;
}

.option-item:last-child {
  margin-bottom: 0;
}

.option-item label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #24292e;
  margin-bottom: 6px;
  cursor: pointer;
}

.option-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #0969da;
  margin-right: 8px;
}

.option-item input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e1e4e8;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  margin: 8px 0 4px 0;
}

.option-item input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0969da;
  cursor: pointer;
  transition: all 0.2s;
}

.option-item input[type="range"]::-webkit-slider-thumb:hover {
  background: #0860ca;
  transform: scale(1.2);
}

.option-item input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0969da;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.option-item input[type="range"]::-moz-range-thumb:hover {
  background: #0860ca;
  transform: scale(1.2);
}

.option-item input[type="color"] {
  width: 100%;
  height: 40px;
  padding: 4px;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 8px;
}

.option-item input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.option-item input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.option-item input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 4px;
}

.option-item .range-value {
  display: block;
  text-align: right;
  font-size: 12px;
  color: #57606a;
  margin-top: 4px;
}

.option-item select.form-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  font-size: 13px;
  color: #24292e;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}

.option-item select.form-select:hover {
  border-color: #d0d7de;
}

.option-item select.form-select:focus {
  outline: none;
  border-color: #0969da;
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.1);
}

.option-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

/* Saved Charts View - Match ContextPanel styling */
.saved-charts-view .saved-charts-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: #57606a;
}

.saved-charts-view .saved-charts-loading i {
  font-size: 48px;
  color: #d0d7de;
  margin-bottom: 12px;
}

.saved-charts-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-chart-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.saved-chart-item:hover {
  background: #ffffff;
  border-color: #d0d7de;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.saved-chart-item .chart-thumbnail {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  background: #ffffff;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.saved-chart-item .chart-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.saved-chart-item .chart-thumbnail i {
  font-size: 24px;
  color: #d0d7de;
}

.saved-chart-item .chart-info {
  flex: 1;
  min-width: 0;
}

.saved-chart-item .chart-info h4 {
  margin: 0 0 4px 0;
  font-size: 13px;
  font-weight: 600;
  color: #24292e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-chart-item .chart-info .chart-type,
.saved-chart-item .chart-info .chart-date {
  margin: 0;
  font-size: 12px;
  color: #57606a;
}

.saved-chart-item .chart-actions {
  display: flex;
  gap: 4px;
  align-items: flex-start;
}

.saved-chart-item .chart-actions .btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  background: #ffffff;
  color: #24292e;
  transition: all 0.2s;
}

.saved-chart-item .chart-actions .btn-sm:hover {
  background: #f6f8fa;
  border-color: #d0d7de;
}

.saved-chart-item .chart-actions .btn-sm.btn-danger {
  color: #dc3545;
}

.saved-chart-item .chart-actions .btn-sm.btn-danger:hover {
  background: #fff1f0;
  border-color: #dc3545;
}

/* Dataset Info View - Match ContextPanel styling */
.dataset-info-view .dataset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e1e4e8;
}

.dataset-info-view .dataset-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #24292e;
  flex: 1;
}

.dataset-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.dataset-badge.file {
  background: #ddf4ff;
  color: #0969da;
}

.dataset-badge.api,
.dataset-badge.google_sheets {
  background: #dafbe1;
  color: #1a7f37;
}

.dataset-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 24px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f6f8fa;
  font-size: 13px;
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-label {
  font-size: 12px;
  color: #57606a;
}

.stat-value {
  font-size: 13px;
  font-weight: 500;
  color: #24292e;
}

.stat-value.active {
  color: #1a7f37;
}

.stat-value.inactive {
  color: #57606a;
}

.dataset-columns,
.dataset-charts {
  margin-bottom: 24px;
}

.dataset-columns:last-child,
.dataset-charts:last-child {
  margin-bottom: 0;
}

.dataset-columns h5,
.dataset-charts h5 {
  font-size: 12px;
  font-weight: 600;
  color: #57606a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.columns-list,
.charts-using-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.column-item,
.chart-using-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 6px;
  font-size: 12px;
  transition: all 0.2s;
}

.column-item:hover,
.chart-using-item:hover {
  background: #ffffff;
  border-color: #d0d7de;
}

.column-name,
.chart-name {
  font-weight: 500;
  color: #24292e;
  flex: 1;
  font-size: 13px;
}

.column-type,
.chart-type-badge {
  padding: 2px 8px;
  background: #e1e4e8;
  border-radius: 10px;
  font-size: 10px;
  color: #57606a;
  text-transform: uppercase;
  font-weight: 600;
}

.dataset-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

/* Empty States - Match ContextPanel */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state i {
  font-size: 48px;
  color: #d0d7de;
  margin-bottom: 12px;
}

.empty-state p {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #57606a;
  line-height: 1.5;
}

.empty-state small {
  font-size: 13px;
  color: #57606a;
}

.no-charts {
  text-align: center;
  color: #57606a;
  font-size: 13px;
  padding: 20px;
  font-style: italic;
}

/* Error States */
.error-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px;
  text-align: center;
  color: #d1242f;
}

.error-message i {
  font-size: 48px;
  margin-bottom: 16px;
  color: #f85149;
}

.error-message p {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #24292e;
}

.error-message small {
  font-size: 12px;
  color: #57606a;
}

/* Common Button Styles - Match ContextPanel */
.btn,
.context-footer-btn {
  padding: 8px 16px;
  border: 1px solid #e1e4e8;
  background: #ffffff;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  color: #24292e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn:hover,
.context-footer-btn:hover {
  background: #f6f8fa;
  border-color: #d0d7de;
}

.btn.btn-primary,
.context-footer-btn.primary {
  background: #0969da;
  color: #ffffff;
  border-color: #0969da;
}

.btn.btn-primary:hover,
.context-footer-btn.primary:hover {
  background: #0860ca;
  border-color: #0860ca;
}

.btn.btn-secondary {
  background: #ffffff;
  color: #24292e;
  border-color: #e1e4e8;
}

.btn.btn-secondary:hover {
  background: #f6f8fa;
  border-color: #d0d7de;
}

.btn.btn-danger,
.context-action-btn.danger {
  color: #dc3545;
  border-color: #e1e4e8;
}

.btn.btn-danger:hover,
.context-action-btn.danger:hover {
  background: #fff1f0;
  border-color: #dc3545;
}

.btn.btn-block {
  width: 100%;
}

/* Context Action Buttons */
.context-action-btn {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #e1e4e8;
  background: #ffffff;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  color: #24292e;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-action-btn:hover {
  background: #f6f8fa;
  border-color: #d0d7de;
}

/* Responsive */
@media (max-width: 768px) {
  .context-panel-sidebar {
    width: 100%;
    max-width: 320px;
  }
  
  .sidebar-header {
    padding: 12px;
  }
  
  .sidebar-content {
    padding: 12px;
  }
  
  .sidebar-footer {
    padding: 12px;
  }
}
