/* Performance Metrics Styling */

.performance-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
 
/* Tab Controls */
.tab-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 20px;
}

.tab-nav {
  display: flex;
  border-bottom: 1px solid #ddd;
}

.tab {
  padding: 10px 15px;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  margin-right: 5px;
  border-radius: 4px 4px 0 0;
  transition: all 0.2s;
  color: #777;
}

.tab:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.tab.active {
	border-color: #ddd;
	border: 0;
	border-bottom: 2px solid var(--cc3);
	color: black;
	background: #BBB;
	font-weight: 500;
}

.tab-content {
  padding: 15px 0;
}

.tab-pane {
  display: none;
  color: #777;
}

.tab-pane th { color: white; }
.tab-pane.active {
  display: block;
}

/* Domain Selection */
.control-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 4px;
}

.input-section {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.options-section {
  flex: 1;
  display: flex;
  align-items: flex-end;
}

.action-section {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.input-group {
  display: flex;
  flex-direction: column;
  flex: 3;
  min-width: 200px;
}

.input-group label {
  margin-bottom: 5px;
  font-weight: 500;
  color: #555;
}

.domain-select, .runs-select, .url-input {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 200px;
}

button.check-performance, button.primary-button {
  padding: 8px 15px;
  background-color: #4285f4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  min-height: 38px;
  transition: background-color 0.2s;
}

button.check-performance:hover, button.primary-button:hover {
  background-color: #3367d6;
}

.domain-info {
  margin: 15px 0;
  padding: 10px;
  background-color: #e8f0fe;
  border-radius: 4px;
  color: #1a73e8;
}

.domain-info .error {
  color: #d32f2f;
  font-weight: 500;
}

/* Results Styling */
.results-container {
  position: relative;
  min-height: 100px;
}

.performance-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.summary-card {
  display: flex;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  padding: 20px;
}

.performance-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.score-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.score-circle.excellent {
  background: linear-gradient(135deg, #4caf50, #2e7d32);
  border: 4px solid #2e7d32;
}

.score-circle.good {
  background: linear-gradient(135deg, #8bc34a, #558b2f);
  border: 4px solid #558b2f;
}

.score-circle.average {
  background: linear-gradient(135deg, #ffca28, #f57f17);
  border: 4px solid #f57f17;
}

.score-circle.poor {
  background: linear-gradient(135deg, #ef5350, #c62828);
  border: 4px solid #c62828;
}

.score-text {
	font-size: 32px;
	font-weight: 700;
    color: white !important;
}

.score-details {
  flex: 1;
}

.score-label {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.http-status, .test-info {
  font-size: 14px;
  margin-bottom: 5px;
  color: #999;
}

.status {
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 500;
}

.status.on {
  background-color: #e6f4ea;
  color: #0d652d;
}

.status.medium {
  background-color: #fef7e0;
  color: #b06000;
}

.status.off {
  background-color: #fce8e6;
  color: #c5221f;
}

/* Metrics Cards */
.metrics-section {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.metrics-card {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  padding: 15px 20px;
  flex: 1;
  min-width: 300px;
}

.metrics-card.full-width {
  flex-basis: 100%;
}

.metrics-card h4 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #202124;
  font-size: 16px;
  font-weight: 500;
}

.metrics-card li button { 
  padding: 4px 16px;
  border-radius: 4px;
  background: var(--cc2);
  float: right;
}
.tech-rec-item button {
  border-radius: 4px;
  background: var(--cc2);
}
.optimization-table td button { float: right; }

/* Tables */
.atable {
  width: 100%;
  border-collapse: collapse;
}

.atable th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid #eee;
  color: #5f6368;
  font-weight: 500;
}

.atable td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}

.atable tr:last-child td {
  border-bottom: none;
}

/* Timeline */
.performance-timelinebar {
  margin-top: 15px;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-segment {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
}

.timeline-segment label {
  width: 100px;
  font-weight: 500;
  font-size: 14px;
}

.timeline-bar {
  height: 16px;
  background-color: #4285f4;
  border-radius: 8px;
  margin: 0 0 0 10px;
}

.timeline-segment.dns .timeline-bar {
  background-color: #4285f4;
}

.timeline-segment.connect .timeline-bar {
  background-color: #0f9d58;
}

.timeline-segment.ssl .timeline-bar {
  background-color: #f4b400;
}

.timeline-segment.ttfb .timeline-bar {
  background-color: #db4437;
}

.timeline-segment.download .timeline-bar {
  background-color: #673ab7;
}

.timeline-segment span {
  min-width: 50px;
  font-size: 14px;
  opacity: 0.65;
}

/* Recommendations */
.recommendations-list {
  margin: 0;
  padding-left: 20px;
}

.recommendations-list li {
  margin-bottom: 8px;
}

/* Export Section */
.export-section {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.export-section button {
  padding: 8px 15px;
  background-color: #f8f9fa;
  border: 1px solid #dadce0;
  border-radius: 4px;
  color: #5f6368;
  cursor: pointer;
  font-weight: 500;
}

.export-section button:hover {
  background-color: #f1f3f4;
  color: #202124;
}

.export-section button.run-again {
  background-color: #e8f0fe;
  color: #1a73e8;
}

.export-section button.run-again:hover {
  background-color: #d2e3fc;
}

/* History Table */
.history-table {
  width: 100%;
}

.score-pill {
  padding: 4px 8px;
  border-radius: 12px;
  color: white;
  font-weight: 500;
  font-size: 12px;
}

.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  background-color: #f8f9fa;
  border-radius: 8px;
  color: #5f6368;
  font-style: italic;
}

/* Settings Form */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 800px;
}

.setting-group {
  display: flex;
  align-items: center;
  color: #999;
}

.setting-group label {
  width: 200px;
  font-weight: 500;
}

.threshold-section {
  margin-top: 12px;
}
.tab-pane h3,
.threshold-section > h4 {
	margin-bottom: 8px;
	padding: 4px 8px;
	background: #444;
	color: white;
}
.tab-pane h3 {
    padding: 6px 16px;
}

.threshold-group {
  margin-bottom: 15px;
}

.threshold-group > label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  color: #444;
}

.threshold-inputs {
  display: flex;
  gap: 20px;
}

.threshold-inputs .input-group {
    flex-flow: row;
  	min-width: initial;
}
.threshold-inputs .input-group label {
	margin: 0;
	padding: 4px 8px;
	background: #AAA;
	color: white;
}
.threshold-inputs .input-group span { padding: 4px 6px; color: #999; }

.threshold-inputs input {
  width: 60px;
  padding: 5px;
}

/* Advanced Analysis Tab Styles */

.advanced-instruction-panel {
  background-color: #fafafa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
}

.advanced-results-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.advanced-header {
  margin-bottom: 20px;
}

.advanced-header h3 {
  margin-bottom: 5px;
}

.test-meta {
  color: #5f6368;
  font-size: 14px;
}

.advanced-metrics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.advanced-section {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  padding: 15px;
  flex: 1;
  min-width: 300px;
}

.advanced-section.full-width {
  flex-basis: 100%;
}

.advanced-section h4 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #202124;
  font-size: 16px;
  font-weight: 500;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

.advanced-table {
  width: 100%;
  border-collapse: collapse;
}

.advanced-table th {
	text-align: left;
	padding: 8px 10px;
	border-bottom: 2px solid #eee;
	font-weight: 500;
	color: #5f6368;
	background: transparent;
    font-size: 16px;
    text-align: center;
}

.advanced-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
}

.advanced-table tr:last-child td {
  border-bottom: none;
}

.advanced-table .total-row {
  font-weight: 500;
  background-color: #f8f9fa;
}

/* Resource Chart */
.resource-chart-container {
  margin-top: 15px;
}

.resource-chart {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.chart-bar-group {
  display: flex;
  align-items: center;
  height: 30px;
}

.chart-label {
  width: 100px;
  font-weight: 500;
}

.chart-bar-container {
  flex: 1;
  height: 20px;
  background-color: #f1f3f4;
  border-radius: 3px;
  margin: 0 15px;
}

.chart-bar {
  height: 100%;
  border-radius: 3px;
}

.chart-bar-images {
  background-color: #4285f4;
}

.chart-bar-scripts {
  background-color: #0f9d58;
}

.chart-bar-stylesheets {
  background-color: #f4b400;
}

.chart-bar-fonts {
  background-color: #db4437;
}

.chart-bar-other {
  background-color: #673ab7;
}

.chart-value {
  width: 100px;
  text-align: right;
}

/* Headers Section */
.header-viewer {
  margin-top: 15px;
}

.toggle-headers {
  padding: 8px 15px;
  background-color: var(--cc2);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 10px;
}

.raw-headers {
  display: none;
  max-height: 300px;
  overflow: auto;
  padding: 15px;
  background-color: #f8f9fa;
  border: 1px solid #dadce0;
  border-radius: 4px;
  font-family: monospace;
  white-space: pre-wrap;
  font-size: 12px;
}

.raw-headers.visible {
  display: block;
}

/* Score Breakdown */
.score-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.score-component {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-radius: 4px;
}

.component-label {
  font-weight: 500;
}

.component-value {
  font-weight: 700;
}

.base-score {
  background-color: #e8f0fe;
  color: #1a73e8;
}

.deduction {
  background-color: #fce8e6;
  color: #c5221f;
}

.intermediate-score {
  background-color: #fff8e1;
  color: #f57f17;
}

.bonus {
  background-color: #e6f4ea;
  color: #0d652d;
}

.final-score {
  background-color: #d2e3fc;
  color: #174ea6;
  font-size: 16px;
}

/* Technical Recommendations */
.technical-recommendations {
  margin-top: 15px;
}

.tech-rec-item {
  margin-bottom: 10px;
  line-height: 1.5;
}

.code-snippet {
  background-color: #f8f9fa;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 10px;
  margin: 10px 0;
  font-family: monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  font-size: 12px;
}

/* Waterfall Chart */
.waterfall-chart {
  margin-top: 15px;
  position: relative;
  padding-top: 30px;
}

.time-scale {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
}

.time-point {
  position: absolute;
  transform: translateX(-50%);
  font-size: 12px;
  color: #5f6368;
}

.waterfall-bar {
  position: relative;
  height: 30px;
  margin-bottom: 5px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: white;
  min-width: 5px; /* Ensure visibility for very short durations */
}

.bar-label {
	flex: 1;
    font-size: 12px;
	font-weight: 500;
    white-space: nowrap;
  	color: #ddd;
}

.bar-time {
  font-size: 12px;
  color: #ddd;
  margin-left: 8px;
}
