/* Web Performance Reports - Modern Styling based on Boldyn/Apogee report 2025 */

:root {
  /* Colors */
  --primary-color: #0066cc;
  --secondary-color: #28a745;
  --error-color: #dc3545;
  --text-color: #333333;
  --text-light: #666666;
  --border-color: #e9ecef;
  --border-strong: #cccccc;
  --header-bg: #f8f9fa;
  --body-bg: #f5f5f5;
  --card-bg: #ffffff;
  --highlight-bg: #f8f9fa;
  
  /* Spacing */
  --spacing-xs: 5px;
  --spacing-sm: 10px;
  --spacing-md: 20px;
  --spacing-lg: 30px;
  --spacing-xl: 40px;
}

/* Base styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-color);
  background-color: var(--body-bg);
  margin: 0;
  padding: var(--spacing-md) 2em; /* Added 2em horizontal padding for embedded browser */
}

/* Page structure */
.container {
  max-width: 1200px;
  margin: 0 auto;
  background-color: var(--card-bg);
  padding: var(--spacing-xl) 2em; /* Added 2em horizontal padding for embedded browser */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  border-radius: 8px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-color);
  margin-top: 0;
  line-height: 1.2;
}

h1 {
  font-size: 28px;
  margin-bottom: var(--spacing-md);
}

h2 {
  font-size: 22px;
  margin-bottom: var(--spacing-sm);
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--border-color);
}

h3 {
  font-size: 18px;
  margin-bottom: var(--spacing-sm);
}

p {
  margin-bottom: var(--spacing-md);
}

/* Report header */
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
}

.title-section h1 {
  margin-bottom: var(--spacing-xs);
}

.title-section h2 {
  font-size: 18px;
  font-weight: normal;
  color: var(--text-light);
  margin-top: 0;
  border-bottom: none;
}

.logo-img {
  height: 60px;
  width: auto;
}

/* Content container */
.content-container {
  padding: 0 1em; /* Added horizontal padding for better content spacing */
}

/* Executive Summary and Report Section styles */
.executive-summary h1 {
  font-size: 28px;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-xs);
}

.report-section {
  /* No specific heading here - will use the one from the specific report section */
}

/* Section styles */
.section {
  margin-bottom: var(--spacing-lg);
}

.section-header {
  font-size: 22px;
  font-weight: 600;
  background-color: var(--header-bg);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 4px;
  margin: var(--spacing-lg) 0 var(--spacing-md) 0;
  color: var(--text-color);
  border-left: 4px solid var(--primary-color);
}

.section-content {
  padding: 0 var(--spacing-sm);
}

/* Metric cards grid */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-md);
  margin: var(--spacing-lg) 0;
}

.metric-card {
  background-color: var(--highlight-bg);
  border-radius: 8px;
  padding: var(--spacing-md);
  border: 1px solid var(--border-color);
}

.metric-value {
  font-size: 2.5em;
  font-weight: bold;
  color: var(--primary-color);
  margin: var(--spacing-sm) 0;
}

.metric-label {
  color: var(--text-light);
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.improvement {
  color: var(--secondary-color);
  font-weight: bold;
}

.degradation {
  color: var(--error-color);
  font-weight: bold;
}

/* Table styling */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-lg) 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

th, td {
  padding: var(--spacing-sm);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--header-bg);
  font-weight: 600;
  color: var(--text-color);
}

tr:last-child td {
  border-bottom: none;
}

/* Specific table variations */
.comparison-table th {
  background-color: var(--header-bg);
  font-weight: 600;
}

.metrics-table th {
  width: 60%;
  text-align: left;
}

.metrics-table td {
  text-align: right;
  font-weight: 500;
}

.summary-header {
  background-color: var(--header-bg);
  font-weight: 600;
  color: var(--text-color);
  text-align: left;
  padding: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
}

/* Chart styling */
.chart-container {
  margin: var(--spacing-lg) auto; /* Center container */
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: var(--spacing-md);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  width: 98%; /* Wider container to accommodate larger charts */
  max-width: 2000px; /* Increased from default to allow larger charts */
  overflow: auto; /* Add scrolling if needed for very large charts */
  text-align: center !important; /* Force center alignment */
}

/* Ensure ALL chart images are centered regardless of container */
img[src*="chart"], 
img[width][height], 
a > img {
  display: block !important;
  margin-left: auto !important;
  margin-right: auto !important;
  /* Allow images to display at their set size without constraint */
  /* max-width removed to prevent automatic scaling */
}

.chart-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--spacing-md);
  text-align: center;
  color: var(--text-color);
}

.chart-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: var(--spacing-md) 0;
  width: 100%;
}

.chart-image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin: 0 auto; /* Center the chart horizontally */
}

.chart-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm);
  background-color: var(--highlight-bg);
  border-radius: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-light);
}

.legend-color {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: var(--spacing-xs);
}

/* Chart line colors */
.max-line {
  background-color: #ff6600;
}

.avg-line {
  background-color: var(--primary-color);
}

.min-line {
  background-color: #9966cc;
}

.goal-line {
  background-color: var(--error-color);
  border-radius: 0;
  height: 2px;
}

/* Links and buttons */
a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.section-link {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: var(--highlight-bg);
  border-radius: 4px;
  margin-top: var(--spacing-sm);
  font-weight: 500;
}

.section-link::after {
  content: " →";
  display: inline-block;
  margin-left: var(--spacing-xs);
}

.video-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: #e9f0f9;
  border: 1px solid #b8ccee;
  border-radius: 4px;
  color: var(--primary-color);
  font-size: 13px;
  font-weight: 500;
}

.video-link:hover {
  background-color: #d9e5f5;
  text-decoration: none;
}

.export-link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-xs);
  font-size: 13px;
  color: var(--text-light);
}

/* Help icon */
.help-link img {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* Performance Goals specific styling */
.goal-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
}

.goal-failed {
  color: var(--error-color);
  font-weight: 600;
}

.goal-passed {
  color: var(--secondary-color);
  font-weight: 600;
}

/* Footer */
.report-footer {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: var(--spacing-md);
  }
  
  .report-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .logo {
    margin-top: var(--spacing-sm);
  }
  
  .metric-grid {
    grid-template-columns: 1fr;
  }
  
  table {
    display: block;
    overflow-x: auto;
  }
  
  th, td {
    min-width: 120px;
  }
}

/* For print */
@media print {
  body {
    background-color: white;
    padding: 0;
  }
  
  .container {
    box-shadow: none;
    padding: 0;
    max-width: 100%;
  }
  
  .chart-container {
    break-inside: avoid;
  }
  
  .noprint {
    display: none !important;
  }
}