/* Column Selector CSS (Polished version) */

/* Base Styles */
.ckan-column-selector {
  width: 100% !important;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 20px;
  background-color: #fff;
}

.cs-container {
  display: flex;
  gap: 20px;
}

/* Sidebar Styles */
.cs-sidebar {
  width: 260px;
  background: #f9fafb;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #e5e7eb;
}

.cs-sidebar h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}

#dataset-search {
  width: 100%;
  margin-bottom: 12px;
  border-radius: 8px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
}

.cs-dataset-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.cs-dataset-item {
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.cs-dataset-item:hover {
  border-color: #3b82f6;
  background-color: #f0f9ff;
}

.cs-dataset-item.selected {
  border-color: #3b82f6;
  background-color: #ebf5ff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Main Content Area */
.cs-main {
  flex: 1;
}

/* Tab Navigation */
.cs-tabs {
  display: flex;
  list-style: none;
  padding-left: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}

.cs-tabs li {
  margin-right: 20px;
}

.cs-tabs a {
  display: block;
  padding: 10px 16px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  color: #6b7280;
  text-decoration: none;
}

.cs-tabs li.active a {
  color: #1f2937;
  border-color: #3b82f6;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Column Selection Pills */
.column-selection-header {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #1f2937;
}

#column-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.column-pill {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  background-color: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  margin-bottom: 8px;
}

.column-pill:hover {
  background-color: #e5e7eb;
}

.column-pill.active {
  background-color: #dbeafe;
  border-color: #3b82f6;
  color: #1e40af;
}

.column-pill-text {
  margin-right: 6px;
}

.column-pill-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: white;
  color: #3b82f6;
  font-size: 10px;
}

.column-pill:not(.active) .column-pill-icon {
  color: #9ca3af;
}

/* Data Table Container */
.data-table-container {
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.table-info {
  font-size: 14px;
  color: #6b7280;
}

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

.search-filter input {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  width: 180px;
}

/* Table styles */
.viz-table-container .table {
  margin-bottom: 0;
  width: 100%;
  border-collapse: collapse;
}

.viz-table-container .table th {
  position: sticky;
  top: 0;
  background-color: #f9fafb;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}

.records-per-page {
  display: flex;
  flex-direction: row;
  align-items: center;
  font-size: 14px;
  color: #6b7280;
  gap: 8px;
}

.records-per-page label {
  display: flex;
  align-items: center;
  width: auto;
  margin-bottom: 0;
  white-space: nowrap;
}

.records-per-page select {
  margin: 0 8px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
}

/* Fix for double colon issue */
.table-pagination::before,
.chart-type-options::before {
  content: none !important;
}

/* Hide all unnecessary pseudo-elements that might be creating colons */
[class*="type"]::before,
[class*="type"]::after,
.chart-type-selector::before,
.chart-type-selector::after,
.chart-type-options::after {
  content: none !important;
}

/* Table Styling */
.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cs-table th {
  position: sticky;
  top: 0;
  background-color: #f9fafb;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}

.cs-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  color: #4b5563;
}

.cs-table tr:hover {
  background-color: #f3f4f6;
}

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

/* Pagination Controls */
.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #f9fafb;
  border-top: 1px solid #e5e7eb;
  font-size: 14px;
}

.pagination-info {
  color: #6b7280;
}

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

.pagination-btn {
  padding: 6px 12px;
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
}

.pagination-btn:hover:not([disabled]) {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.pagination-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-pages {
  padding: 0 8px;
  color: #6b7280;
}

.current-page {
  font-weight: 600;
  color: #374151;
}

/* Python Query Editor */
.editor-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.editor-toolbar {
  display: flex;
  gap: 12px;
}

.editor-toolbar .btn {
  display: inline-flex;
  align-items: center;
  background-color: #f0f2f5;
  color: #333;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.editor-toolbar .btn i {
  margin-right: 10px;
}

.editor-toolbar .btn.run {
  background-color: #3b82f6;
  color: white;
  border: none;
}

.editor-toolbar .btn:hover {
  background-color: #e2e8f0;
  color: #000;
}

.editor-toolbar .btn.run:hover {
  background-color: #2563eb;
}

#clear-query {
  background-color: #f8f9fa;
  border-color: #ddd;
  color: #555;
}

#clear-query:hover {
  background-color: #e9ecef;
  border-color: #c6c6c6;
  color: #333;
}

#load-example {
  background-color: #f0f4f8;
  border-color: #c6d3e5;
  color: #456789;
}

#load-example:hover {
  background-color: #e4eaf4;
  border-color: #9abadd;
  color: #2c5282;
}

/* Theme Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
  vertical-align: middle;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  background-color: #ccc;
  position: absolute;
  border-radius: 34px;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: pointer;
  transition: 0.4s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  font-size: 14px;
  color: #fff;
}

.slider:before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 4px;
  bottom: 4px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

input:checked + .slider {
  background-color: #3b82f6;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.sun, .moon {
  z-index: 1;
  pointer-events: none;
}

/* CodeMirror Styling */
.codemirror-wrapper {
  max-width: 100%;
  overflow-x: hidden;
  height: 300px;
  margin-bottom: 1rem;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.CodeMirror {
  height: 100% !important;
  max-width: 100%;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 6px;
}

.CodeMirror-scroll {
  max-width: 100%;
  overflow-x: auto !important;
}

/* Query Result Container */
.result-output-wrapper {
  max-width: 100%;
  max-height: 300px;
  overflow-x: auto;
  overflow-y: auto;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  padding: 10px;
  border-radius: 6px;
  margin-top: 15px;
}

.result-output {
  margin: 0;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Visualization Tab Styling */
/* Source Selector */
.viz-source-selector {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  background-color: #f9fafb;
  border-radius: 8px;
  padding: 10px 15px;
  border: 1px solid #e5e7eb;
}

.viz-source-label {
  font-weight: 500;
  color: #374151;
  margin-right: 15px;
  white-space: nowrap;
}

.viz-source-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.viz-source-option {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.viz-source-option input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.viz-source-button {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background-color: #fff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #6b7280;
  font-weight: 500;
  transition: all 0.2s ease;
}

.viz-source-button i {
  margin-right: 8px;
}

.viz-source-option input:checked + .viz-source-button {
  background-color: #3b82f6;
  color: white;
  border-color: #2563eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.viz-source-option:hover .viz-source-button {
  border-color: #9ca3af;
}

.visualization-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.viz-toolbar-section {
  display: flex;
  align-items: center;
}

/* Chart Type Selector */
.chart-type-selector {
  width: 100%;
  max-width: 800px;
  margin: 0 auto 20px;
}

.chart-type-categories {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chart-category {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.category-header {
  padding: 10px 15px;
  background-color: #f9fafb;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
}

.category-header:hover {
  background-color: #f3f4f6;
}

.category-header i:first-child {
  margin-right: 8px;
  color: #4b5563;
}

.category-options {
  padding: 10px 15px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background-color: #fff;
  display: none; /* Hidden by default */
}

.chart-type-label {
  font-weight: 500;
  color: #374151;
  margin-right: 15px;
  white-space: nowrap;
}

.chart-type-options {
  display: flex;
  gap: 8px;
}

.chart-type-option {
  margin: 0;
  cursor: pointer;
}

.chart-type-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.chart-type-option input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.chart-type-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 70px;
  height: 70px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 4px;
  background-color: #f9fafb;
  transition: all 0.2s ease;
}

.chart-type-button i {
  font-size: 16px;
  margin-bottom: 4px;
}

.chart-type-button span {
  font-size: 11px;
  text-align: center;
  color: #374151;
  font-weight: 500;
}

.chart-type-option input:checked + .chart-type-button {
  background-color: #3b82f6;
  color: white;
  border-color: #2563eb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-type-option:hover .chart-type-button {
  border-color: #d1d5db;
  background-color: #f3f4f6;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Selected state */
.chart-type-option input[type="radio"]:checked + .chart-type-button {
  border-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

.chart-type-option input[type="radio"]:checked + .chart-type-button i,
.chart-type-option input[type="radio"]:checked + .chart-type-button span {
  color: #2563eb;
}

/* Show active category */
.chart-category.active .category-options {
  display: flex;
}

.chart-category.active .category-header {
  border-bottom-color: #e5e7eb;
}

.chart-category.active .category-header i.fa-chevron-down {
  transform: rotate(180deg);
}

.chart-type-option input:checked:hover + .chart-type-button {
  background-color: #2563eb;
}

/* Main container for table visualization */
.chart-container {
  min-height: 450px;
  background: #ffffff;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.chart-container:empty::before {
  content: "Select chart type and generate visualization to display here";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #6c757d;
  font-style: italic;
  text-align: center;
  font-size: 16px;
}


#visualization-canvas {
  width: 100% !important;
  height: 100% !important;
}

.viz-info {
  text-align: center;
  font-size: 13px;
  color: #6b7280;
  margin-top: 10px;
}

/* Ensure the table container respects boundaries */
.viz-table-container {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 0; /* Remove bottom margin to prevent overflow */
}

/* Table responsive wrapper to control horizontal overflow */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: -ms-autohiding-scrollbar;
  border: none;
}

/* Table styling to prevent cell expansion */
.viz-table-container .table,
.chart-container .table {
  margin-bottom: 0;
  width: 100%;
  table-layout: fixed; /* This helps control column widths */
  border-collapse: collapse;
}

/* Cell styling to handle long content */
.viz-table-container .table th,
.viz-table-container .table td,
.chart-container .table th,
.chart-container .table td {
  padding: 12px 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px; /* Limit maximum width of cells */
}

/* Improved table row hover effect */
.viz-table-container .table tr:hover,
.chart-container .table tr:hover {
  background-color: #f3f4f6;
}

/* Table footer that stays at the bottom */
.viz-table-footer,
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #f9fafb;
  border-top: 1px solid #e5e7eb;
  font-size: 13px;
  color: #6b7280;
}

/* Remove double outlines and fix spacing */
.chart-container table {
  border: none;
}

/* Fix vertical alignment to prevent cell stretching */
.chart-container td {
  vertical-align: middle;
}

/* Add fixed header to table to improve usability for long tables */
.viz-table-container .table thead th,
.chart-container .table thead th {
  position: sticky;
  top: 0;
  background-color: #f9fafb;
  z-index: 10;
  border-bottom: 1px solid #e5e7eb;
}

/* Fix for Safari which sometimes has issues with table cells */
@supports (-webkit-overflow-scrolling: touch) {
  .viz-table-container .table th,
  .viz-table-container .table td,
  .chart-container .table th,
  .chart-container .table td {
    max-width: 150px;
  }
}

/* Outer container that holds the entire table component */
.outer-container {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

/* Header section with title and source info */
.visualization-header {
  margin-bottom: 15px;
}

.visualization-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #374151;
}

.source-badge {
  margin-top: 5px;
}

.source-badge-label {
  display: inline-block;
  padding: 4px 8px;
  font-size: 12px;
  background-color: #f3f4f6;
  color: #6b7280;
  border-radius: 9999px;
  font-weight: normal;
}

/* Controls row with entries dropdown, filter, export button */
.table-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

/* Show entries dropdown styling */
.show-entries {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.show-entries label {
  margin-bottom: 0;
  white-space: nowrap;
}

.show-entries select {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #d1d5db;
}

/* Filter input styling */
.filter-container {
  max-width: 200px;
}

.filter-container input {
  width: 100%;
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
}

/* Export button styling */
.export-container button {
  padding: 6px 12px;
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.2s ease;
}

.export-container button:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.export-container button i {
  margin-right: 5px;
}

/* Column info display */
.columns-used-info {
  margin-top: 15px;
  font-size: 13px;
  color: #6b7280;
}

.columns-used-info .badge {
  font-weight: normal;
  padding: 6px 10px;
  background-color: #f3f4f6;
  color: #6b7280;
}

/* Pagination controls styling */
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-btn {
  padding: 5px 10px;
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
}

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

.pagination-btn:not(:disabled):hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.pagination-pages {
  padding: 0 8px;
}

.current-page {
  font-weight: 600;
  color: #374151;
}

/* Fix for double colon issues */
.show-entries::before,
.show-entries::after,
.table-pagination::before,
.table-pagination::after,
.chart-type-options::before,
.chart-type-options::after,
.chart-type-selector::before,
.chart-type-selector::after {
  content: none !important;
  display: none !important;
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #6b7280;
  font-size: 16px;
}

.loading-state i {
  margin-right: 10px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Alert styling within chart container */
.chart-container .alert {
  margin: 0;
  border-radius: 6px;
  padding: 16px;
  display: flex;
  align-items: center;
}

.chart-container .alert i {
  margin-right: 10px;
  font-size: 18px;
}

.chart-container .alert-warning {
  background-color: #fffbeb;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.chart-container .alert-danger {
  background-color: #fef2f2;
  color: #b91c1c;
  border-left: 4px solid #ef4444;
}

/* Mobile responsiveness adjustments */
@media (max-width: 768px) {

  .category-options {
    justify-content: center;
  }

  .chart-type-button {
    width: 60px;
    height: 60px;
  }

  .table-controls-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .filter-container {
    max-width: 100%;
    width: 100%;
  }
  
  .table-footer {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  
  .pagination-controls {
    width: 100%;
    justify-content: space-between;
  }
}


.viz-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}
.viz-table-title {
  display: flex;
  flex-direction: column;
}

.viz-table-title h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #374151;
}


.viz-table-subtitle {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.viz-table-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #374151;
}

.viz-table-tools {
  display: flex;
  gap: 10px;
  align-items: center;
}

.viz-table-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #4b5563;
  font-size: 13px;
  transition: all 0.2s ease;
}

.viz-table-tools button i {
  margin-right: 6px;
}

.viz-table-tools button:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}


.viz-table-tools button i {
  margin-right: 6px;
}

.search-filter input {
  width: 180px;
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
}

/* Table styles */
.viz-table-container .table {
  margin-bottom: 0;
  width: 100%;
  border-collapse: collapse;
}

.viz-table-container .table th {
  position: sticky;
  top: 0;
  background-color: #f9fafb;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
}

.viz-table-container .table td {
  padding: 12px 16px;
  border-top: none;
  border-bottom: 1px solid #e5e7eb;
  color: #4b5563;
}

.viz-table-container .table tr:hover {
  background-color: #f3f4f6;
}

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

.viz-table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: #f9fafb;
  border-top: 1px solid #e5e7eb;
  font-size: 13px;
  color: #6b7280;
}

.source-info .badge {
  display: inline-flex;
  align-items: center;
  background-color: #f3f4f6;
  color: #6b7280;
  font-weight: normal;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 9999px;
}

.source-info .badge i {
  margin-right: 4px;
}

.selected-columns {
  font-size: 12px;
}

.selected-columns strong {
  color: #374151;
  font-weight: 500;
}

/* Loading state for tables */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: #6b7280;
  font-size: 16px;
}

.loading-state i {
  margin-right: 10px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Alert styling within table container */
.chart-container .alert {
  margin: 0;
  border-radius: 6px;
  padding: 16px;
  display: flex;
  align-items: center;
}

.chart-container .alert i {
  margin-right: 10px;
  font-size: 18px;
}

.chart-container .alert-warning {
  background-color: #fffbeb;
  color: #92400e;
  border-left: 4px solid #f59e0b;
}

.chart-container .alert-danger {
  background-color: #fef2f2;
  color: #b91c1c;
  border-left: 4px solid #ef4444;
}

/* Fix for the existing "Show entries:" alignment in the Visualization tab */
.data-table-container .records-per-page {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.data-table-container .records-per-page label,
#cs-visualization .records-per-page label {
  margin-bottom: 0;
  white-space: nowrap;
}

/* Remove double colon from table visualization section */
.chart-type-options::before,
.chart-type-options::after,
#cs-visualization .table-pagination::before,
#cs-visualization .show-entries::before,
#cs-visualization .show-entries::after {
  content: none !important;
}


/* Show entries styling in the Visualization tab */
#cs-visualization .show-entries {
  display: flex;
  align-items: center;
  gap: 8px;
}

#cs-visualization select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background-color: white;
}



.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: 9999px;
}

.badge-light {
  background-color: #f3f4f6;
  color: #6b7280;
}

#export-csv {
  background-color: white;
  border: 1px solid #d1d5db;
  font-size: 12px;
  padding: 4px 10px;
}

#export-csv:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

/* Publish Button */
.viz-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

#publish-visualization {
  padding: 8px 16px;
  background-color: #10b981;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
}

#publish-visualization:hover {
  background-color: #059669;
}

#publish-visualization.disabled {
  background-color: #d1d5db;
  cursor: not-allowed;
  opacity: 0.6;
}

#publish-visualization i {
  margin-right: 6px;
}

/* Modal Styling */
.modal-header {
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 20px;
}

.modal-title {
  font-weight: 600;
  color: #ffffff;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  border-top: 1px solid #e5e7eb;
  padding: 16px 20px;
  background-color: #f9fafb;
}

.card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
  background-color: #f9fafb;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
  color: #4b5563;
}

.card-body {
  padding: 16px;
}

/* Example Query Modal */
.example-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.example-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.example-item:hover {
  background-color: #f9fafb;
  border-color: #d1d5db;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

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

.example-header h5 {
  margin: 0;
  font-weight: 600;
  font-size: 16px;
  color: #1f2937;
}

.badge-info {
  background-color: #dbeafe;
  color: #1e40af;
}

.badge-primary {
  background-color: #e0f2fe;
  color: #0369a1;
}

.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
}

/* Notification System */
#notifications-container {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 350px;
  max-width: 90%;
  z-index: 9999;
}

.notification {
  margin-bottom: 10px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
  animation: slide-in 0.3s ease-out forwards;
}

.notification-info {
  background-color: #eff6ff;
  border-left: 4px solid #3b82f6;
}

.notification-success {
  background-color: #ecfdf5;
  border-left: 4px solid #10b981;
}

.notification-error {
  background-color: #fef2f2;
  border-left: 4px solid #ef4444;
}

.notification-warning {
  background-color: #fffbeb;
  border-left: 4px solid #f59e0b;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background-color: rgba(255, 255, 255, 0.5);
}

.notification-title {
  font-weight: 600;
  font-size: 16px;
}

.notification-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}

.notification-body {
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
}

@keyframes slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading States */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: #6b7280;
}

.loading-spinner:before {
  content: '';
  width: 24px;
  height: 24px;
  margin-right: 10px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spinner 0.7s linear infinite;
}

@keyframes spinner {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Adjustments */
@media (max-width: 992px) {
  .cs-container {
    flex-direction: column;
  }
  
  .cs-sidebar {
    width: 100%;
    margin-bottom: 20px;
  }
  .chart-preview-canvas-wrapper {
    flex-direction: column;
  }

  .chart-preview-panel,
  .chart-canvas-panel {
      width: 100%;
  }

  .charts-grid {
      grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .viz-source-selector,
  .chart-type-selector {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .viz-source-label,
  .chart-type-label {
    margin-bottom: 10px;
  }
  
  .table-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .table-actions {
    margin-top: 10px;
    width: 100%;
    justify-content: space-between;
  }
  
  .search-filter input {
    width: 100%;
  }
  
  .pagination-controls {
    flex-wrap: wrap;
  }
  #chart-preview-list {
    padding: 10px;
  }

  .preview-card {
      width: 160px;
      height: 90px;
  }

  .chart-canvas-panel,
  .chart-preview-panel {
      padding: 15px;
  }

  .empty-state-content {
      padding: 20px 10px;
  }

  .canvas-icon {
      font-size: 2.5rem;
  }
}

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

.preview-card {
  animation: slideIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
      opacity: 0;
  }
  to {
      opacity: 1;
  }
}





.data-source-selector {
  margin-bottom: 20px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 20px;
}

.data-source-label {
  margin-bottom: 10px;
  font-weight: 500;
  color: #374151;
}

.data-source-buttons {
  display: flex;
  gap: 10px;
}

.data-source-btn {
  background-color: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.data-source-btn:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
}

.data-source-btn.active {
  background-color: #ebf5ff;
  border-color: #3b82f6;
  color: #1e40af;
}

.data-source-btn i {
  font-size: 14px;
}

/* Making data source buttons more consistent with design system */
@media (max-width: 576px) {
  .data-source-buttons {
    flex-direction: column;
    width: 100%;
  }
  
  .data-source-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Add this to your CSS file or in a style tag */
.plotly-visualization {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

/* Enhance Plotly tooltips */
.plotly-tooltip {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 6px !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  padding: 8px 12px !important;
}

/* Enhance Plotly axis labels */
.plotly-graph-div .xtick text,
.plotly-graph-div .ytick text {
  font-size: 12px !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

.plotly-graph-div .gtitle,
.plotly-graph-div .xtitle,
.plotly-graph-div .ytitle {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  font-weight: 500 !important;
}

/* Statistical Controls Styling */
.statistical-controls {
  margin-top: 20px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background-color: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.controls-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background-color: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

.controls-header h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.toggle-controls {
  background: transparent;
  border: none;
  color: #6b7280;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.toggle-controls:hover {
  color: #4b5563;
}

.toggle-controls.collapsed i {
  transform: rotate(-180deg);
}

.controls-options {
  padding: 15px;
  border-top: 1px solid #e5e7eb;
  background-color: #ffffff;
}
.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
}

.control-group {
  display: flex;
  flex-direction: column;
  min-width: 120px;
  flex: 1;
}
.control-group label {
  font-size: 12px;
  color: #4b5563;
  margin-bottom: 4px;
}

.control-checkbox {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  cursor: pointer;
}


.control-checkbox input[type="checkbox"] {
  margin-right: 8px;
}

.checkbox-label {
  font-size: 13px;
  color: #4b5563;
}

.control-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid #f3f4f6;
}

/* Responsive behavior */
@media (max-width: 768px) {
  .control-row {
    flex-direction: column;
    gap: 10px;
  }
  
  .control-group {
    width: 100%;
  }

  .preview-card {
    width: 180px;
    height: 100px;
  }

  .preview-card-title {
      font-size: 12px;
  }

  .charts-header {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
  }

  .chart-counters {
      flex-direction: column;
      align-items: flex-start;
      gap: 5px;
  }

  .selection-controls {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
  }
}



/* Phase 1: Enhanced Column Selection Styles */
/* Add this to your column_selector.css file */

/* ====================================================
   ENHANCED AXIS SELECTORS STYLING
   ==================================================== */

   .axis-selectors-container {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 15px 0;
  }
  
  .axis-selectors-container .column-selection-header {
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
  }
  
  .axis-selectors-container .form-group {
    margin-bottom: 15px;
  }
  
  .axis-selectors-container label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
    display: block;
  }
  
  .axis-selectors-container select.form-control {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  }
  
  .axis-selectors-container select.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    outline: 0;
  }
  
  /* Multi-select Y-axis specific styling */
  #y-axis-select {
    min-height: 100px;
    resize: vertical;
  }
  
  #y-axis-select option {
    padding: 5px 8px;
  }
  
  #y-axis-select option:checked {
    background: #007bff !important;
    color: white !important;
  }
  
  /* ====================================================
     FILTER BUILDER STYLING
     ==================================================== */
  
  .filter-builder-container {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    background: white;
    min-height: 60px;
    margin-bottom: 10px;
  }
  
  .filter-builder-container:empty::before {
    content: "No filters applied. Click 'Add Filter' to create data filters.";
    color: #6c757d;
    font-style: italic;
    font-size: 0.85rem;
  }
  
  .filter-row {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    padding: 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
  }
  
  .filter-row:last-child {
    margin-bottom: 0;
  }
  
  .filter-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
  }
  
  .filter-controls select,
  .filter-controls input {
    flex: 1;
    min-width: 0;
  }
  
  .filter-field {
    flex: 2;
  }
  
  .filter-operator {
    flex: 1;
    min-width: 80px;
  }
  
  .filter-value {
    flex: 2;
  }
  
  .remove-filter {
    flex: 0 0 auto;
    padding: 4px 8px;
    margin-left: 5px;
  }
  
  .remove-filter:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
  }
  
  /* Add Filter Button */
  #add-filter {
    border: 1px dashed #007bff;
    background: transparent;
    color: #007bff;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
  }
  
  #add-filter:hover {
    background: #007bff;
    color: white;
    border-style: solid;
  }
  
  /* ====================================================
     ACTION BUTTONS STYLING
     ==================================================== */
  
  .form-group:last-child {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
  }
  
  #apply-column-config {
    background: linear-gradient(135deg, #28a745, #20c997);
    border: none;
    padding: 10px 20px;
    font-weight: 500;
    margin-right: 10px;
    border-radius: 5px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  #apply-column-config:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
  }
  
  #reset-column-config {
    padding: 10px 20px;
    font-weight: 500;
    border-radius: 5px;
    transition: background-color 0.2s ease;
  }
  
  #reset-column-config:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
  }
  
  /* ====================================================
     RESPONSIVE DESIGN
     ==================================================== */
  
  @media (max-width: 768px) {
    .filter-controls {
      flex-direction: column;
      gap: 5px;
    }
    
    .filter-controls select,
    .filter-controls input {
      width: 100%;
    }
    
    .remove-filter {
      margin-left: 0;
      margin-top: 5px;
      width: 100%;
    }
    
    .form-group:last-child {
      text-align: center;
    }
    
    #apply-column-config,
    #reset-column-config {
      width: 100%;
      margin-bottom: 10px;
    }
  }
  
  /* ====================================================
     ENHANCED CHART CONTAINER
     ==================================================== */
  
  #enhanced-viz-chart {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }
  
  /* ====================================================
     FORM VALIDATION & FEEDBACK
     ==================================================== */
  
  .form-control.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
  }
  
  .form-control.is-valid {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
  }
  
  .text-muted {
    font-size: 0.8rem;
    color: #6c757d !important;
    margin-top: 2px;
  }
  
  /* ====================================================
     LOADING & STATUS INDICATORS
     ==================================================== */
  
  .axis-selectors-container.loading {
    opacity: 0.6;
    pointer-events: none;
  }
  
  .axis-selectors-container.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  /* ====================================================
     ACCESSIBILITY IMPROVEMENTS
     ==================================================== */
  
  .axis-selectors-container *:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
  }
  
  .filter-row [aria-label] {
    position: relative;
  }
  
  /* High contrast mode support */
  @media (prefers-contrast: high) {
    .axis-selectors-container {
      border: 2px solid #000;
    }
    
    .filter-row {
      border: 2px solid #000;
    }
  }


  /* Enhanced Filter Builder Styles for Dynamic Values */
/* Add this to your column_selector.css */

/* ====================================================
   ENHANCED FILTER ROW STYLING
   ==================================================== */

.filter-controls {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr auto;
  gap: 8px;
  align-items: center;
  width: 100%;
}

.filter-field {
  grid-column: 1;
}

.filter-operator {
  grid-column: 2;
}

.filter-value-select,
.filter-value-input {
  grid-column: 3;
  transition: opacity 0.2s ease;
}

.remove-filter {
  grid-column: 4;
  padding: 4px 8px;
  margin: 0;
}

/* ====================================================
   IMPROVED VALUE SELECTOR STYLING
   ==================================================== */

.filter-value-select {
  max-height: 150px;
  overflow-y: auto;
}

.filter-value-select option {
  padding: 4px 8px;
  font-size: 0.85rem;
}

.filter-value-input[type="number"] {
  text-align: right;
}

/* ====================================================
   FILTER COUNT INDICATOR
   ==================================================== */

#add-filter {
  position: relative;
  transition: all 0.3s ease;
}

#add-filter.btn-primary {
  background: linear-gradient(135deg, #007bff, #0056b3);
  box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}

#add-filter.btn-primary::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #28a745;
  border-radius: 50%;
  border: 2px solid white;
}

/* ====================================================
   FILTER BUILDER ENHANCEMENTS
   ==================================================== */

.filter-builder-container {
  max-height: 300px;
  overflow-y: auto;
  position: relative;
}

.filter-builder-container:empty::before {
  content: "No filters applied. Click 'Add Filter' to create smart data filters with dropdown values.";
  color: #6c757d;
  font-style: italic;
  font-size: 0.85rem;
  display: block;
  text-align: center;
  padding: 20px;
}

/* ====================================================
   RESPONSIVE GRID FOR MOBILE
   ==================================================== */

@media (max-width: 768px) {
  .filter-controls {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  
  .filter-field,
  .filter-operator,
  .filter-value-select,
  .filter-value-input,
  .remove-filter {
    grid-column: 1;
    width: 100%;
  }
  
  .remove-filter {
    margin-top: 5px;
  }
}

/* ====================================================
   LOADING STATES
   ==================================================== */

.filter-value-select:disabled,
.filter-value-input:disabled {
  background-color: #f8f9fa;
  opacity: 0.6;
}

.filter-row.loading {
  opacity: 0.7;
}

.filter-row.loading::after {
  content: "Loading values...";
  position: absolute;
  right: 50px;
  font-size: 0.75rem;
  color: #6c757d;
  font-style: italic;
}

.filter-value-select {
  display: inline-block !important;
}

.filter-value-select option {
  display: block !important;
  visibility: visible !important;
}

/* Enhanced Python Output Styling */
.python-controls {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.console-section {
  margin-bottom: 20px;
}

.console-output {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 15px;
}

.console-output h6 {
  color: #28a745;
  margin-bottom: 10px;
  font-weight: 600;
}

.console-output pre {
  background: #ffffff;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 10px;
  margin: 0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.4;
  max-height: 300px;
  overflow-y: auto;
}

.console-error {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 8px;
  padding: 15px;
}

.console-error h6 {
  color: #e53e3e;
  margin-bottom: 10px;
  font-weight: 600;
}

.console-error pre {
  background: #ffffff;
  border: 1px solid #fed7d7;
  border-radius: 4px;
  padding: 10px;
  margin: 0;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.4;
  color: #c53030;
  max-height: 200px;
  overflow-y: auto;
}

.chart-output-section {
  margin-top: 20px;
}

.python-chart-container {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.single-chart-display {
  height: 100%;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e9ecef;
}

.chart-header h4 {
  margin: 0;
  color: #495057;
  font-weight: 600;
}

.chart-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.chart-type-badge {
  background: #e9ecef;
  color: #495057;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.chart-visualization-container {
  height: 350px;
  width: 100%;
  position: relative;
}

.single-chart-display,
.multiple-charts-display {
  height: 100%;
  animation: fadeIn 0.4s ease-out;
}

.preview-card:focus,
.card-delete-btn:focus,
.selection-actions button:focus {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Adjust Plotly margins for better fit */
.chart-visualization-container .main-svg,
.grid-chart-container .main-svg {
  border-radius: 4px;
}


/* ===================== */
/* 🔧 UTILITY CLASSES    */
/* ===================== */

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

.slide-in {
  animation: slideIn 0.3s ease-out;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.chart-visualization-container .plotly-graph-div,
.grid-chart-container .plotly-graph-div {
  width: 100% !important;
  height: 100% !important;
}

.charts-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e9ecef;
}

.charts-header h4 {
  margin: 0;
  color: #495057;
  font-weight: 600;
}

.chart-actions {
  display: flex;
  gap: 8px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  width: 100%;
}

.chart-grid-item {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 10px;
  min-height: 250px;
}

.grid-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #dee2e6;
}

.grid-chart-header h6 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-chart-container {
  height: 200px;
  width: 100%;
  background: white;
  border-radius: 4px;
  position: relative;
}

.btn-xs {
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1.4;
  border-radius: 3px;
}


.chart-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6c757d;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 4px;
}

.chart-error i {
  font-size: 2rem;
  margin-bottom: 10px;
  color: #ffc107;
}

.chart-error p {
  margin: 0;
  font-size: 14px;
  font-style: italic;
}


.selection-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0;
  padding: 10px 0;
  border-top: 1px solid #e9ecef;
  border-bottom: 1px solid #e9ecef;
}

.selection-info {
  font-size: 14px;
  color: #6c757d;
  font-weight: 500;
}

.selection-actions {
  display: flex;
  gap: 8px;
}

.selection-actions button {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  background: white;
  color: #6c757d;
  cursor: pointer;
  transition: all 0.2s ease;
}

.selection-actions button:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
}

.selection-actions button i {
  margin-right: 4px;
}


.chart-counters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 15px 0 10px;
  font-size: 13px;
  color: #6c757d;
}

.preview-counter,
.canvas-counter {
  background: #e9ecef;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.canvas-counter {
  background: #d1ecf1;
  color: #0c5460;
}


.chart-header h6 {
  margin: 0;
  color: #495057;
  font-weight: 600;
}

.chart-header .fab.fa-python {
  color: #3776ab;
  margin-right: 8px;
}

.badge-primary {
  background-color: #007bff;
}

/* Loading Animation */
.fa-spinner.fa-spin {
  animation: fa-spin 2s infinite linear;
}

@keyframes fa-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
  .python-controls .row {
    flex-direction: column;
  }
  
  .python-controls .col-md-4 {
    margin-top: 10px;
    text-align: left !important;
  }
}


.python-output-section {
  margin-top: 20px;
}

.console-section {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
}

.chart-output-section {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
  background: white;
  min-height: 100px;
}

.python-controls {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 15px;
}

/* Notification styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  max-width: 350px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.notification-info {
  background-color: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

.notification-success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.notification-error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 8px;
  font-weight: 600;
}

.notification-body {
  padding: 0 16px 12px;
  font-size: 14px;
}

.notification-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.7;
}

.notification-close:hover {
  opacity: 1;
}

@media (max-width: 768px) {
  .python-controls .row {
    flex-direction: column;
  }
  
  .python-controls .col-md-4 {
    text-align: left !important;
    margin-top: 10px;
  }
  
  .notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}


/* Nuclear CSS for Plotly cleanup */
.plot-container.plotly {
  transition: none !important;
  animation: none !important;
}
.js-plotly-plot {
  contain: strict;
}

.modal-xl {
  max-width: 95vw;
}

.examples-container {
  max-height: 70vh;
  overflow-y: auto;
}

/* Enhanced Header */
.examples-header {
  background: #3b82f6;
  color: white;
  padding: 20px;
  border-radius: 10px 10px 0 0;
  margin-bottom: 20px;
}

.filter-controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.search-box {
  position: relative;
}

.search-input {
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 25px;
  color: #000 !important;
  padding: 10px 20px 10px 45px;
  width: 100%;
  font-size: 14px;
}

.search-icon {
  position: absolute;
  left: 15px; 
  top: 50%;
  transform: translateY(-50%);
  color: #666;
}

.filter-select {
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 20px;
  padding: 8px 15px;
  font-size: 14px;
}

.filter-select option {
  color: #000 !important;
}

/* Also force text color on focus and active */
.filter-select:focus,
.filter-select:active {
  color: #111 !important;
}

/* Examples Grid */
.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding: 20px;
}

.example-card {
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 20px;
  background: #fff;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.example-card:hover {
  border-color: #007bff;
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,123,255,0.15);
}

.example-card.selected {
  border-color: #28a745;
  background: linear-gradient(135deg, #f8fff9 0%, #e8f5e9 100%);
  box-shadow: 0 0 0 3px rgba(40,167,69,0.2);
}

.example-card.loading {
  opacity: 0.7;
  pointer-events: none;
}

.example-card.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Card Content */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.chart-icon {
  font-size: 2.5rem;
  margin-right: 15px;
}

.chart-title {
  font-size: 18px;
  font-weight: 600;
  color: #495057;
  margin: 0;
}

.difficulty-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-beginner { background: #e3f2fd; color: #1976d2; }
.badge-intermediate { background: #fff3e0; color: #f57c00; }
.badge-advanced { background: #fce4ec; color: #c2185b; }

.category-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.tag-basic { background: #e3f2fd; color: #1976d2; }
.tag-advanced { background: #f3e5f5; color: #7b1fa2; }
.tag-statistical { background: #fff3e0; color: #f57c00; }
.tag-specialized { background: #e8f5e8; color: #388e3c; }

.chart-description {
  color: #6c757d;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 15px;
}

.data-structure {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 15px;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 12px;
}

.structure-title {
  font-weight: 600;
  color: #495057;
  margin-bottom: 5px;
}

.structure-example {
  color: #6c757d;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

.action-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.load-btn {
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
}

.load-btn:hover {
  background: linear-gradient(135deg, #0056b3, #004085);
  transform: translateY(-1px);
}

.load-btn.loaded {
  background: linear-gradient(135deg, #28a745, #1e7e34);
}

.preview-btn {
  background: #f8f9fa;
  color: #6c757d;
  border: 1px solid #dee2e6;
}

.preview-btn:hover {
  background: #e9ecef;
  color: #495057;
}

.preview-btn.active {
  background: #17a2b8;
  color: white;
  border-color: #17a2b8;
}

.copy-btn {
  background: #6c757d;
  color: white;
}

.copy-btn:hover {
  background: #5a6268;
  transform: translateY(-1px);
}

/* Code Preview Section */
.code-preview {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  margin-top: 20px;
  display: none;
  animation: slideDown 0.3s ease;
}

.code-preview.show {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.preview-title {
  font-weight: 600;
  color: #495057;
  margin: 0;
}

.hide-preview {
  background: none;
  border: none;
  color: #6c757d;
  font-size: 18px;
  cursor: pointer;
}

.code-content {
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
}

.code-block {
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 15px;
  font-family: 'Monaco', 'Consolas', 'Ubuntu Mono', monospace;
  font-size: 13px;
  color: #495057;
  white-space: pre-wrap;
  overflow-x: auto;
}

/* Filter Results */
.filter-results {
  padding: 15px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  font-size: 14px;
  color: #6c757d;
}

.results-count {
  font-weight: 600;
  color: #007bff;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
}

.no-results i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .modal-xl {
    max-width: 95vw;
    margin: 10px;
  }

  .filter-controls {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .examples-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    padding: 15px;
  }

  .card-actions {
    flex-direction: column;
  }

  .examples-container {
    max-height: 60vh;
  }
}


.data-preview-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  margin: 20px 0;
}

.placeholder-content {
  text-align: center;
  max-width: 400px;
  padding: 40px 20px;
}

.placeholder-icon {
  font-size: 48px;
  color: #6c757d;
  margin-bottom: 20px;
}

.placeholder-content h4 {
  color: #495057;
  margin-bottom: 15px;
  font-weight: 600;
}

.placeholder-content p {
  color: #6c757d;
  margin-bottom: 25px;
  line-height: 1.5;
}

.placeholder-steps {
  text-align: left;
}

.step {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
}

.step-number {
  background: #17a2b8;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.step span:last-child {
  color: #495057;
}

.step-text {
  color: #495057;
}



/* ADD THIS TO column_selector.css - Expanded Chart Type Styles */

/* --- Visualization Toolbar & Chart Type Selector Enhancements --- */

/* Overall container for the visualization options */
.visualization-toolbar-expanded {
  background-color: #f8f9fa; /* Light background for the whole toolbar */
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 25px; /* More generous padding around the content */
  margin-top: 25px; /* Space above this section */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Subtle shadow for depth */
}

/* Title for the chart selector section */
.chart-selector-title {
  font-size: 22px; /* Larger, more prominent title */
  font-weight: 700;
  color: #343a40;
  margin-bottom: 25px; /* More space below the title */
  display: flex;
  align-items: center;
}

.chart-selector-title i {
  margin-right: 12px;
  color: #007bff; /* Accent color for the icon */
  font-size: 26px;
}

/* Container for all chart categories */
.chart-type-categories-expanded {
  display: flex;
  flex-direction: column; /* Stack categories vertically */
  gap: 15px; /* Space between each category block */
}

/* Individual chart category card */
.chart-category {
  background-color: #ffffff; /* White background for each category card */
  border: 1px solid #e9ecef;
  border-radius: 10px;
  overflow: hidden; /* Ensures border-radius applies to contents */
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); /* Soft shadow for each category card */
  transition: all 0.3s ease; /* Smooth transitions for hover/active states */
}

/* Style for category header (the "tab" itself) */
.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px; /* Generous padding */
  background-color: #e9ecef; /* Light grey background for headers */
  font-weight: 600;
  color: #495057;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid #dee2e6; /* Separator for options below when collapsed */
}

.category-header:hover {
  background-color: #dee2e6; /* Slightly darker background on hover */
}

.category-header.active {
  background-color: #007bff; /* Primary brand color for active header */
  color: #ffffff;
  border-bottom-color: #007bff; /* Match border color */
}

.category-header i:first-child { /* Icon next to category name */
  margin-right: 10px;
  font-size: 18px;
}

.category-header i:last-child { /* Chevron icon for expand/collapse */
  transition: transform 0.3s ease; /* Smooth rotation */
}

.chart-category.expanded .category-header i:last-child {
  transform: rotate(180deg); /* Rotate chevron when category is expanded */
}

/* Styles for the grid of chart options within a category */
.category-options {
  display: grid;
  /* Responsive grid: auto-fill columns, min width 130px, max 1fr */
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 15px; /* Space between individual chart type buttons */
  padding: 20px; /* Padding inside the options container */
  background-color: #ffffff; /* White background for the options grid */

  /* Make sure the category options are hidden/shown gracefully */
  max-height: 0; /* Initially collapsed */
  overflow: hidden;
  transition: max-height 0.4s ease-out, padding 0.4s ease-out; /* Smooth collapse/expand transition */
  padding-top: 0; /* Start with no padding top/bottom */
  padding-bottom: 0;
}

.chart-category.expanded .category-options {
  max-height: 1000px; /* A sufficiently large value to allow full expansion */
  padding-top: 20px; /* Apply padding when expanded */
  padding-bottom: 20px;
}


/* Refinements for individual chart type buttons (existing classes) */
.chart-type-button {
  padding: 18px 12px; /* Slightly adjusted padding for grid fit */
  min-height: 90px; /* Adjusted minimum height */
  width: auto;
  /* Ensure the existing styles for border, background, shadow, text-align, etc., apply */
}

.chart-type-button i {
  font-size: 28px; /* Larger icons for better recognition */
  margin-bottom: 10px; /* More space below icon */
}

.chart-type-button span {
  font-size: 13px; /* Ensure text is readable */
  font-weight: 500;
}

/* Visual Checkmark for selected chart type */
.chart-type-option {
  position: relative; /* Needed for positioning the checkmark icon */
}

.chart-type-option input[type="radio"]:checked + .chart-type-button::after {
  content: '\f058'; /* FontAwesome check-circle icon */
  font-family: 'Font Awesome 5 Free'; /* Specify FontAwesome font */
  font-weight: 900; /* Use the solid icon variant */
  position: absolute;
  top: 8px;
  right: 8px;
  color: #28a745; /* Green checkmark color */
  font-size: 18px;
  background-color: #fff; /* White circular background for contrast */
  border-radius: 50%;
  padding: 2px;
  line-height: 1; /* Center the icon vertically */
  box-shadow: 0 0 5px rgba(0,0,0,0.2); /* Subtle shadow for the checkmark */
}

/* General improvements for form elements within the visualization tab for consistent look */
#cs-visualization .form-group {
    margin-bottom: 1.5rem; /* More consistent spacing between form groups */
}

#cs-visualization label {
    font-weight: 600; /* Make labels stand out */
    color: #343a40;
    margin-bottom: 8px; /* Space between label and input */
}

/* Add this to your CSS or in a <style> tag */
#publish-modal.modal.show #data-period.form-control {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
}

/* Make sure the container is visible */
#publish-modal.modal.show #data-period-group {
  display: block !important;
}


/* ===================== */
/* 📊 Chart Preview Area */
/* ===================== */
.chart-preview-canvas-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  margin-top: 30px;
}

.chart-preview-panel,

.chart-preview-panel {
  width: 100%;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  margin: 15px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-preview-panel h4 {
  color: #495057;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
}

.chart-preview-panel h4 i {
  margin-right: 8px;
  color: #007bff;
}

.chart-preview-panel p {
  margin-bottom: 15px;
  font-size: 14px;
  color: #6c757d;
}

/* Horizontal scroll for previews (optional) */
#chart-preview-list {
  display: flex;
  flex-direction: row;
  gap: 15px;
  min-height: 140px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #dee2e6;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
}

#chart-preview-list::-webkit-scrollbar {
  height: 6px;
}

#chart-preview-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

#chart-preview-list::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

#chart-preview-list::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Empty State for Preview */
.preview-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #6c757d;
  text-align: center;
  padding: 20px;
}

.preview-empty-state i {
  font-size: 2.5rem;
  margin-bottom: 10px;
  opacity: 0.5;
}

.preview-empty-state p {
  margin: 0;
  font-style: italic;
  font-size: 14px;
}


.preview-card {
  flex: 0 0 auto;
  width: 200px;
  height: 120px;
  background: #fff;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.preview-card:hover {
  border-color: #007bff;
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.15);
  transform: translateY(-2px);
}

.preview-card.selected {
  border-color: #28a745;
  background: linear-gradient(135deg, #f8fff9 0%, #e6f7e6 100%);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

.preview-card-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 8px;
}

.preview-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 5px;
}

.chart-type-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 4px;
  color: #6c757d;
  font-size: 12px;
}

.preview-card.selected .chart-type-icon {
  background: #d4edda;
  color: #155724;
}

.card-delete-btn {
  width: 18px;
  height: 18px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.card-delete-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.preview-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}


.preview-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 4px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-card-meta {
  font-size: 10px;
  color: #6c757d;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chart-type {
  text-transform: capitalize;
  font-weight: 500;
}

.timestamp {
  opacity: 0.8;
}

.preview-card-footer {
  display: flex;
  justify-content: center;
  margin-top: 5px;
}

.selection-indicator {
  font-size: 14px;
  color: #dee2e6;
  transition: color 0.2s ease;
}

.preview-card.selected .selection-indicator {
  color: #28a745;
}



#chart-preview-list:empty::before {
  content: "Generated charts will appear here as horizontal cards";
  color: #6c757d;
  font-style: italic;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

.chart-canvas-panel {
  width: 100%;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  margin: 15px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-canvas-panel h4 {
  color: #495057;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 18px;
  display: flex;
  align-items: center;
}


.chart-canvas-panel h4 i {
  margin-right: 10px;
  color: #17a2b8;
}

.chart-canvas-panel > p {
  margin-bottom: 15px;
  font-size: 14px;
  color: #6c757d;
}


/* Main Chart Display Container - Primary visualization area */
#main-chart-display {
  min-height: 450px;
  background: #ffffff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
}


/* Canvas Empty State */
.canvas-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
}

.empty-state-content {
  text-align: center;
  max-width: 400px;
  padding: 40px 20px;
}

.canvas-icon {
  font-size: 3.5rem;
  color: #dee2e6;
  margin-bottom: 20px;
}

.empty-state-content h4 {
  color: #495057;
  margin-bottom: 15px;
  font-weight: 600;
}

.empty-state-content > p {
  color: #6c757d;
  margin-bottom: 25px;
  line-height: 1.5;
}

.empty-state-steps {
  text-align: left;
}

#main-chart-display:empty::before {
  content: "Select chart type and generate visualization to display here";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #6c757d;
  font-style: italic;
  text-align: center;
}


/* ===================== */
/* 🧩 Chart Canvas Area */
/* ===================== */
#chart-canvas-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  min-height: 120px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 2px dashed #dee2e6;
}


#chart-canvas-grid:empty::before {
  content: "Drag chart cards here to group for publishing";
  color: #6c757d;
  font-style: italic;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

/* 🔖 Shared Card Style */
.preview-card,
.canvas-card {
  width: 180px;
  height: 120px;
  background: #f8f9fa;
  border: 2px dashed #bbb;
  border-radius: 6px;
  position: relative;
  cursor: move;
  transition: all 0.2s ease;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.05);
}

.preview-card:hover,
.canvas-card:hover {
  border-color: #007bff;
}

/* Dragging Feedback */
.preview-card.dragging,
.canvas-card.dragging {
  opacity: 0.6;
  border-color: #007bff;
  background: #e9f5ff;
}

/* ❌ Delete Button */
.card-delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: #dc3545;
  color: white;
  border: none;
  font-size: 12px;
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  cursor: pointer;
  z-index: 5;
}

/* ✅ Publish Button Padding */
#publish-canvas-group {
  margin-top: 15px;
  min-width: 220px;
}

/* 🛠️ Optional: Better text wrapping in cards */
.preview-card-title,
.canvas-card-title {
  font-size: 13px;
  padding: 6px;
  text-align: center;
  word-wrap: break-word;
}

.is-readonly {
  background-color: #f9f9f9;
  cursor: not-allowed;
}



.hierarchy-setup-panel {
  margin-bottom: 1.5rem;
  border-radius: 6px;
}

.hierarchy-setup-panel h4 {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.hierarchy-setup-panel h4 i {
  margin-right: 0.5rem;
  color: #5bc0de;
}

.hierarchy-setup-panel .card {
  border-color: #e9ecef;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Hierarchy Visualization */
#hierarchy-visualization {
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.hierarchy-path {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.hierarchy-node {
  background-color: #e9ecef;
  border-radius: 4px;
  padding: 5px 10px;
  font-size: 14px;
  font-weight: 500;
  color: #495057;
}

.hierarchy-arrow {
  color: #6c757d;
  font-size: 16px;
}

/* Hierarchy Level Rows */
.hierarchy-level-row {
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 8px;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
}

.hierarchy-level-row:hover {
  background-color: #e9ecef;
}

.level-position {
  margin-right: 0.75rem;
}

.level-position .badge {
  min-width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #5bc0de;
}

.level-name {
  margin-right: 0.75rem;
  width: 180px;
}

.column-mapping {
  margin-right: 0.75rem;
  flex-grow: 1;
}

.level-actions {
  display: flex;
  gap: 0.35rem;
}

.level-actions button {
  padding: 0.25rem 0.5rem;
}

/* Hierarchy Filter UI */
.hierarchy-filters {
  background-color: #f0f7fa;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid #5bc0de;
}

.hierarchy-filters h5 {
  margin-bottom: 1rem;
  color: #2c3e50;
  display: flex;
  align-items: center;
}

.hierarchy-filters h5 i {
  margin-right: 0.5rem;
  color: #5bc0de;
}

.hierarchy-filter-group {
  margin-bottom: 1rem;
}

.hierarchy-filter-group label {
  font-weight: 500;
  display: flex;
  align-items: center;
}

.hierarchy-filter-group select {
  border-color: #b8daff;
}

.hierarchy-filter-group select:focus {
  border-color: #5bc0de;
  box-shadow: 0 0 0 0.2rem rgba(91, 192, 222, 0.25);
}

/* Hierarchy Status */
#hierarchy-status {
  background-color: #d1ecf1;
  border-color: #bee5eb;
  color: #0c5460;
  border-radius: 6px;
  margin-bottom: 1rem;
}

#hierarchy-status i {
  color: #5bc0de;
  font-size: 1.2rem;
}

/* Validation Messages */
#hierarchy-validation-messages .alert {
  margin-bottom: 0;
  margin-top: 1rem;
  border-radius: 6px;
}

/* Hierarchy constrained fields */
.hierarchy-constrained {
  border-color: #5bc0de !important;
  background-color: rgba(91, 192, 222, 0.05);
}

.hierarchy-constraint-info {
  margin-top: 4px;
  color: #5bc0de;
  font-size: 12px;
}

.hierarchy-invalid {
  border-color: #dc3545 !important;
}