/* CSS Variables for consistent theming */
:root {
  /* Colors */
  --primary-color: #0078d4;
  --primary-hover: #005a9e;
  --secondary-color: #f0f0f0;
  --danger-color: #d13438;
  --text-color: #333333;
  --light-bg: #f9f9f9;
  --white: #ffffff;
  --border-color: #dddddd;
  
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 10px;
  --spacing-lg: 15px;
  --spacing-xl: 20px;
  
  /* Border radius */
  --border-radius: 4px;
  
  /* Z-index levels */
  --z-dropdown: 5000;
  --z-dropdown-item: 5001;
}

/*=============================================
LAYOUT & BASE STYLES
=============================================*/
/* General Styles */
body {
  font-family: Arial, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing-xl);
  background-color: #f4f4f4;
}

/* App Container */
#app-body {
  width: 100%;
  max-width: 500px; /* Default narrow width */
  margin: 0 auto;
  transition: max-width 0.3s ease;
}

#app-body.expanded-panel {
  max-width: 800px; /* Expanded width */
}

/* Responsive adjustments */
@media (max-width: 600px) {
  #app-body {
      max-width: 100%;
      padding: 0 var(--spacing-md);
  }

  #app-body.expanded-panel {
      max-width: 100%;
  }
}

/* Hidden state utility class */
.hidden {
  display: none;
}

.hidden-row {
  display: none !important;
}

/*=============================================
WELCOME HEADER STYLES
=============================================*/
.ms-welcome__header {
  padding: var(--spacing-xl);
  background-color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ms-welcome__header > h1 {
  color: rgb(36,54,101);
  font-size: 36px;
  font-weight: 600;
}

.ms-welcome__main {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  flex: 1 0 0;
  padding: var(--spacing-md) var(--spacing-xl);
  background-color: rgb(231,230,230);
}

.ms-welcome__main > h2 {
  width: 100%;
  text-align: center;
}

/*=============================================
TAB NAVIGATION STYLES
=============================================*/
.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 0px;
}

/* Combined button and tab-link styles */
.tabs button,
.tab-link {
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--primary-color);
  color: var(--white);
  border: none;
  cursor: pointer;
}

.tabs button:hover,
.tab-link:hover {
  background: var(--primary-hover);
}

/* Active tab styling */
.tab-link.active {
  background-color: #005a9e; /* Darker blue for the active tab */
  font-weight: bold;
  border-bottom: 3px solid white; /* White underline for active tab */
}

/* Hover effect for non-active tabs */
.tab-link:not(.active):hover {
  background-color: #0069c0;
}

.tab-link.hidden-tab {
  display: none; /* Completely hide the tab */
}

/*=============================================
ACCORDION COMPONENT STYLES
=============================================*/
.accordion-section {
  background-color: var(--white);
  border: 1px solid var(--border-color);
  margin-bottom: var(--spacing-md);
  border-radius: var(--border-radius);
  width: 100%;
}

.accordion-header {
  background-color: var(--primary-color);
  color: var(--white);
  cursor: pointer;
  padding: var(--spacing-lg);
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 16px;
  transition: 0.4s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-header:hover {
  background-color: var(--primary-hover);
}

.accordion-content {
  display: none;
  padding: var(--spacing-lg);
  background-color: var(--light-bg);
  max-width: 100%;
  overflow-x: auto;
}

/*=============================================
BUTTON STYLES - COMBINED
=============================================*/
/* Base button styles */
.button-base {
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--border-radius);
  cursor: pointer;
}

/* Primary buttons */
.primary-button,
#add-filter-btn,
.add-filter-btn,
#add-preset-btn,
#build-org-chart,
#save-to-ppt,
#dialog-close {
  background-color: var(--primary-color);
  color: var(--white);
  border: none;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--border-radius);
  cursor: pointer;
}

.primary-button:hover,
#add-filter-btn:hover,
.add-filter-btn:hover,
#add-preset-btn:hover,
#build-org-chart:hover,
#save-to-ppt:hover,
#dialog-close:hover {
  background-color: var(--primary-hover);
  transition: background-color 0.3s ease;
}

/* Secondary buttons */
.secondary-button {
  background-color: var(--secondary-color);
  border: 1px solid #ccc;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--border-radius);
  cursor: pointer;
}

.secondary-button:hover {
  background-color: #e0e0e0;
}

/* Danger buttons */
.remove-filter-btn,
.remove-preset-btn,
.confirm-delete-btn {
  background-color: var(--danger-color);
  color: var(--white);
  border: none;
  padding: 3px 8px;
  cursor: pointer;
  border-radius: var(--border-radius);
}

.remove-filter-btn:hover,
.remove-preset-btn:hover,
.confirm-delete-btn:hover {
  background-color: #d32f2f;
}

/* Mini buttons for dropdowns */
.mini-button {
  background-color: var(--secondary-color);
  border: 1px solid #ccc;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
}

.mini-button:hover {
  background-color: #e0e0e0;
}

/* Success button */
.save-preset-btn {
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 5px 10px;
  cursor: pointer;
}

.save-preset-btn:hover {
  background-color: #45a049;
}

/* Button containers - combined styles */
.button-row,
.button-container,
.scenario-actions,
.filter-controls,
.preset-controls {
  margin-top: var(--spacing-xl);
  display: flex;
  gap: var(--spacing-md);
}

.button-row,
.scenario-actions {
  justify-content: flex-end;
}

.button-container {
  justify-content: center;
}

.preset-controls {
  text-align: left;
}

/*=============================================
FORM ELEMENTS & INPUTS
=============================================*/
/* Radio buttons */
.radio-group {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

/* Combined row styles for settings and fields */
.row-base {
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
}

.setting-row,
.field-row {
  margin-bottom: var(--spacing-md);
  display: flex;
  align-items: center;
}

.setting-row label {
  min-width: 150px;
}

.field-row label {
  min-width: 120px;
  margin-right: var(--spacing-md);
}

.field-value {
  font-weight: bold;
  padding: 5px;
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  min-height: 20px;
}

.full-width {
  flex-grow: 1;
}

.short-input {
  width: 60px;
}

/*=============================================
DROPDOWN & SELECT COMPONENTS - CONSOLIDATED
=============================================*/
/* Base dropdown styles */
.dropdown-base {
  position: relative;
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  background-color: var(--white);
}

.checkbox-dropdown {
  position: relative;
  flex: 2;
  border: 1px solid #ccc;
  border-radius: var(--border-radius);
  background-color: var(--white);
  cursor: pointer;
}

.values-dropdown {
  min-width: 150px;
}

/* Column dropdown */
.column-dropdown {
  flex: 1;
  min-width: 120px;
  padding: 6px;
}

/* Dropdown header */
.dropdown-header {
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}

/* Dropdown list container - removed duplicated properties and !important */
.dropdown-list {
  position: absolute;
  z-index: 10000;
  background-color: var(--white);
  border: 1px solid #ccc;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  top: 100%;
  left: 0;
}

/* Hidden state */
.dropdown-list.hidden {
  display: none;
}

/* Visible states */
.dropdown-list.show,
.dropdown-list:not(.hidden) {
  display: block;
}

/* Dropdown items */
.dropdown-item {
  padding: var(--spacing-sm);
  cursor: pointer;
}

.dropdown-item label {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  font-size: 14px;
  pointer-events: auto;
  position: relative;
  z-index: var(--z-dropdown-item);
}

.dropdown-item input[type="checkbox"] {
  margin-right: var(--spacing-sm);
  pointer-events: auto;
  position: relative;
  z-index: var(--z-dropdown-item);
}

/* Checkbox list container */
.checkbox-list {
  padding: var(--spacing-sm);
}

/* Select controls in dropdown */
.select-controls {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-bottom: 1px solid #eee;
  margin-bottom: var(--spacing-sm);
}

/* Dropdown controls */
.dropdown-controls {
  background-color: var(--light-bg);
  padding: 5px;
  border-bottom: 1px solid #eee;
}

/*=============================================
FILTER ROWS - COMBINED WITH OTHER ROW STYLES
=============================================*/
.filter-row {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  align-items: center;
}

.filter-row select {
  flex-grow: 1;
}

/*=============================================
BOX SELECTION LAYOUT
=============================================*/
.box-selection-layout {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.box-row {
  display: flex;
  gap: var(--spacing-md);
}

.row-top, .row-bottom-1, .row-bottom-2 {
  justify-content: space-between;
}

.row-top select, 
.row-bottom-1 select, 
.row-bottom-2 select {
  flex: 1;
}

.row-mid-1, .row-mid-2 {
  justify-content: center;
}

.single-box-wrapper {
  display: flex;
  flex: 3;
}

.single-box-wrapper select {
  flex: 1;
  width: 100%;
}

/*=============================================
COLOR SETTINGS & SORT SETTINGS - CONSOLIDATED
=============================================*/
.color-section {
  margin-bottom: var(--spacing-xl);
}

/* Unified container for scrollable content (used for both color and sort) */
.scrollable-container {
  margin-top: var(--spacing-lg);
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  padding: var(--spacing-md);
  background-color: var(--light-bg);
}

/* Applied to both color and sort containers */
.color-levels-container,
.sort-levels-container {
  margin-top: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  padding: var(--spacing-md);
  background-color: var(--light-bg);
}

.color-levels-container:not(:empty),
.sort-levels-container:not(:empty) {
  display: block;
}

/* Combined row styles for color and sort levels */
.level-row {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: 12px;
  align-items: center;
}

/* Applied to both color and sort level rows */
.color-level-row,
.sort-level-row {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: 12px;
  align-items: center;
}

/* Combined placeholder styles */
.color-level-row.placeholder,
.sort-level-row.placeholder {
  justify-content: center;
  padding: var(--spacing-md);
  color: #666;
}

.level-label {
  min-width: 180px;
}

.color-inputs {
  display: flex;
  gap: 5px;
}

/* Sort Order Input */
.sort-order-container {
  display: flex;
  gap: 5px;
  align-items: center;
}

.sort-order-input {
  width: 60px;
  height: 25px;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

/* Style for sort variable settings */
.sort-variable-section {
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

/* Combined heading styles for containers */
.color-levels-container h4,
.sort-levels-container h4 {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
  font-size: 14px;
  font-weight: bold;
}

/* Error indication for duplicate order values */
.sort-order-input.duplicate {
  border-color: var(--danger-color);
  background-color: rgba(209, 52, 56, 0.1);
}

.duplicate-warning {
  color: var(--danger-color);
  margin-left: 5px;
  font-weight: bold;
}

/*=============================================
SCENARIO PLANNING STYLES
=============================================*/
.scenario-container {
  margin: var(--spacing-xl) 0;
  background-color: var(--light-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
}

.scenario-controls {
  margin-bottom: var(--spacing-xl);
}

.action-selector {
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background-color: #eee;
  border-radius: var(--border-radius);
}

.action-panel {
  border: 1px solid #ccc;
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

/* Panel Columns Layout */
.panel-columns {
  display: flex;
  gap: var(--spacing-xl);
}

.left-column, .right-column {
  flex: 1;
  padding: var(--spacing-lg);
}

.left-column {
  background-color: #fffde7; /* Light yellow */
}

.right-column {
  background-color: #e8eaf6; /* Light blue */
}

/* Search Results */
.search-results {
  max-height: 200px;
  overflow-y: auto;
  margin: var(--spacing-md) 0;
  border: 1px solid var(--border-color);
}

.search-results table {
  width: 100%;
  border-collapse: collapse;
}

.search-results th, .search-results td {
  padding: var(--spacing-sm);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.search-results tr:hover {
  background-color: #f5f5f5;
  cursor: pointer;
}

/*=============================================
LOADING & NOTIFICATION COMPONENTS
=============================================*/
/* Loading Overlay */
#loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.loading-content {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 5px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  max-width: 80%;
}

.loading-spinner {
  border: 5px solid #f3f3f3;
  border-radius: 50%;
  border-top: 5px solid #0078d4;
  width: 40px;
  height: 40px;
  margin: 0 auto 15px auto;
  animation: spin 1s linear infinite;
}

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

#loading-message {
  font-size: 16px;
  margin: 0;
  color: #333333;
}

/* Notification styles - combined success and error */
.notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: 4px;
  color: white;
  z-index: 9999;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  display: none;
  font-weight: bold;
  min-width: 200px;
  max-width: 80%;
  text-align: center;
}

.notification.success {
  background-color: #4CAF50; /* Green */
}

.notification.error {
  background-color: #F44336; /* Red */
}

/*=============================================
DIALOG COMPONENTS
=============================================*/
/* Dialog Overlay */
#dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Dialog Box */
#dialog-box {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 400px;
  padding: 20px;
}

/* Dialog Content */
#dialog-content {
  text-align: center;
}

#dialog-content h3 {
  margin-top: 0;
  color: #0078d4;
  font-size: 18px;
}

#dialog-content p {
  margin: 15px 0;
  line-height: 1.5;
  font-size: 14px;
}

/* Instructions styling */
#dialog-content p:nth-child(3) {
  text-align: left;
  background-color: #f0f0f0;
  padding: 10px;
  border-radius: 4px;
  white-space: pre-line;
  font-weight: normal;
}

/* File note styling */
.file-note {
  text-align: left;
  font-size: 13px !important;
  color: #555;
  margin-top: 20px !important;
  font-style: italic;
}

/* File Path styling */
.file-path {
  display: block;
  background-color: #e8f0fe;
  padding: 6px 10px;
  margin: 5px 0;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  overflow-wrap: break-word;
  word-break: break-all;
  text-align: left;
  font-style: normal;
}

/*=============================================
PRESET MANAGEMENT STYLES - CONSOLIDATED
=============================================*/
/* Preset management styling */
.preset-header-row {
  display: flex;
  font-weight: bold;
  margin-bottom: 10px;
  padding: 0 5px;
}

.preset-name-header {
  flex: 1;
}

.preset-actions-header {
  width: 110px; /* Adjusted to match the two buttons */
  text-align: center;
}

.preset-default-header {
  width: 60px;
  text-align: center;
}

.preset-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.preset-rename-input {
  flex: 1;
  padding: 5px;
  margin-right: 10px;
}

.preset-actions {
  display: flex;
  width: 110px; /* Width for both buttons */
  gap: 5px;
  justify-content: flex-start;
}

.preset-default-container {
  width: 60px;
  display: flex;
  justify-content: center;
}

/* Preset dropdown in manager section */
#presetApplyDropdown {
  width: 100%;
  padding: 6px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

/* Preset management section */
#preset-container {
  background-color: white;
  padding: 10px;
}

/* Save Settings Section styles */
.save-settings-section {
  background-color: #f0f7ff;
  padding: 12px;
  margin-bottom: 15px;
  border-radius: 4px;
  border: 1px solid #cce5ff;
}

.save-settings-section h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #0067b8;
}

.new-preset-container {
  padding: 8px;
  background-color: #e6f2ff;
  border-radius: 4px;
  margin-bottom: 10px;
}

.preset-description {
  margin: 10px 0;
  font-size: 13px;
  color: #666;
  font-style: italic;
}

.right-aligned {
  justify-content: flex-end;
}

.section-separator {
  height: 1px;
  background-color: #dddddd;
  margin: 15px 0;
}

/* Optional: Styling for Manage Presets section */
.preset-container h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #333;
}

/* professional Feature Styling */
.professional-feature {
  position: relative;
  opacity: 0.85;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
  overflow: visible;
}

/* professional feature overlay and badge */
.professional-feature::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
  z-index: 1;
}

.professional-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: #0078d4;
  color: white;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 3px;
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* professional feature controls - disabled state styling */
.professional-feature select,
.professional-feature input,
.professional-feature button:not(.upgrade-button) {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Hover effect on professional feature containers */
.professional-feature:hover {
  box-shadow: 0 0 0 2px rgba(0, 120, 212, 0.3);
}

/* Upgrade button that appears in professional features */
.upgrade-button {
  background-color: #0078d4;
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  margin-top: 10px;
  margin-bottom: 5px;
  z-index: 3;
  position: relative;
  pointer-events: auto;
}

.upgrade-button:hover {
  background-color: #005a9e;
}

/* Tooltips for professional features */
.professional-tooltip {
  position: relative;
  display: inline-block;
}

.professional-tooltip .professional-tooltip-text {
  visibility: hidden;
  width: 220px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 4px;
  padding: 8px;
  position: absolute;
  z-index: 1001;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
  pointer-events: none;
}

.professional-tooltip .professional-tooltip-text::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

.professional-tooltip:hover .professional-tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Upgrade dialog styling */
.upgrade-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.upgrade-dialog-content {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.upgrade-dialog-title {
  font-size: 18px;
  margin-top: 0;
  margin-bottom: 10px;
  color: #0078d4;
}

.upgrade-dialog-body {
  margin-bottom: 20px;
}

.upgrade-dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Feature comparison table */
.feature-comparison {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
}

.feature-comparison th,
.feature-comparison td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.feature-comparison th {
  background-color: #f5f5f5;
  font-weight: bold;
}

.feature-comparison .feature-available {
  color: #4CAF50;
}

.feature-comparison .feature-unavailable {
  color: #F44336;
}

/* Why Upgrade section/button */
.why-upgrade-button {
  background-color: transparent;
  border: 1px solid #0078d4;
  color: #0078d4;
  padding: 5px 10px;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 10px 0;
}

.why-upgrade-button:hover {
  background-color: rgba(0, 120, 212, 0.1);
}

/* For accordion sections that contain professional features */
.accordion-section.contains-professional-features .accordion-header {
  position: relative;
}

.accordion-section.contains-professional-features .accordion-header::after {
  content: 'Pro';
  position: absolute;
  right: 30px;
  top: 50%;
  transform: translateY(-50%);
  background-color: #0078d4;
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Remove the badge from professional content if header already has it */
.accordion-section.contains-professional-features .professional-feature .professional-badge {
  display: none;
}

/* professional radio option styling */
.radio-group .professional-option {
  position: relative;
  padding-right: 45px; /* Make room for the badge */
}

.radio-group .professional-option .professional-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  background-color: #0078d4;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
}

/* Demo Mode Banner Styles */
.demo-mode-banner {
  background: linear-gradient(90deg, #ff6b35, #e55100);
  color: white;
  padding: 8px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: background-color 0.2s ease;
}

.demo-mode-banner:hover {
  background: linear-gradient(90deg, #e55100, #cc4400);
}

.demo-mode-banner .banner-link {
  font-size: 12px;
  opacity: 0.9;
}

.demo-mode-banner .banner-link:hover {
  opacity: 1;
}

/* Transparency Controls */
.transparency-section {
  border-top: 1px solid #eee;
  padding-top: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.transparency-global {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.transparency-slider {
  flex: 1;
  height: 6px;
  background: linear-gradient(to right, transparent 0%, #2196F3 100%);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.transparency-input {
  width: 50px;
  text-align: center;
}

.advanced-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  margin-bottom: var(--spacing-md);
}

.advanced-toggle input[type="checkbox"] {
  margin: 0;
}

.transparency-individual {
  width: 45px;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
  text-align: center;
}

.transparency-unit {
  font-size: 12px;
  color: #666;
  min-width: 15px;
}

/* Advanced mode styling */
.advanced-mode .transparency-individual {
  display: block;
}

.simple-mode .transparency-individual {
  display: none;
}

.simple-mode .transparency-unit {
  display: none;
}

.preset-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.preset-dropdown {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.reset-button {
    padding: 8px 12px;
    background: #007acc;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    white-space: nowrap;
    font-weight: 500;
    min-width: 40px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reset-button:hover {
    background: #005a9e;
}

.reset-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Enhanced nested dropdown styles for people filter */
.leader-group {
  margin-left: 0;
  padding-left: 0;
}

.leader-item {
  padding: 4px 8px;
  display: flex;
  align-items: center;
}

.leader-item:hover {
  background-color: #f0f0f0;
}

.leader-label {
  display: flex;
  flex-grow: 1;
  align-items: center;
  cursor: pointer;
}

.toggle-button {
  background: none;
  border: none;
  font-size: 12px;
  cursor: pointer;
  margin-right: 5px;
  width: 16px;
  text-align: center;
}

.sublevel-container {
  margin-left: 20px;
}

.sublevel-item {
  padding: 4px 8px;
}

.sub-sublevel-container {
  margin-left: 20px;
}

.sub-sublevel-item {
  padding: 4px 8px;
}

/* Data Display Options Styles */
.data-type-toggle {
    margin-bottom: 20px;
    padding: 12px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.data-type-toggle h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.display-levels-container {
    margin-top: 20px;
}

.display-levels-container h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #333;
}

.display-level-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    gap: 8px;
}

.display-level-row.placeholder {
    color: #666;
    font-style: italic;
    justify-content: center;
}

.level-label {
    min-width: 120px;
    font-weight: 500;
}

.condition-dropdown {
    width: 80px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
}

.value-input {
    width: 60px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
}

.range-separator {
    margin: 0 4px;
    font-weight: bold;
}

.display-type-toggle {
    display: flex;
    gap: 10px;
}

.display-type-toggle label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: normal;
    min-width: auto;
}

.symbol-dropdown {
    width: 120px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    font-family: Arial, sans-serif;
}

.text-input {
    width: 80px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
}

.color-input {
    width: 30px;
    height: 26px;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.hex-input {
    width: 70px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    text-transform: uppercase;
}

.symbol-preview {
    min-width: 30px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    padding: 4px;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.remove-rule-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 12px;
}

.add-rule-btn {
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
}

.save-section {
    margin-top: 20px;
    padding: 12px;
    background-color: #f0f7ff;
    border: 1px solid #cce5ff;
    border-radius: 4px;
}

.save-section h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #0067b8;
}

.save-section p {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #666;
}

.unsaved-indicator {
    color: #ff6b35;
    font-size: 12px;
    margin-left: 8px;
}

/* Button row for side-by-side layout */
.button-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
}

/* Ensure buttons in the row are properly sized */
.button-row .primary-button,
.button-row .secondary-button {
    flex: 0 0 auto; /* Don't grow or shrink */
    min-width: 120px; /* Minimum width for consistency */
}

/* Responsive adjustment for smaller screens */
@media (max-width: 400px) {
    .button-row {
        flex-direction: column;
        gap: 5px;
    }
    
    .button-row .primary-button,
    .button-row .secondary-button {
        width: 100%;
    }
}

/* Build hierarchy section styling */
.build-hierarchy-section {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.build-hierarchy-section label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

.build-hierarchy-section .button-container {
    text-align: center;
}

.build-hierarchy-section .primary-button {
    min-width: 150px;
}

/*=============================================
HELP TAB SPECIFIC STYLES
=============================================*/

/* Help container - override the main app container for help page */
#helpGuide .help-container {
    max-width: 100%;
    margin: 0;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: none;
}

#helpGuide h1 {
    color: #243665;
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.2em;
}

#helpGuide h2 {
    color: #0078d4;
    border-bottom: 2px solid #0078d4;
    padding-bottom: 5px;
    margin-top: 30px;
}

/* App overview section */
#helpGuide .app-overview {
    background-color: #f0f8ff;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #0078d4;
}

#helpGuide .key-features {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
}

#helpGuide .key-features h3 {
    color: #243665;
    margin-top: 0;
    margin-bottom: 10px;
}

#helpGuide .key-features ul {
    margin: 0;
    padding-left: 20px;
}

#helpGuide .key-features li {
    margin-bottom: 8px;
}

/* Sub-accordion styles */
#helpGuide .sub-accordion-section {
    background-color: white;
    border: 1px solid #ccc;
    margin-bottom: 8px;
    border-radius: 3px;
}

#helpGuide .sub-accordion-header {
    background-color: #f5f5f5;
    color: #333;
    cursor: pointer;
    padding: 10px 15px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#helpGuide .sub-accordion-header:hover {
    background-color: #e8e8e8;
}

#helpGuide .sub-accordion-content {
    display: none;
    padding: 15px;
    background-color: #fafafa;
}

/* Step list styling */
#helpGuide .step-list {
    counter-reset: step-counter;
    padding-left: 30px;
}

#helpGuide .step-list li {
    counter-increment: step-counter;
    margin-bottom: 15px;
    padding-left: 10px;
    position: relative;
}

#helpGuide .step-list li::before {
    content: counter(step-counter);
    position: absolute;
    left: -25px;
    background-color: #0078d4;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Information boxes */
#helpGuide .data-requirements {
    background-color: #fff3cd;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
    margin: 15px 0;
}

#helpGuide .tip-box {
    background-color: #d4edda;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #28a745;
    margin: 15px 0;
}

#helpGuide .warning-box {
    background-color: #f8d7da;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #dc3545;
    margin: 15px 0;
}

/* Feature comparison table */
#helpGuide .feature-comparison {
    overflow-x: auto;
}

#helpGuide .feature-comparison table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

#helpGuide .feature-comparison th,
#helpGuide .feature-comparison td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#helpGuide .feature-comparison th {
    background-color: #0078d4;
    color: white;
}

#helpGuide .checkmark {
    color: #28a745;
    font-weight: bold;
}

#helpGuide .x-mark {
    color: #dc3545;
    font-weight: bold;
}

/* Support info section */
#helpGuide .support-info {
    background-color: #e7f3ff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-top: 30px;
}

/* Responsive adjustments for help page */
@media (max-width: 600px) {
    #helpGuide .help-container {
        padding: 10px;
    }
    
    #helpGuide h1 {
        font-size: 1.8em;
    }
    
    #helpGuide .step-list {
        padding-left: 20px;
    }
    
    #helpGuide .feature-comparison table {
        font-size: 14px;
    }
}

/* Add these CSS rules to the existing help section styles in taskpane.css */

/* Support info section - enhance existing styles */
#helpGuide .support-info {
    background-color: #e7f3ff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin-top: 30px;
}

/* Link styling within help section */
#helpGuide .support-info a {
    color: #0078d4;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

#helpGuide .support-info a:hover {
    color: #005a9e;
    text-decoration: underline;
}

#helpGuide .support-info a:visited {
    color: #0078d4; /* Keep the same color for visited links */
}

/* Legal links section styling */
#helpGuide .support-info h3 {
    color: #243665;
    margin: 0;
}

/* Separator styling between legal links */
#helpGuide .support-info a + a::before {
    content: " ";
    margin: 0 8px;
}

/* Allow the entire Filter Rules accordion section to overflow */
.accordion-section.contains-professional-features {
  overflow: visible !important;
}

/* Allow the accordion content to overflow */
.accordion-section.contains-professional-features .accordion-content {
  overflow: visible !important;
}

/* Remove the clipping from the professional-feature wrapper */
.professional-feature {
  overflow: visible !important;
}

/* Or specifically target just the filter container */
#filter-container {
  min-height: 200px;
}

/* Additional CSS for sort sections */
.sort-variable-section {
    padding-bottom: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.sort-variable-section:last-of-type {
    border-bottom: none;
}

.remove-sort-btn {
    background-color: var(--danger-color);
    color: var(--white);
    border: none;
    padding: 3px 8px;
    cursor: pointer;
    border-radius: var(--border-radius);
    margin-left: var(--spacing-sm);
}

.remove-sort-btn:hover {
    background-color: #d32f2f;
}

/* Modify the setting row to accommodate the remove button */
.setting-row.with-remove {
    align-items: center;
}

.setting-row.with-remove select {
    flex: 1;
    margin-right: var(--spacing-sm);
}

const additionalCSS = `
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0078d4;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

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

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
}

/* Welcome Tab Specific Styles */
.features-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.features-section h3 {
    color: #0078d4;
    font-size: 18px;
    margin-bottom: 16px;
    border-bottom: 2px solid #0078d4;
    padding-bottom: 8px;
}

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

.features-list li {
    padding: 8px 0;
    padding-left: 20px;
    position: relative;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
}

.features-list li:before {
    content: "•";
    color: #0078d4;
    font-weight: bold;
    position: absolute;
    left: 0;
    font-size: 16px;
}

/* Account value section (expand existing if you have similar) */
.account-value {
    background: #f0f7ff;
    border: 1px solid #d1e7ff;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.account-value h3 {
    color: #0066cc;
    font-size: 18px;
    margin-bottom: 12px;
}

.account-value p {
    color: #444;
    line-height: 1.6;
    margin-bottom: 16px;
    text-align: left;
}

.account-benefits {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.account-benefit {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
    padding: 4px 0;
}

.account-benefit::before {
    content: "✓";
    color: #107c10;
    font-weight: bold;
    font-size: 14px;
}

/* Action section styles */
.action-section {
    text-align: center;
    margin-top: 24px;
}

.skip-link {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    margin-top: 16px;
    display: inline-block;
}

.skip-link:hover {
    color: #0078d4;
    text-decoration: underline;
}

/* Responsive adjustments for Welcome tab */
@media (max-width: 600px) {
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons button {
        width: 100%;
        max-width: 280px;
    }
}