/* ==========================================================================
   Global Styles & Scrollbar
   ========================================================================== */

/* Custom scrollbar for better aesthetics (optional) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #555;
}

body {
  font-family: 'Inter', sans-serif; /* Assuming Inter is a preferred font */
  margin: 0; /* Ensure no default body margin */
  line-height: 1.5; /* Improve text readability */
}

/* ==========================================================================
   Loading Indicator
   ========================================================================== */

.loader {
  border: 4px solid #f3f3f3; /* Light grey */
  border-top: 4px solid #3498db; /* Blue */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000; /* High z-index to be on top */
}

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

.loading-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(200, 200, 200, 0.5); /* Semi-transparent overlay */
  z-index: 9999; /* Below loader but above content */
  display: none; /* Hidden by default, shown via JS */
  align-items: center; /* Used with display: flex in JS */
  justify-content: center; /* Used with display: flex in JS */
}

/* ==========================================================================
   Tooltip Styles
   ========================================================================== */

.tooltip {
  position: relative;
  display: inline-block;
  cursor: help; /* Indicate hover interaction */
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 160px;
  background-color: #555; /* Dark background */
  color: #fff; /* White text */
  text-align: center;
  border-radius: 6px;
  padding: 8px; /* Increased padding */
  position: absolute;
  z-index: 1;
  bottom: 125%; /* Position the tooltip above the element */
  left: 50%;
  margin-left: -80px; /* Use half of the width to center the tooltip */
  opacity: 0;
  transition: opacity 0.3s ease-in-out; /* Smooth transition */
  font-size: 0.75rem; /* text-xs */
  white-space: pre-line; /* Allow newlines (\n) in tooltip text */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Subtle shadow */
}

/* Show tooltip on hover */
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* ==========================================================================
   Modal Styles (Holding History)
   ========================================================================== */

#holdingHistoryModal {
  /* Position and overlay are handled inline in JS */
  z-index: 10001; /* Above loading overlay */
}

#holdingHistoryModalContent {
  max-height: 90vh; /* Limit height to prevent overflow */
  overflow-y: auto; /* Allow scrolling within modal if content exceeds height */
}

/* ==========================================================================
   Tailwind Component Overrides / Plotly Specific (If needed)
   ========================================================================== */

/* Ensure Plotly treemap text is visible (Handled primarily in JS `insidetextfont`) */
/* CSS targeting here is less reliable than Plotly's own config */

/* ==========================================================================
   Sector Trends Page Styles (from test.html, adapted)
   ========================================================================== */
.chart-section-container {
  background-color: #ffffff; /* bg-white */
  padding: 1.5rem; /* p-6 */
  border-radius: 0.75rem; /* rounded-xl */
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05); /* shadow-lg */
  margin-bottom: 2rem; /* mb-8 */
}

.chart-title-header { /* For individual chart titles within Sector Trends page */
  font-size: 1.125rem; /* text-lg */
  font-weight: 600; /* font-semibold */
  margin-bottom: 1rem; /* mb-4 */
  text-align: center;
  color: #374151; /* text-gray-700 */
}

.chart-canvas-container { /* Container for each canvas on Sector Trends page */
  position: relative;
  margin: 1rem auto; /* mx-auto my-4 */
  height: 65vh; /* Taller for better readability with many sectors */
  width: 95%; /* Take most of the width of its parent */
  max-width: 900px; /* Max width for very large screens */
}