/**
 * Scatter Chart Specific Styles
 * Application-specific styling for the NAEI Activity Data Scatter Chart viewer
 */

/* Loading overlay */
#loadingOverlay { 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  background: rgba(255,255,255,0.98); 
  z-index: 9999; 
  transition: opacity .35s ease; 
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

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

.loading-text {
  font-size: 14px;
  color: #666;
  text-align: center;
}

/* Override chart height for scatter chart */
#chart_div { 
  height: 70vh;
  min-height: 500px;
}

/* Year selector styling */
#yearSelect {
  min-width: 120px;
}

/* Main content opacity control (matching linechart v2.3) */
#mainContent { 
  display: none; 
  opacity: 0; 
  transition: opacity .4s ease; 
}

#mainContent.loaded { 
  opacity: 1; 
}

/* Chart wrapper opacity control (matching linechart v2.3) */
.chart-wrapper {
  margin-top: 20px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out 0.1s;
}

.chart-wrapper.visible {
  opacity: 1;
}

/* Custom spinner to match linechart */
.spinner { 
  width: 72px; 
  height: 72px; 
  border-radius: 50%; 
  background: conic-gradient(#E6194B 0deg 120deg, #F58231 120deg 240deg, #FFE119 240deg 360deg); 
  animation: spin 1.25s linear infinite; 
  box-shadow: 0 0 12px rgba(0,0,0,0.08);
  outline: none;
  border: none;
  margin: 0;
  flex-shrink: 0;
}

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

/* Loading overlay */
#loadingOverlay { 
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100vw; 
  height: 100vh; 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  background: rgba(255,255,255,0.98); 
  z-index: 9999; 
  transition: opacity .35s ease;
  margin: 0;
  padding: 0;
}

.loading-text { 
  margin-top: 16px; 
  font-size: 18px; 
  color: #333; 
  font-weight: 600;
  text-align: center;
}

/* Sidebar base styles - matches linechart */
.sidebar-socials {
  position: absolute;
  top: 0;
  right: 0;
  width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center; /* Center-align the logo and icon blocks */
  z-index: 100;
}

.sidebar-icons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  align-items: center; /* Center the four social icons */
}

/* Ko-fi button styling (from v2.3) */
.kofi-wrapper {
  width: 40px; /* Match the width of the icons above */
  height: 40px; /* Match the height */
  position: relative; /* This is the anchor for the absolute button */
  margin-top: 13px;
}

.kofi-button {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  background-color: #ff9301;
  border-radius: 8px;
  height: 40px;
  color: white;
  text-decoration: none;
  overflow: hidden;
  
  /* --- The Fix --- */
  position: absolute;
  top: 0;
  right: 0; /* Anchor the button to the right of the wrapper */
  width: 40px; /* Initial width */
  transition: width 0.4s ease-in-out; /* Animate only the width */
}

.kofi-wrapper:hover .kofi-button {
  width: 295px; /* Reset to default max width */
}

.kofi-icon-svg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  min-width: 40px;
  flex-shrink: 0;
}

.kofi-text {
  white-space: nowrap;
  padding-right: 0px;
  padding-left: 0px; 
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.3s ease-in-out 0.1s;
}

.kofi-wrapper:hover .kofi-text {
  opacity: 1;
}

/* Opera-specific fix: make button wider and text smaller to accommodate text properly */
.opera-browser .kofi-wrapper:hover .kofi-button {
  width: 295px; /* Reset to default max width for Opera */
}

/* Mobile and narrow screen optimization */
@media (max-width: 768px) {
  .kofi-button .kofi-text {
    font-size: 0.7rem;
  }
}

@media (max-width: 760px) {
  .main-title {
    padding-right: 0;
  }

  .main-title .title-part-2 {
    display: block;
  }

  #mainContentTop {
    padding-right: 0 !important;
  }

  .button-row {
    width: 100% !important;
    margin-right: 0 !important;
  }

  #groupContainer {
    margin-right: 0 !important;
  }

  #groupInfoDetails { 
    margin-right: 0 !important;
  }
}

.group-label.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status message */
.status-message {
  padding: 10px;
  margin: 10px 0;
  border-radius: 6px;
  font-weight: 600;
}

.status-message.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.status-message.warning {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
}

.status-message.info {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

/* Mobile ko-fi behavior - matches v2.4 working solution */
@media (max-width: 620px) {
  .title-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .sidebar-socials {
    position: static;
    width: 100%;
    flex-direction: row;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 12px;
  }

  #cicLogo {
    width: 90px;
  }

  .sidebar-icons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    margin-top: 0;
    width: auto;
  }
  
  .kofi-wrapper {
	  margin-top: 0;
	      margin-left: 0px;   /* Move 10px to the left */
	      align-self: flex-start; /* Ensure it aligns to the top */
	      width: 35px;      /* Make smaller */
	      height: 35px;     /* Make smaller */
	    }
	  
	    .kofi-button, .kofi-icon-svg {
	      height: 35px;     /* Adjust button and icon height */
	    }
	  
	    .kofi-button {
	      width: 35px;      /* Adjust button width */
	      transition: none; /* Disable transition on mobile */
    }
    
    /* Disable hover expansion on mobile */
    .kofi-wrapper:hover .kofi-button {
      width: 35px; /* Keep original width, don't expand */
    }
    
    .kofi-wrapper:hover .kofi-text {
      opacity: 0; /* Keep text hidden */
    }
  
	.kofi-button img {
	    position: relative;
	    transform: translateX(3px); /* Nudge image to the right */
	  }

  .sidebar-link {
    width: 35px;
    height: 35px;
    margin-bottom: 0;
  }

  .sidebar-link img {
    width: 35px;
    height: 35px;
  }

  a[href*="facebook.com"] img {
    width: 32px;
    height: 32px;
  }

  .main-title {
    padding-right: 0;
    width: 100%;
  }

  .chart-wrapper {
    width: 100%;
    max-width: 100%;
  }

  /* Opera-specific ko-fi rules */
  .opera-browser .kofi-wrapper:hover .kofi-button {
    width: 35px; /* Prevent expansion on narrow screens */
  }

  .opera-browser .kofi-wrapper:hover .kofi-text {
    opacity: 0; /* Keep text hidden */
  }
}

/* Custom legend container styling */
#customLegend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1px; /* Minimize spacing between legend items */
  margin-top: 2px; /* Minimize spacing above the legend */
  margin-bottom: 2px; /* Minimize spacing below the legend */
  padding: 1px; /* Minimize padding inside the legend */
  background-color: transparent; /* Remove white background */
  border: none !important; /* Force removal of red dotted border */
  z-index: 20;
}

/* Styling for individual legend items */
.legend-item {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: bold;
  margin: 1px; /* Minimize spacing around legend items */
}

.legend-item span {
  margin-right: 8px; /* Space between color circle and label */
}

.legend-item span:first-child {
  width: 12px;
  height: 12px;
  border-radius: 50%; /* Circle shape */
}

/* Restore original colors */
/* Debug backgrounds removed - they interfere with chart rendering
body {
  background: #ffebee !important;
}

#mainContent {
  background: #e8f5e9;
}

.chart-wrapper {
  background: #e3f2fd;
}

#chartTitle {
  background: #fff9c4;
}

#chart_div {
  background: #f3e5f5;
}
*/

/* Override any cached debug styles */
#chart_div {
  background: white !important;
}

.chart-wrapper {
  background: white;
}

/* Comparison statement pill styling */
.comparison-statement {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 20px;
  /* background-color: orange; */ /* Removed - now handled inline */
  color: white;
  font-weight: bold;
  text-align: center;
  margin-top: 2px;
}

/* Notification system */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification {
  padding: 15px;
  border-radius: 8px;
  color: white;
  font-weight: bold;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

.notification.error {
  background-color: #e74c3c;
}

.notification.success {
  background-color: #2ecc71;
}

/* Google Charts tooltip styling - add white background */
.google-visualization-tooltip {
  background-color: white !important;
  border: 1px solid #ccc !important;
  padding: 8px !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

