/**
 * Shared CSS Styles
 * Common styling for NAEI data viewer applications
 */

/* Base styles */
@font-face {
  font-family: 'Tiresias Infofont';
  src: url('fonts/tiresius/TiresiasInfofont-OVA33.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

body { 
  font-family: system-ui, sans-serif; 
  margin: 20px; 
  color: #000; 
  background: #fff; 
}

label { 
  font-weight: 600; 
  margin-right: 6px; 
}

h2 { 
  margin-bottom: 8px; 
  width: 100%; 
  display: block; 
}

/* Title and branding */
.title-row {
  position: relative;
  margin-bottom: 0;
}

#cicLogo {
  width: 110px;
  height: auto;
  display: block;
}

.sidebar-socials {
  position: absolute;
  top: 0;
  right: 0;
  width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 100;
}

.sidebar-icons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.sidebar-link {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
}

.sidebar-link img {
  display: block;
  height: 40px;
  width: 40px;
  object-fit: contain;
}

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

/* Main title styling */
.main-title {
  margin: 0 0 20px 0;
  padding-right: 140px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: normal;
  text-align: left;
}

.main-title .title-part {
  display: inline;
  white-space: nowrap;
}

/* Form elements */
select, button { 
  margin: 4px; 
  padding: 6px 10px; 
  border-radius: 6px; 
  border: 1px solid #ccc; 
}

/* Button styling */
button { 
  background: #EFEFEF; 
  cursor: pointer; 
  font-family: system-ui, sans-serif;
  color: inherit;
}

button:hover { 
  background: #E0E0E0; 
}

button:disabled { 
  background: #EEE; 
  color: #666; 
  cursor: not-allowed; 
}

/* Select dropdown styling */
select {
  background: #fff;
  font-family: system-ui, sans-serif;
  color: inherit;
  cursor: pointer;
}

/* Interactive elements cursor */
input, textarea, select { 
  cursor: pointer; 
}

button { 
  cursor: pointer; 
  user-select: none; 
}

/* Chart styling */
#chartTitle { 
  font-weight: 700; 
  font-size: 18px; 
  margin-top: 8px; 
  margin-bottom: 6px; 
  text-align: center; 
}

.chart-wrapper {
  width: calc(100% - 140px);
  padding: 8px;
  margin: 0;
  margin-right: auto;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  background-color: #fff;
  overflow: hidden;
}

#chart_div { 
  width: 100%; 
  height: 60vh; 
  margin-top: 0; 
  min-height: 40vh; 
  border: none;
  border-radius: 0; 
  padding: 0; 
  box-sizing: border-box;
}

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

#loadingOverlay.hidden {
  opacity: 0;
  pointer-events: none;
}

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

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

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

/* Controls layout */
.controls-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 12px;
  padding-right: 130px;
}

.controls-wrapper label { 
  white-space: nowrap; 
  margin-right: 4px; 
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 12px;
  padding-right: 130px;
}

/* Group management */
#groupContainer { 
  margin-top: 10px; 
}

.groupRow { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  margin: 4px 0; 
}

.groupRow.dragging { 
  opacity: 0.5; 
}

.dragHandle { 
  cursor: grab; 
  user-select: none; 
  padding: 4px 6px; 
  background: #f0f0f0; 
  border-radius: 6px; 
}

.group-control { 
  display: inline-flex; 
  align-items: center; 
  gap: 8px; 
}

.add-btn, .remove-btn { 
  display: inline-flex; 
  align-items: center; 
  gap: 6px; 
  background: #EFEFEF;
  cursor: pointer;
  margin: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-family: system-ui, sans-serif;
  color: inherit;
}

.add-btn:hover, .remove-btn:hover {
  background: #E0E0E0;
}

.remove-icon { 
  display: inline-block; 
  width: 18px; 
  height: 18px; 
  border-radius: 50%; 
  background: #d33; 
  color: #fff; 
  text-align: center; 
  line-height: 18px; 
  font-weight: bold; 
}

.add-btn .add-icon { 
  color: #4CAF50; 
  font-weight: bold; 
  font-size: 2em; 
}

.add-btn:hover .add-icon { 
  color: #45a049; 
}

/* Modal/Dialog styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.modal-content {
  background: white;
  padding: 24px;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .main-title {
    padding-right: 0;
    font-size: 22px;
  }
  
  .sidebar-socials {
    position: static;
    width: 100%;
    margin-bottom: 20px;
  }
  
  .controls-wrapper,
  .button-row {
    padding-right: 0;
  }
  
  .chart-wrapper {
    width: 100%;
  }
}
