:root {
  --primary-color: #b88b8b;
  --secondary-color: #ff0000;
  --text-color: rgb(24, 23, 23);
  --background-color: #f8f9fa;
  --header-padding: 10px 20px;
  --header-margin-bottom: 20px;
  --font-size: 16px;
  --line-height: 1.5;
  --spacing: 10px;
}

body {
  font-family: Arial, sans-serif;
  padding: 20px;
  display: flex;
  background-color: #f8f9fa;
  color: #333;
  flex-direction: column;
  direction: ltr;
  text-align: left;
  font-size: var(--font-size);
  line-height: var(--line-height);
  background-color: var(--background-color);
  min-height: 100vh; /* Ensure the body takes up the full height of the viewport */
}

/* Header */
.header {
  background: linear-gradient(to right, #000000, #0056b3);

  background-color: var(--primary-color);
  color: var(--text-color);
  padding: var(--header-padding);
  margin-bottom: var(--header-margin-bottom);

  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 20px;
  text-align: left;
}

.header h1 {
  margin: 0;
  font-size: 1.6em;
  color: #2c3e50;
  font-weight: bold;
}

.header nav {
  display: flex;
  gap: 15px;
}

.header nav a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 1em;
  transition: color 0.3s;
}

.header nav a:hover {
  color: var(--secondary-color);
}

button {
  background-color: var(--secondary-color);
  color: var(--text-color);
  margin-left: auto;
  padding: 10px 20px;
  font-size: 16px;
  background-color: #000000;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
  background-color: #0056b3;
  transform: translateY(-2px);
}

button:active {
  background-color: #003f7f;
  transform: translateY(0);
}

/* Main Content Area */
.main-content {
  display: flex;
  justify-content: space-between;
  flex-direction: row;
  text-align: left;
  flex-wrap: nowrap;
}

.left-section {
  flex: 0 1 300px;
  min-width: 280px;
  margin-right: 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
}

.right-section {
  flex: 1;
  padding-left: 20px;
  text-align: left;
}

/* Controls Section */
.controls-section {
  padding-bottom: 10px;
}

/* Section Headings */
.controls-section h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.1em;
  color: #2c3e50;
  border-bottom: 1px solid #e0e4e8;
  padding-bottom: 5px;
  font-weight: bold;
}

/* Input Groups */
.input-group {
  margin-bottom: 15px;
}

/* Labels */
.input-group label {
  margin-bottom: 5px;
  font-weight: bold;
  color: #34495e;
  display: block;
}

/* Dropdowns */
.dropdown,
.input-box,
.moduleC_input-box {
  width: 100%;
  padding: 5px 10px; /* Adjusted padding */
  font-size: 17px !important;
  line-height: 1.75; /* Increased line-height */
  min-height: 36px; /* Set a minimum height */
  border: 1px solid #ccd6dd;
  border-radius: 5px;
  background-color: #fff;
  transition: border-color 0.3s;
  box-sizing: border-box;
}
.moduleC_input-box {
  width: 20%;
}
.dropdown:focus,
.input-box:focus {
  border-color: #000000;
  outline: none;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #4caf50;
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Icon Buttons for Toggle Switches and Model Selection */
.icon-toggle {
  display: flex;
  margin-top: 5px;
}

.icon-btn {
  flex: 1;
  padding: 10px 12px; /* Unified padding */
  font-size: 14px;
  border: 1px solid #ccd6dd;
  background-color: #fff;
  color: #34495e;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
  height: 40px; /* Unified height */
}

.icon-btn:first-child {
  border-right: none;
  border-radius: 5px 0 0 5px;
}

.icon-btn:last-child {
  border-radius: 0 5px 5px 0;
}

.icon-btn.active {
  background-color: #4caf50;
  color: #fff;
  border-color: #000000;
}
.icon-btn.active.locked {
  background-color: #828282;
}
.icon-btn:hover {
  background-color: #e6e6e6;
}

/* Container for the slider and its value */
.slider-container {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 10px !important; /* Add spacing between sliders */
}

.slider-container input[type="range"] {
  flex-grow: 1 !important; /* Make the slider take up most of the space */
  margin-right: 10px !important; /* Add some spacing between slider and value */
}

.slider-container .slider-value {
  flex-shrink: 0 !important; /* Ensure the value stays at a fixed size */
  white-space: nowrap !important; /* Prevent the value from wrapping to a new line */
}

/* Ensure input-group elements stack properly */
.input-group {
  margin-bottom: 20px !important;
}
.input-group.zoom {
  margin-bottom: 20px !important;
}
/* Optional: Style for slider labels */
.slider-label {
  display: block !important;
  font-weight: bold !important;
  margin-bottom: 5px !important;
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: #ddd;
  outline: none;
  border-radius: 5px;
  margin-top: 8px;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #4caf50;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.slider::-webkit-slider-thumb:hover {
  background-color: #45a049;
}

.slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #4caf50;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.slider::-moz-range-thumb:hover {
  background-color: #45a049;
}

.slider-value {
  margin-left: 8px;
  font-size: 14px;
  color: #2c3e50;
}

/* Results */
.results {
  margin-top: 10px;
  padding: 20px;
  background: linear-gradient(145deg, #f0f4f8, #ffffff);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), inset 0 0 8px rgba(0, 0, 0, 0.05);
  text-align: left;
  box-sizing: border-box;
  border: 1px solid #e0e0e0;
}

.results h2 {
  font-size: 1.6em;
  margin-bottom: 15px;
  color: #2c3e50;
  font-weight: bold;
}

.result-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e0e4e8;
  line-height: 1.2;
}

.result-label {
  font-weight: bold;
  color: #34495e;
}

.result-value {
  font-size: 1em;
  color: #000;
  font-weight: bold;
}

.results-icon {
  margin-right: 8px;
  color: #4caf50;
}

.bold-label {
  font-weight: bold;
}

.custom-dropdown {
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%2334495e"><polygon points="0,0 16,0 8,8"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
}

.custom-dropdown option {
  padding: 10px;
}

.strategy-box {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  padding: 20px !important;
  box-sizing: border-box !important;
  height: 100% !important;
  width: 100% !important;
  background-color: #f9f9f9 !important;
  border: 1px solid #ccc !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  white-space: normal !important;
  word-wrap: break-word !important;
}

.strategy-box p {
  margin: 0 !important;
  line-height: 1.5 !important;
  font-size: 16px !important;
  width: 100% !important;
  vertical-align: middle !important;
}

/* Reduce gap between the "Model" label and the selection buttons/dropdown */
.model-label {
  margin-right: 5px !important;
  font-weight: bold !important;
}

.icon-btn {
  padding: 8px 10px !important;
  font-size: 14px !important;
}

/* Additional styles for new elements */
.input-group .input-label {
  font-weight: bold;
  margin-bottom: 5px;
}
.input-group .input-field {
  width: 100%;
  padding: 5px 10px;
  font-size: 17px !important;
  line-height: 1.75;
  min-height: 36px;
  border: 1px solid #ccd6dd;
  border-radius: 5px;
  background-color: #fff;
  transition: border-color 0.3s;
  box-sizing: border-box;
}
.input-group .input-field:focus {
  border-color: #4caf50;
  outline: none;
}

/* Custom styles for Plotly range selector buttons */
.custom-range-selector {
  display: flex;
  justify-content: left;
}

.custom-range-selector {
  display: flex;
  align-items: center;
}

.custom-range-selector button {
  background-color: #f8f9fa; /* Light gray background */
  border: 1px solid #d1d5da; /* Subtle border for definition */
  color: #212529; /* Dark text color for contrast */
  padding: 6px 12px; /* Adjust the padding for a neat look */
  margin: 0 2px;
  font-size: 14px;
  font-family: "Montserrat", "Bebas Neue", sans-serif;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.custom-range-selector .date-icon {
  font-size: 18px; /* Icon size */
  color: #000000; /* Icon color (slightly muted) */
  margin-left: 10px; /* Space between the buttons and the icon */
  margin-top: 3px;
}

.custom-range-selector button:hover {
  background-color: #e2e6ea; /* Slightly darker background on hover */
  border-color: #b3b6bc; /* Darken the border on hover */
}

.custom-range-selector button.active {
  color: #1f98c8; /* White text for active button */
  border-color: #000000;
}

/* Model C Customization Styles */
#modelCContainer {
  margin-top: 20px;
  padding: 15px;
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

#modelCContainer h3 {
  font-size: 1.2em;
  margin-bottom: 15px;
  color: #2c3e50;
  font-weight: bold;
}

#modelCTable {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 10px;
}

#modelCTable th,
#modelCTable td {
  border: 1px solid #ddd;
  padding: 8px;
  /* text-align: left; */
  /* Add this line to reduce font size */
  font-size: 14px; /* Adjust the size as needed */
  /* Optional: Center the text */
  text-align: center;
}

#modelCTable th {
  background-color: #f2f2f2;
  font-weight: bold;
}

#modelCTable tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

#modelCTable input[type="number"] {
  width: 100%;
  padding: 5px;
  box-sizing: border-box;
  font-size: 14px;
  border: 1px solid #ccd6dd;
  border-radius: 4px;
}

/* Style for Add and Remove Row Buttons */
#modelCButtons {
  margin-top: 10px;
}

#modelCButtons button {
  padding: 8px 12px;
  margin-right: 5px;
  font-size: 14px;
  color: #fff;
  background-color: #4caf50;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

/* Adjust input group styles for Model C */
#modelCParameters .input-group {
  margin-bottom: 15px;
}

#modelCParameters label {
  font-weight: bold;
  margin-bottom: 5px;
}

/* Hide the default sliders */
.hidden {
  display: none !important;
}

/* Styles for Reset Threshold Slider */
#div_resetThresholdValue {
  margin-bottom: 15px;
}

#div_resetThresholdValue .slider-label {
  font-weight: bold;
  margin-bottom: 5px;
}

#div_resetThresholdValue .slider-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#div_resetThresholdValue .slider {
  flex-grow: 1;
  margin-right: 10px;
}

#div_resetThresholdValue .slider-value {
  flex-shrink: 0;
  white-space: nowrap;
}

/* Styles for Holding Ratio Result Item */
#holdingRatioResult {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e0e4e8;
  line-height: 1.2;
}

#holdingRatioResult .result-label {
  font-weight: bold;
  color: #34495e;
}

#holdingRatioResult .result-value {
  font-size: 1em;
  color: #000;
  font-weight: bold;
}

/* Loading Overlay Styles */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.loading-container {
  display: flex;
  flex-direction: column; /* Stack spinner and text vertically */
  align-items: center; /* Center items horizontally */
  gap: 20px; /* Add space between spinner and text */
}

.spinner {
  border: 6px solid rgba(0, 0, 0, 0.1);
  border-top: 6px solid #4caf50;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

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

.loading-overlay p {
  font-size: 18px;
  color: #333;
  font-weight: bold;
  margin: 0;
}

#saveSettings {
  margin-left: 10px;
  background-color: #000000; /* Blue color 2196F3 */
}

#saveSettings:hover {
  background-color: #0b7dda;
}

/* Form styles */
form {
  margin-bottom: 20px;
}

form input,
form select {
  padding: 10px;
  margin: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Chart container */
#totalPortfolioChart {
  width: 100%;
  height: 500px;
  background-color: #f8f9fa; /* Match the background color */
  background-color: var(--background-color); /* Match the background color */
}

/* Responsive styles */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  table,
  th,
  td {
    font-size: 14px;
    padding: 8px;
    text-align: left;
    border: 1px solid #ddd;
  }

  button {
    padding: 8px 16px;
  }

  form input,
  form select {
    padding: 8px;
  }
}

/* Normalize spacing and text sizes */
.left-column {
  padding: var(--spacing);
  font-size: var(--font-size);
}

.left-column h2 {
  font-size: 1.25em;
  margin-bottom: var(--spacing);
}

.left-column p {
  margin-bottom: var(--spacing);
}
/* Smooth transition for expansion */
/* Set an initial max-height for the collapsed state (adjust as needed) */
/* gear icon next to CSV button */
.settings-icon{
  font-size: 22px;
  margin-left: 12px;
  cursor: pointer;
  color: #ffffff;          /* same as buttons */
  transition: transform .2s;
}
.settings-icon:hover{ transform: rotate(90deg);}
