/* Health Data Page Redesign - Clean, Wide, No Icons */

/* ============================================
   1. LAYOUT - Wider, Less Gray Space
   ============================================ */

.health-data-page {
  max-width: 1600px !important;
  margin: 0 auto;
  padding: 0 32px;
}

.health-data-page .page-title {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.health-data-page .page-subtitle {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 1rem;
  color: #6B7280;
  font-weight: 400;
  margin-bottom: 32px;
}

/* ============================================
   2. FILTERS - Horizontal, Clean, No Icons
   ============================================ */

.health-filters-container {
  background: white;
  border-bottom: 1px solid #E5E7EB;
  margin: 0 -32px 32px -32px;
  padding: 24px 32px;
}

.health-filters-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr 1fr 2fr;
  gap: 18px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label-clean {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  display: block;
}

.filter-select-clean {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.9375rem;
  padding: 10px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  background: white;
  color: #111827;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}

.filter-select-clean:hover {
  border-color: #9CA3AF;
}

.filter-select-clean:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.date-inputs-clean {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-input-clean {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.9375rem;
  padding: 10px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 8px;
  background: white;
  color: #111827;
  flex: 1;
  transition: all 0.2s;
}

.date-input-clean:hover {
  border-color: #9CA3AF;
}

.date-input-clean:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.date-separator-clean {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.875rem;
  color: #6B7280;
  flex-shrink: 0;
}

/* Mobile responsive filters */
@media (max-width: 1024px) {
  .health-filters-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .filter-group-date .date-inputs-clean {
    flex-direction: column;
    align-items: stretch;
  }

  .date-separator-clean {
    display: none;
  }
}

/* ============================================
   3. STATISTICS CARDS - Clean, No Icons
   ============================================ */

.health-stats-grid-clean {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}

.health-stat-card-clean {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s;
}

.health-stat-card-clean:hover {
  border-color: #D1D5DB;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.stat-label-clean {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6B7280;
  display: block;
}

.stat-value-group {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-value-clean {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.stat-unit-clean {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.875rem;
  color: #6B7280;
  font-weight: 500;
}

/* Color accents for different stat types */
.health-stat-card-clean.health-stat-primary {
  border-left: 4px solid #3B82F6;
}

.health-stat-card-clean.health-stat-success {
  border-left: 4px solid #10B981;
}

.health-stat-card-clean.health-stat-warning {
  border-left: 4px solid #F59E0B;
}

.health-stat-card-clean.health-stat-purple {
  border-left: 4px solid #8B5CF6;
}

@media (max-width: 1024px) {
  .health-stats-grid-clean {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .health-stats-grid-clean {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   4. ERROR MESSAGE - Clean, No Icon
   ============================================ */

.error-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  justify-content: space-between;
}

.error-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 24px;
  line-height: 1;
  color: #DC2626;
  font-weight: 300;
  transition: opacity 0.2s;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.error-close:hover {
  opacity: 0.7;
}

/* ============================================
   5. CHARTS - Full Width, Better Spacing
   ============================================ */

.charts-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.health-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.chart-card {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s;
}

.chart-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.chart-title {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 4px;
}

.chart-subtitle {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.875rem;
  color: #6B7280;
  margin-bottom: 20px;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 350px;
}

/* Correlation interpretation text */
.correlation-interpretation {
  margin-top: 16px;
  padding: 12px 16px;
  background: #F3F4F6;
  border-radius: 8px;
  border-left: 4px solid #8B5CF6;
}

.correlation-interpretation-title {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.correlation-interpretation-text {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.875rem;
  color: #6B7280;
  line-height: 1.5;
  margin: 0;
}

/* Correlation strength colors */
.correlation-strong {
  border-left-color: #10B981;
}

.correlation-moderate {
  border-left-color: #F59E0B;
}

.correlation-weak {
  border-left-color: #EF4444;
}

/* ============================================
   6. LOADING STATE
   ============================================ */

.health-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #E5E7EB;
  border-top-color: #3B82F6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.875rem;
  color: #6B7280;
  margin-top: 12px;
}

/* ============================================
   7. LAG ANALYSIS CARD - Mini Bar Chart
   ============================================ */

.lag-analysis-chart-card {
  border-left: 4px solid #6366F1;
}

.lag-bars-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
}

.lag-bar-item {
  display: grid;
  grid-template-columns: 50px 1fr 50px;
  align-items: center;
  gap: 8px;
}

.lag-label {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6B7280;
}

.lag-bar-bg {
  height: 18px;
  background: #F3F4F6;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.lag-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366F1 0%, #8B5CF6 100%);
  border-radius: 4px;
  transition: width 0.6s ease;
}

.lag-bar-item:first-child .lag-bar-fill {
  background: linear-gradient(90deg, #3B82F6 0%, #6366F1 100%);
}

.lag-value {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: #111827;
  text-align: right;
}

.lag-note {
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.875rem;
  color: #6B7280;
  font-weight: 400;
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid #E5E7EB;
  text-align: center;
}

/* Advanced Filters Section */
.advanced-filters-section {
  margin-top: 16px;
  border-top: 1px solid #E5E7EB;
  padding-top: 16px;
}

.advanced-filters-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'LINE Seed Sans TH', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: #374151;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.advanced-filters-toggle:hover {
  background: #F3F4F6;
  border-color: #D1D5DB;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.advanced-filters-toggle:active {
  transform: translateY(0);
}

.advanced-filters-toggle .toggle-icon {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.advanced-filters-toggle[aria-expanded="true"] .toggle-icon {
  transform: rotate(180deg);
}

.advanced-filters-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  padding: 0;
}

.advanced-filters-content.open {
  max-height: 250px;
  opacity: 1;
  padding: 16px 0;
}
