/* Market Ratios Dashboard Styles */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #ffffff 0%, #ffffff 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
.header {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 30px;
}

.header-left {
  flex: 1;
}

.header-right {
  flex-shrink: 0;
  min-width: 250px;
}

.header h1 {
  color: #2c3e50;
  font-size: 32px;
  margin-bottom: 10px;
}

.header p {
  color: #7f8c8d;
  font-size: 16px;
}

.industry-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.industry-selector label {
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
}

.industry-selector select {
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  color: #2c3e50;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
}

.industry-selector select:hover {
  border-color: #4A90E2;
}

.industry-selector select:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Controls */
.controls {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  font-weight: 600;
  color: #2c3e50;
  min-width: 120px;
  font-size: 14px;
}

.control-group select {
  flex: 1;
  padding: 10px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  color: #2c3e50;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
}

.control-group select:hover {
  border-color: #4A90E2;
}

.control-group select:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Inline controls row */
.tab-controls-row {
  display: flex;
  align-items: center;
  gap: 30px;
  padding: 20px 0;
  border-bottom: 2px solid #f0f0f0;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.control-group-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-group-inline label {
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
  white-space: nowrap;
}

.compact-select {
  padding: 8px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  color: #2c3e50;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 200px;
  max-width: 300px;
}

.compact-select:hover {
  border-color: #4A90E2;
}

.compact-select:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Help link */
.help-link {
  margin-left: auto;
  color: #4A90E2;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.help-link:hover {
  background: rgba(74, 144, 226, 0.1);
  color: #1976d2;
}

/* Tabs */
.tabs {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.tab-buttons {
  display: flex;
  background: #f8f9fa;
  border-bottom: 2px solid #e0e0e0;
}

.tab-button {
  flex: 1;
  padding: 18px 24px;
  background: transparent;
  border: none;
  font-size: 16px;
  font-weight: 600;
  color: #7f8c8d;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.tab-button:hover {
  background: rgba(74, 144, 226, 0.05);
  color: #4A90E2;
}

.tab-button.active {
  color: #4A90E2;
  background: white;
}

.tab-button.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 3px;
  background: #4A90E2;
}

/* Tab Content */
.tab-content {
  display: none;
  padding: 30px;
}

.tab-content.active {
  display: block;
}

.tab-controls {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}

.visualization {
  min-height: 500px;
  background: white;
  border-radius: 8px;
}

/* Loading */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: #7f8c8d;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Error */
.error {
  background: #fee;
  color: #c33;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #c33;
  margin: 20px 0;
}

/* Info box */
.info-box {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding: 15px 20px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.info-box h3 {
  color: #1976d2;
  margin-bottom: 8px;
  font-size: 16px;
}

.info-box p {
  color: #555;
  font-size: 14px;
  line-height: 1.6;
}

/* Radio buttons */
.radio-group {
  display: flex;
  gap: 20px;
  align-items: center;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #2c3e50;
  transition: color 0.3s ease;
}

.radio-label:hover {
  color: #4A90E2;
}

.radio-label input[type="radio"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
  accent-color: #4A90E2;
}

.radio-label span {
  user-select: none;
}

/* Modal popup */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 32px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  transition: color 0.3s ease;
  line-height: 1;
}

.modal-close:hover {
  color: #333;
}

.modal-content h2 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 24px;
}

.modal-content h3 {
  color: #4A90E2;
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 18px;
}

.modal-content p {
  color: #555;
  line-height: 1.6;
  margin-bottom: 15px;
}

.modal-content ul {
  list-style-position: inside;
  color: #555;
  line-height: 1.8;
  margin-bottom: 15px;
}

.modal-content li {
  margin-bottom: 8px;
}

.modal-content strong {
  color: #2c3e50;
}

/* Responsive */
@media (max-width: 768px) {
  .header h1 {
    font-size: 24px;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
  }

  .control-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .control-group label {
    min-width: auto;
    margin-bottom: 8px;
  }

  .control-group select {
    width: 100%;
  }

  .tab-buttons {
    flex-direction: column;
  }

  .tab-button {
    text-align: left;
  }

  .tab-content {
    padding: 20px 15px;
  }

  .tab-controls-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .control-group-inline {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .compact-select {
    width: 100%;
    max-width: 100%;
  }

  .help-link {
    margin-left: 0;
    align-self: flex-start;
  }

  .modal-content {
    max-width: 90%;
    max-height: 90vh;
    padding: 20px;
  }

  .modal-close {
    font-size: 28px;
  }
}

/* Chart styles */
.y-axis path,
.y-axis line {
  stroke: #999;
}

.y-axis text {
  fill: #333;
}

svg {
  overflow: visible;
}

/* Custom scrollbar for select */
select::-webkit-scrollbar {
  width: 8px;
}

select::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

select::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

select::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Modal link styles */
.modal-content a {
  color: #4A90E2;
  text-decoration: none;
  transition: color 0.3s ease;
}

.modal-content a:hover {
  color: #1976d2;
  text-decoration: underline;
}

/* Histogram tooltip scrollbar */
.histogram-tooltip::-webkit-scrollbar {
  width: 6px;
}

.histogram-tooltip::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.histogram-tooltip::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
}

.histogram-tooltip::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.6);
}
