/* Database specific styles */
body {
  font-family: 'Noto Sans', sans-serif;
  margin: 0;
  padding: 0;
  background-color: var(--primary-bg);
  color: var(--primary-text);
}

.container {
  display: flex;
  padding: 20px 0 20px 20px; /* Remove right padding */
  gap: 20px;
  width: 96%; /* Fixed width instead of max-width */
  max-width: 96%; /* Keep max-width for safety */
  margin-left: 2%;
  align-items: flex-start; /* Ensure top alignment */
  box-sizing: border-box;
  padding-top: 90px; /* Match search.css padding-top */
  overflow-x: hidden; /* Prevent horizontal overflow at container level */
}

.filter-container {
  flex: 0 0 300px;
  padding: 30px;
  background-color: var(--secondary-bg);
  border-radius: 8px;
  box-shadow: var(--box-shadow);
  height: 740px; /* Fixed height instead of viewport calculation */
  overflow-y: auto; /* Make scrollable */
  overflow-x: hidden; /* Hide horizontal overflow */
}
.filter-container::-webkit-scrollbar {
  width: 6px;
}
.filter-container::-webkit-scrollbar-thumb {
  background-color: var(--accent-color);
  border-radius: 4px;
}
.filter-container::-webkit-scrollbar-track {
  background: var(--primary-bg);
}

.ai-container {
  background-color: var(--secondary-bg);
  border-radius: 8px;
  box-shadow: var(--box-shadow);
  padding: 10px 15px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  color: var(--primary-text);
  min-height: 84px;
  height: auto;
  gap: 15px;
  position: relative; /* enables absolutely positioned popover inside */
}


.ai-container .form-group.custom-dropdown {
  flex-direction: column;
  align-items: flex-start;
}
.ai-container .form-group.custom-dropdown label {
  width: 100%;
  margin-bottom: 6px;
  margin-right: 0;
  height: auto;
}
.custom-searchable-dropdown {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
  z-index: 100;
  font-size: 14px;
  display: flex;
  align-items: center;
}
.ai-container .custom-dropdown {
  max-width: 320px; /* Set desired dropdown width */
  width: 100%;
}
.ai-dropdown-wrapper {
  width: 250px;
}
.run-model-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-left: 16px;
  height: 100%;
}

.selection-controls-container {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  padding: 12px 15px;
  background-color: var(--secondary-bg);
  border-radius: 8px;
  box-shadow: var(--box-shadow);
  margin-bottom: 10px;
}

.selection-control-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background-color: var(--primary-bg);
  color: var(--primary-text);
  border: 1px solid var(--accent-color);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  height: 38px;
}

.selection-control-btn:hover {
  background-color: var(--accent-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.selection-control-btn.delete-btn-control {
  background-color: #dc3545;
  border-color: #dc3545;
  color: white;
}

.selection-control-btn.delete-btn-control:hover {
  background-color: #c82333;
  border-color: #c82333;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

.selection-control-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.selection-control-btn .btn-text {
  white-space: nowrap;
}

.run-model-description {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 6px;
}
.run-model-wrapper button {
  padding: 10px 15px;
  font-weight: 600;
  font-size: 13px;
  height: 38px;
  margin: 0;
  background-color: var(--highlight-color);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}
.run-model-wrapper button:hover {
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

/* Results counter styling */
.results-counter-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-left: 16px;
  height: 100%;
}

.results-counter-text {
  font-size: 14px;
  color: var(--primary-text);
  margin: 0;
  font-weight: 500;
}

.results-counter-text span {
  color: var(--highlight-color);
  font-weight: 600;
}

/* Action buttons styling */
.action-buttons-wrapper {
  display: flex;
  margin-left: auto;
  gap: 15px;
  padding-right: 15px;
}
/* Export popover */
.export-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 15px;
  background-color: var(--secondary-bg);
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  box-shadow: var(--box-shadow);
  padding: 10px 12px;
  z-index: 2000;
  min-width: 220px;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.export-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.export-item .icon-button {
  width: 42px;
  height: 42px;
}

.export-item-label {
  font-size: 11px;
  color: var(--secondary-text);
  text-align: center;
}

/* Progress container styles */
.progress-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 20px;
}

.progress-wrapper h3 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 600;
    text-align: center;
}

.progress-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #444;
    border-radius: 8px;
    background: #2a2a2a;
}

.progress-item {
    padding: 12px;
    border-bottom: 1px solid #444;
    background: #333;
}

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

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

.progress-model-name {
    color: #fff;
    font-weight: 500;
    font-size: 14px;
}

.cancel-job-btn {
    background: #ff4444;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cancel-job-btn:hover {
    background: #ff6666;
}

.progress-bar-container {
    position: relative;
    background: #444;
    border-radius: 4px;
    height: 20px;
    overflow: hidden;
}

.progress-bar {
    background: #ff3366;
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    z-index: 1;
}

/* Optional: small caret */
.export-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 28px;
  border-width: 0 6px 6px 6px;
  border-style: solid;
  border-color: transparent transparent var(--accent-color) transparent;
}

.export-popover::after {
  content: "";
  position: absolute;
  top: -5px;
  right: 28px;
  border-width: 0 5px 5px 5px;
  border-style: solid;
  border-color: transparent transparent var(--secondary-bg) transparent;
}

.action-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.icon-button {
  background-color: var(--primary-bg);
  color: var(--primary-text);
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button:hover {
  background-color: var(--highlight-color);
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

.action-button-label {
  font-size: 10px;
  margin-top: 4px;
  color: var(--secondary-text);
}

.right-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 800px; /* Match filter-container height */
  max-width: calc(100% - 320px); /* Prevent expanding beyond available space */
  overflow: hidden; /* Prevent overflow from affecting container */
}

.database-container {
  flex: 1;
  background-color: var(--secondary-bg);
  border-radius: 8px;
  box-shadow: var(--box-shadow);
  padding: 15px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Hide overflow from the container itself */
  width: 100%; /* Take available width of parent */
  max-width: 100%; /* Strictly prevent expanding beyond parent */
  box-sizing: border-box; /* Ensure padding is included in width calculation */
}

/* Create a scrollable wrapper for the table */
.table-wrapper {
  overflow-y: auto; /* Enable vertical scrolling */
  overflow-x: auto; /* Enable horizontal scrolling for table content only */
  height: 100%;
  width: 100%;
  /* Apply the same scrollbar styling as the city container */
  padding: 0 5px; /* Add even padding on both sides for scrollbar symmetry */
  box-sizing: border-box;
  border-radius: 6px; /* Add radius to wrapper for consistent appearance */
}

.table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 12px; /* Increased height for horizontal scrollbar to make it easier to grab */
}

.table-wrapper::-webkit-scrollbar-thumb {
  background-color: var(--accent-color);
  border-radius: 4px;
  /* Add margin to thumb for symmetry */
  border: 2px solid var(--primary-bg);
}

.table-wrapper::-webkit-scrollbar-track {
  background: var(--primary-bg);
  border-radius: 4px; /* Match border-radius for consistent appearance */
  margin: 0 15px; /* Add margin to both sides of scrollbar track */
}

/* Form group styling for consistent form element layout */
.form-group {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: auto;
}

.form-group label {
  width: 80px;
  margin-bottom: 0;
  margin-right: 10px;
  font-weight: 500;
  color: var(--primary-text);
  display: flex;
  align-items: center;
  height: 36px;
}

.form-group select,
.form-group input {
  flex: 1;
  margin-bottom: 0;
  padding: 10px;
  background-color: var(--primary-bg);
  border: 1px solid var(--accent-color);
  color: var(--primary-text);
  border-radius: 4px;
  transition: var(--transition);
}

.filter-container > *:nth-child(1) { z-index: 110; }
.filter-container > *:nth-child(2) { z-index: 109; }
.filter-container > *:nth-child(3) { z-index: 108; }
.filter-container > *:nth-child(4) { z-index: 107; }
.filter-container > *:nth-child(5) { z-index: 106; }
.filter-container > *:nth-child(6) { z-index: 105; }
.filter-container > *:nth-child(7) { z-index: 104; }
.filter-container > *:nth-child(8) { z-index: 103; }
.filter-container > *:nth-child(9) { z-index: 102; }
.filter-container > *:nth-child(10) { z-index: 101; }
.filter-container > *:nth-child(11) { z-index: 100; }
.filter-container > *:nth-child(12) { z-index: 99; }
.filter-container > *:nth-child(13) { z-index: 98; }
.filter-container > *:nth-child(14) { z-index: 97; }
.filter-container > *:nth-child(15) { z-index: 96; }

/* Non-horizontal form elements */
.filter-container label:not(.form-group label) {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--primary-text);
}

.filter-container input:not(.form-group input):not(.range-inputs input),
.filter-container select:not(.form-group select) {
  width: 100%;
  margin-bottom: 20px;
  padding: 10px;
  background-color: var(--primary-bg);
  border: 1px solid var(--accent-color);
  color: var(--primary-text);
  border-radius: 4px;
  transition: var(--transition);
}

/* Specific width for website input */
#websiteInput {
  width: 100%;
  box-sizing: border-box;
}

.filter-container input:focus,
.filter-container select:focus {
  border-color: var(--highlight-color);
  box-shadow: 0 0 0 2px rgba(255, 51, 102, 0.2);
  outline: none;
}

.filter-container button {
  background-color: var(--highlight-color);
  color: white;
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: block;
  margin-top: 10px;
  transition: var(--transition);
  width: 40%; /* Match search.html button width */
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 20px;
  font-weight: 600;
}

.filter-container button:hover {
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

/* Filters main title styling */
.filters-main-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-text);
  margin: 0 0 15px 0;
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent-color);
}

/* Clear all filters button styling */
.clear-all-filters-button {
  background-color: var(--accent-color);
  color: var(--primary-text);
  padding: 10px 15px;
  border: 1px solid var(--highlight-color);
  border-radius: 4px;
  cursor: pointer;
  display: block;
  margin: 0 auto 20px auto;
  transition: var(--transition);
  width: 100%;
  font-weight: 600;
  font-size: 14px;
}

.clear-all-filters-button:hover {
  background-color: var(--highlight-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--hover-shadow);
}

/* Range inputs for min/max */
.range-inputs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.range-inputs input {
  width: 30%;
  padding: 8px 10px;
  background-color: var(--primary-bg);
  border: 1px solid var(--accent-color);
  color: var(--primary-text);
  border-radius: 4px;
  transition: var(--transition);
  height: 36px;
  font-size: 13px;
}

.range-inputs input:focus {
  border-color: var(--highlight-color);
  box-shadow: 0 0 0 2px rgba(255, 51, 102, 0.2);
  outline: none;
}
.form-group .range-inputs {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  flex: 1;
}

/* Date picker styling */
input[type="date"] {
  color-scheme: dark;
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    filter: brightness(0) invert(1);
    cursor: pointer;
    opacity: 1;
}

/* Vertical date range inputs */
.date-range-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  flex: 1;
}

.date-range-inputs input {
  width: 100%;
  padding: 8px 10px;
  background-color: var(--primary-bg);
  border: 1px solid var(--accent-color);
  color: var(--primary-text);
  border-radius: 4px;
  transition: var(--transition);
  height: 36px;
  font-size: 13px;
}

.date-range-inputs input:focus {
  border-color: var(--highlight-color);
  box-shadow: 0 0 0 2px rgba(255, 51, 102, 0.2);
  outline: none;
}

/* Checkbox styling */
.plain-checkboxes {
  padding: 0;
  margin: 0 0 20px 0;
  width: 100%;
}

.checkbox-row {
  text-align: left;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  width: 100%;
}

.checkbox-row input[type="checkbox"] {
  margin-right: 8px;
  width: 16px !important;
  height: 16px !important;
  display: inline-block !important;
  max-width: 16px !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  position: relative;
  top: 0;
}

.checkbox-row input[type="checkbox"]:focus {
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(255, 51, 102, 0.2) !important;
  width: 16px !important;
  height: 16px !important;
}

.checkbox-row label {
  font-size: small;
  color: var(--primary-text);
  display: inline-block;
  margin-bottom: 0 !important;
  font-weight: normal;
  line-height: 16px;
}

/* City container styling */
#selectedCitiesContainer, 
#selectedTypesContainer,
#selectedQueriesContainer,
#selectedTypeIdsContainer,
#selectedAiModelsContainer,
#selectedScrapingStatusesContainer {
  border: 1px solid var(--accent-color);
  border-radius: 4px;
  padding: 4px 6px;
  height: 100px;
  overflow-y: auto;
  background-color: var(--primary-bg);
  display: flex;
  flex-direction: column;
  font-size: small;
  line-height: 1.2;
  position: relative;
  margin-bottom: 15px;
}

#selectedCitiesContainer,
#selectedTypesContainer,
#selectedTypeIdsContainer {
  height: 100px
}

#selectedQueriesContainer,
#selectedAiModelsContainer,
#selectedScrapingStatusesContainer {
  height: 60px
}

/* Scrollbar styling for city/type containers */
#selectedCitiesContainer::-webkit-scrollbar,
#selectedTypesContainer::-webkit-scrollbar,
#selectedQueriesContainer::-webkit-scrollbar,
#selectedTypeIdsContainer::-webkit-scrollbar,
#selectedAiModelsContainer::-webkit-scrollbar,
#selectedScrapingStatusesContainer::-webkit-scrollbar,
#selectedSourcesContainer::-webkit-scrollbar {
  width: 6px;
}

#selectedCitiesContainer::-webkit-scrollbar-thumb,
#selectedTypesContainer::-webkit-scrollbar-thumb,
#selectedQueriesContainer::-webkit-scrollbar-thumb,
#selectedTypeIdsContainer::-webkit-scrollbar-thumb,
#selectedAiModelsContainer::-webkit-scrollbar-thumb,
#selectedScrapingStatusesContainer::-webkit-scrollbar-thumb,
#selectedSourcesContainer::-webkit-scrollbar-thumb {
  background-color: var(--accent-color);
  border-radius: 4px;
}

#selectedCitiesContainer::-webkit-scrollbar-track,
#selectedTypesContainer::-webkit-scrollbar-track,
#selectedQueriesContainer::-webkit-scrollbar-track,
#selectedTypeIdsContainer::-webkit-scrollbar-track,
#selectedAiModelsContainer::-webkit-scrollbar-track,
#selectedScrapingStatusesContainer::-webkit-scrollbar-track,
#selectedSourcesContainer::-webkit-scrollbar-track {
  background: var(--primary-bg);
}

#selectedQueriesContainer:empty::after,
#selectedCitiesContainer:empty::after,
#selectedTypesContainer:empty::after,
#selectedTypeIdsContainer:empty::after,
#selectedAiModelsContainer:empty::after,
#selectedScrapingStatusesContainer:empty::after,
#selectedSourcesContainer:empty::after {
  content: "No items selected";
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
  padding: 10px 5px;
}

/* In-container clear button */
.cities-clear-button, 
.types-clear-button,
.queries-clear-button,
.type-ids-clear-button,
.ai-models-clear-button,
.scraping-statuses-clear-button,
.sources-clear-button {
  position: absolute;
  top: 4px;
  right: 4px;
  background-color: var(--accent-color);
  color: var(--primary-text);
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  z-index: 5;
}

.cities-clear-button:hover, 
.types-clear-button:hover,
.queries-clear-button:hover,
.type-ids-clear-button:hover,
.ai-models-clear-button:hover,
.scraping-statuses-clear-button:hover,
.sources-clear-button:hover {
  background-color: #666;
}

.filter-container #selectedCitiesContainer .cities-clear-button,
.filter-container #selectedTypesContainer .types-clear-button,
.filter-container #selectedQueriesContainer .queries-clear-button,
.filter-container #selectedTypeIdsContainer .type-ids-clear-button,
.filter-container #selectedAiModelsContainer .ai-models-clear-button,
.filter-container #selectedScrapingStatusesContainer .scraping-statuses-clear-button,
.filter-container #selectedSourcesContainer .sources-clear-button {
  position: absolute;
  top: 4px; /* Ensure this matches search.html */
  right: 4px; /* Ensure this matches search.html */
  background-color: var(--accent-color);
  color: var(--primary-text);
  border: none;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  z-index: 5;
  transition: none;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0; /* Remove any margin */
}

/* Target the hover state with high specificity */
.filter-container #selectedCitiesContainer .cities-clear-button:hover,
.filter-container #selectedTypesContainer .types-clear-button:hover,
.filter-container #selectedQueriesContainer .queries-clear-button:hover,
.filter-container #selectedTypeIdsContainer .type-ids-clear-button:hover,
.filter-container #selectedAiModelsContainer .ai-models-clear-button:hover,
.filter-container #selectedScrapingStatusesContainer .scraping-statuses-clear-button:hover,
.filter-container #selectedSourcesContainer .sources-clear-button:hover {
  background-color: #666 !important; /* Use !important to override any other styles */
  transform: none !important; /* Ensure no transformation occurs */
  box-shadow: none !important; /* Ensure no shadow appears */
}

/* Extra padding for the top of the container to make room for the button */
#selectedCitiesContainer .city-tag:first-child,
#selectedTypesContainer .type-tag:first-child,
#selectedQueriesContainer .query-tag:first-child,
#selectedTypeIdsContainer .type-id-tag:first-child,
#selectedAiModelsContainer .ai-model-tag:first-child,
#selectedScrapingStatusesContainer .scraping-status-tag:first-child,
#selectedSourcesContainer .source-tag:first-child {
  margin-top: 20px; /* Ensure this is exactly 20px to match search.html */
}

/* Standard input class for consistent widths */
.standard-input {
  width: 100%;
  box-sizing: border-box;
}

.city-tag, .type-tag, .query-tag, .type-id-tag, .ai-model-tag, .scraping-status-tag, .source-tag {
  display: block;
  padding: 0;
  margin-bottom: 1px;
  cursor: pointer;
  width: fit-content;
  color: var(--primary-text);
  transition: var(--transition);
}
.model-tag {
  display: block;
  padding: 0;
  margin-bottom: 1px;
  cursor: pointer;
  color: var(--primary-text);
  transition: var(--transition);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-tag:hover, .type-tag:hover, .query-tag:hover, .type-id-tag:hover, .ai-model-tag:hover, .scraping-status-tag:hover, .source-tag:hover {
  color: var(--highlight-color);
}

.city-container-title, .type-container-title, .query-container-title, .type-id-container-title, .ai-model-container-title, .scraping-status-container-title, .source-container-title {
  display: block;
  margin-top: 10px;
  margin-bottom: 6px;
  font-weight: 500;
}

/* Dropdown styling */
.custom-searchable-dropdown {
  position: relative;
  width: 100%;
  margin-bottom: 20px;
  z-index: 100;
  font-size: 14px; /* Set base font size for inheritance */
  display: flex;
  align-items: center;
}
.custom-searchable-dropdown label {
  width: 80px;
  margin-bottom: 0;
  margin-right: 10px;
  font-weight: 500;
  color: var(--primary-text);
}

.custom-searchable-dropdown input {
  font-size: 13px;
  font-family: 'Noto Sans', sans-serif;
  padding: 8px 10px;
  box-sizing: border-box;
  background-color: var(--primary-bg);
  border: 1px solid var(--accent-color);
  color: var(--primary-text);
  border-radius: 4px;
  cursor: pointer;
  flex: 1;
  height: 36px;
}

.dropdown-list {
  position: absolute;
  width: 100%;
  max-height: 200px;
  overflow-y: auto;
  background-color: var(--primary-bg);
  border: 1px solid var(--accent-color);
  border-radius: 0 0 4px 4px;
  z-index: 1000;
  display: none;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}
#cityDropdown.dropdown-list.show,
#cityDropdown.show {
  height: auto !important;
  max-height: 300px !important;
  min-height: 30px !important; /* Ensure it has a good minimum size */
  overflow-y: auto !important;
}

.dropdown-list .dropdown-item {
  padding: 8px 10px;
  cursor: pointer;
  font-family: 'Noto Sans', sans-serif;
  font-size: 13px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.5); /* Grey text for unselected items */
  transition: color 0.2s ease, background-color 0.2s ease;
}
/* Hide items with display: none */
.dropdown-item[style*="display: none"] {
  display: none !important;
}
/* Make sure visible items are actually visible */
.dropdown-item:not([style*="display: none"]) {
  display: block !important;
}

/* Additional rule to reinforce selected items having pure white text */
.dropdown-list .dropdown-item.dropdown-item-selected {
  color: rgb(255, 255, 255) !important; /* Force pure white for selected items */
  opacity: 1 !important; /* Ensure full opacity */
}

.dropdown-list .dropdown-item:hover {
  background-color: var(--highlight-color);
  color: rgb(255, 255, 255) !important; /* Completely white text with !important to override any inherited styles */
}

.dropdown-list.show {
  display: block !important;
  max-height: 300px !important;
  overflow-y: auto !important;
  z-index: 9999 !important;
  background-color: #333 !important;
  border: 1px solid #555 !important;
  position: absolute !important;
  width: 100% !important;
}
/* When a dropdown is open, elevate its parent form-group above all others */
.form-group:has(.dropdown-list.show) {
  z-index: 9999 !important;
}

.custom-searchable-dropdown input {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  background-color: var(--primary-bg);
  border: 1px solid var(--accent-color);
  color: var(--primary-text);
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Noto Sans', sans-serif; /* Match body font */
  font-size: 14px; /* Match standard form elements */
}

.dropdown-item:hover {
  background-color: var(--highlight-color);
  color: white;
}
.dropdown-item.default-option {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}
/* Style for "No country" option to distinguish it from default placeholder */
.dropdown-item[data-value="no_country"] {
  color: rgba(255, 255, 255, 0.7);
  font-style: normal;
}
/* Style for default placeholder text in the input field */
input.dropdown-search.default-selected {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}
/* Adjust heights of all input boxes in filter container */
.dropdown-search,
#websiteInput,
.range-inputs input {
  height: 36px;
  box-sizing: border-box;
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: 13px;
}

.custom-dropdown {
  position: relative;
  z-index: 90;
  width: 100%;
  flex: 1;
}

.dropdown-container {
  position: relative !important;
}

.dropdown-search {
  width: 100%;
  padding: 8px 10px;
  background-color: var(--primary-bg);
  border: 1px solid var(--accent-color);
  color: var(--primary-text);
  border-radius: 4px;
  cursor: pointer;
  height: 36px;
  font-size: 13px;
}
/* Make dropdown containers match full width of standard inputs */
.form-group .dropdown-container {
  flex: 1;
  width: 100%;
}

/* City and type dropdown styling */
select {
  height: 38px;
  padding: 8px 12px;
  line-height: 1.5;
  vertical-align: middle;
  appearance: menulist;
  text-align: center;
}

select[multiple]:focus {
  height: 38px;
  overflow: visible;
}

select, 
.form-group select,
.filter-container select,
select[multiple] option {
  padding: 5px 12px;
  position: relative;
  background-color: var(--primary-bg);
  color: var(--primary-text);
  font-family: 'Noto Sans', sans-serif;
  font-size: 12px;
}

input, textarea {
  font-family: 'Noto Sans', sans-serif;
  font-size: 14px;
}

select option:first-child {
  font-style: italic;
  pointer-events: none;
  text-align: center;
}

select option:first-child {
  line-height: normal;
  text-align: center;
}

select[multiple] option:hover {
  background-color: var(--highlight-color);
  color: white;
}

/* Selected option styling */
select[multiple] option.selected-option {
  background-color: var(--highlight-color);
  color: white;
}

/* Column visibility container */
.column-visibility-container {
  border: 1px solid var(--accent-color);
  border-radius: 4px;
  padding: 4px 6px;
  height: 150px;
  overflow-y: auto;
  background-color: var(--primary-bg);
  display: flex;
  flex-direction: column;
  font-size: small;
  line-height: 1.2;
  position: relative;
  margin-bottom: 15px;
}

.column-visibility-container::-webkit-scrollbar {
  width: 6px;
}

.column-visibility-container::-webkit-scrollbar-thumb {
  background-color: var(--accent-color);
  border-radius: 4px;
}

.column-visibility-container::-webkit-scrollbar-track {
  background: var(--primary-bg);
}

.column-visibility-item {
  padding: 6px;
  cursor: pointer;
  border-radius: 4px;
  text-align: center;
  font-size: small;
  font-weight: 500;
  color: var(--primary-text);
  background-color: var(--primary-bg);
  opacity: 1; /* Default full opacity for visible columns */
  transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  position: relative;
}

.column-visibility-item:hover {
  background-color: #444 !important; /* Grey hover background */
  color: white !important;
  opacity: 1; /* Always full opacity on hover */
}

.column-visibility-item.inactive-column {
  opacity: 0.5; /* Reduced opacity for hidden columns */
  color: var(--secondary-text);
}

.column-visibility-item:hover.inactive-column {
  color: white !important;
}

/* Add a visual indicator for active/inactive state */
.column-visibility-item:after {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-left: 6px;
  background-color: var(--highlight-color);
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.column-visibility-item:not(.inactive-column):after {
  opacity: 1;
}

.column-visibility-title {
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

/* Style for selected dropdown items */
.dropdown-item-selected {
  color: rgb(255, 255, 255) !important; /* Completely white text with !important to override any inherited styles */
  background-color: rgba(255, 255, 255, 0.05); /* Slightly lighter background for selected items */
}

/* Table styling */
.database-container table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed; /* Fixed layout ensures columns maintain their width */
  max-width: 100%; /* Prevent table from expanding beyond container */
}

.database-container th {
  position: sticky;
  top: 0;
  background-color: var(--secondary-bg);
  color: var(--primary-text);
  font-weight: 600;
  padding: 12px 8px;
  text-align: left;
  border-bottom: 2px solid var(--accent-color);
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.database-container td {
  padding: 10px 8px;
  color: var(--secondary-text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap; /* Prevent text wrapping */
  overflow: hidden; /* Hide overflow content */
  text-overflow: ellipsis; /* Add ellipsis for overflow text */
  max-width: 200px; /* Maximum width for all cells */
}

/* Set specific widths for different column types */
.company-name {
  width: 200px;
}

.website, .address {
  width: 180px;
}

.phone {
  width: 120px;
}

.type, .open_state, .query, .country, .city {
  width: 100px;
}
.place_id, .data_id, .data_cid, .provider_id, .type_id, .ai_rating, .ai_rating_reason, .ai_model, .ai_id, .ai_evaluation_date, .scraping_status, .scraped_content_length, .scraped_content, .created_at, .source {
  width: 100px;
}
.rating, .reviews {
  width: 80px;
}
.select-column {
  width: 50px;
}

.database-container tr:hover td {
  background-color: rgba(255, 255, 255, 0.05);
}

/* Add tooltip style so users can see full content on hover */
.database-container td:hover {
  position: relative;
}

.database-container td:hover::after {
  content: attr(title);
    position: absolute;
    left: 0;
    top: 100%;
    z-index: 10;
    background-color: var(--primary-bg);
    color: var(--primary-text);
    border: 1px solid var(--accent-color);
    border-radius: 8px; /* Match the 8px border-radius of other containers */
    padding: 5px 8px;
    white-space: normal;
    width: auto;
    max-width: 300px;
    word-wrap: break-word;
    box-shadow: var(--box-shadow); /* Match container shadow for consistency */
}

.hidden-column {
  display: none;
}

.hidden {
  display: none;
}

/* Sort indicators for table headers */
th.sort-asc::after {
  content: ' â–²';
  font-size: 12px;
  color: var(--highlight-color);
}

th.sort-desc::after {
  content: ' â–¼';
  font-size: 12px;
  color: var(--highlight-color);
}

th[data-column]:hover:not([data-column="actions"]) {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Custom Modal Styles */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background-color: var(--secondary-bg);
    border: 1px solid var(--accent-color);
    border-radius: 12px;
    padding: 0;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    margin: 0;
    color: var(--primary-text);
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 20px 24px;
    color: var(--secondary-text);
    font-size: 14px;
    line-height: 1.5;
}

.modal-footer {
    padding: 16px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 120px;
}

.modal-btn-primary {
    background-color: var(--highlight-color);
    color: white;
}

.modal-btn-primary:hover {
    background-color: #ff4477;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 51, 102, 0.3);
}

.modal-btn-secondary {
    background-color: transparent;
    color: var(--primary-text);
    border: 1px solid var(--accent-color);
}

.modal-btn-secondary:hover {
    background-color: var(--accent-color);
    color: white;
}

.modal-btn-cancel {
    background-color: transparent;
    color: var(--secondary-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-btn-cancel:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Notification System Styles */
#notification-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.notification {
    background-color: var(--secondary-bg);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    padding: 16px 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
    position: relative;
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notification.success {
    border-color: #4CAF50;
}

.notification.success .notification-icon {
    color: #4CAF50;
}

.notification.error {
    border-color: #ff3366;
}

.notification.error .notification-icon {
    color: #ff3366;
}

.notification.warning {
    border-color: #FFA500;
}

.notification.warning .notification-icon {
    color: #FFA500;
}

.notification-icon {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-title {
    color: var(--primary-text);
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.notification-message {
    color: var(--secondary-text);
    font-size: 13px;
    line-height: 1.4;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.notification-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-text);
}

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

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

.notification.removing {
    animation: slideOut 0.3s ease-in;
}

/* Add responsive behavior */
@media (max-width: 1200px) {
  
  .container {
    flex-direction: column;
  }

  @media (max-width: 1200px) {
    /* Adjustments for action buttons in responsive view */
    .ai-container {
      flex-wrap: wrap;
      height: auto;
      padding: 15px;
    }
    
    .ai-dropdown-wrapper {
      width: 100%;
      margin-bottom: 15px;
    }
    
    .run-model-wrapper {
      margin-left: 0;
      margin-right: auto;
    }
    
    .action-buttons-wrapper {
      margin-top: 15px;
      width: 100%;
      justify-content: center;
      padding-right: 0;
    }
  }

.delete-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

.delete-btn:hover {
    background-color: #c82333;
}

/* Force minimum widths for date/time/action columns - fixes zero-width issue */
th[data-column="date_added"],
td[data-column="date_added"] {
    min-width: 100px !important;
    width: auto !important;
}

th[data-column="time_added"],
td[data-column="time_added"] {
    min-width: 90px !important;
    width: auto !important;
}

th[data-column="actions"],
td[data-column="actions"] {
    min-width: 80px !important;
    width: auto !important;
}

.date_added {
    width: 100px;
}

.time_added {
    width: 90px;
}

.actions {
    width: 80px;
}

.select-column {
    width: 60px;
    min-width: 60px !important;
}

th[data-column="select"],
td[data-column="select"] {
    text-align: center;
    width: 60px;
    min-width: 60px !important;
}

.select-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0 auto;
    display: block;
}

.select-checkbox:hover {
    transform: scale(1.1);
}

  /* Force container to not expand due to table width */
  html, body {
    overflow-x: hidden;
    max-width: 100%;
  }
  
  .filter-container {
    flex: none;
    width: auto;
    margin-right: 0.5%;
    margin-bottom: 30px;
    height: 450px; /* Fixed height for responsive view */
  }
  
  .database-container {
    margin-top: 0;
    height: 450px; /* Same fixed height for responsive view */
    margin-bottom: 30px; /* Maintain consistent spacing */
  }
}