:root {
  /* Fingo Brand Colors */
  --fingo-orange: #ed8224;
  --fingo-orange-dark: #d4741f;
  --fingo-orange-light: #f5a85a;
  --fingo-red: #eb405b;
  --fingo-green: #91c84e;
  --fingo-blue: #63a1fa;
  --fingo-gold: #ebc83d;

  /* Light theme */
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border-color: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --card-hover-shadow: 0 10px 40px rgba(237, 130, 36, 0.15);
}

[data-theme="dark"] {
  --bg-primary: #1a1d23;
  --bg-secondary: #25282e;
  --bg-card: #2d3139;
  --text-primary: #e8eaed;
  --text-secondary: #b8bcc4;
  --text-muted: #8a8e96;
  --border-color: #3a3f48;
  --shadow: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --card-hover-shadow: 0 12px 40px rgba(237, 130, 36, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: all 0.3s ease;
}

.header {
  background: linear-gradient(135deg, var(--fingo-orange) 0%, var(--fingo-orange-dark) 100%);
  padding: 1.6rem 0;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.logo-area h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-badges {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 32px;
}

.badge svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.jira-link {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 32px;
  transition: all 0.2s;
}

.jira-link svg {
  width: 16px;
  height: 16px;
}

.jira-link:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

.theme-toggle {
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  padding: 0.4rem;
  border-radius: 8px;
  cursor: pointer;
  color: white;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  width: 36px;
  height: 36px;
}

.theme-toggle:hover {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

.info-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.info-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.info-card-icon.primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.info-card-icon.success { background: linear-gradient(135deg, #91c84e 0%, #6b9c38 100%); }
.info-card-icon.warning { background: linear-gradient(135deg, #f6d365 0%, #fda085 100%); }
.info-card-icon.danger { background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%); }

.info-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.info-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-card-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.pools-overflow {
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.1em 0.4em;
  border-radius: 0.75em;
  margin-left: 0.25em;
  white-space: nowrap;
}

.section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--fingo-orange) 0%, var(--fingo-orange-dark) 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.125rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.service-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.service-row .project-card {
  flex: 1;
  min-width: 200px;
}

.project-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  padding-bottom: 3rem;
  transition: all 0.3s;
  text-decoration: none;
  display: block;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--fingo-orange) 0%, var(--fingo-orange-light) 100%);
  transform: scaleX(0);
  transition: transform 0.3s;
}

.project-card:hover::before {
  transform: scaleX(1);
}

.project-card:hover {
  border-color: var(--fingo-orange);
  box-shadow: var(--card-hover-shadow);
  transform: translateY(-4px);
}

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.project-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.project-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.project-badge.project {
  background: rgba(99, 161, 250, 0.15);
  color: #63a1fa;
}

.project-badge.service {
  background: rgba(145, 200, 78, 0.15);
  color: #6b9c38;
}

.test-status-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  position: absolute;
  bottom: 1rem;
  right: 1rem;
}

.test-status-badge.not-tested {
  background: rgba(128, 128, 128, 0.15);
  color: #6b6b6b;
}

.test-status-badge.passed {
  background: rgba(145, 200, 78, 0.15);
  color: #6b9c38;
}

.test-status-badge.failed {
  background: rgba(235, 64, 91, 0.15);
  color: #eb405b;
}

.project-url {
  font-size: 0.875rem;
  color: var(--fingo-orange);
  word-break: break-all;
  margin-bottom: 1rem;
  font-weight: 500;
}

.project-pools {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.project-pools-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.pool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pool-item {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}

.pool-item:hover {
  background: var(--fingo-orange);
  color: white;
  border-color: var(--fingo-orange);
  transform: translateY(-1px);
}

.test-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.test-header-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.test-header-status .test-status-badge {
  position: static;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

.test-time-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 1rem;
  font-family: 'Courier New', monospace;
  background: rgba(99, 161, 250, 0.12);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.test-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.test-button {
  background: linear-gradient(135deg, var(--fingo-blue) 0%, #5088e8 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(99, 161, 250, 0.3);
}

.test-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 161, 250, 0.4);
}

.test-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.test-status {
  margin-top: 1.5rem;
  text-align: left;
  display: none;
}

.test-status.visible {
  display: block;
}

.test-status-badge.running {
  background: rgba(99, 161, 250, 0.2);
  color: #5088e8;
}

.test-status-badge.success {
  background: rgba(145, 200, 78, 0.2);
  color: #6b9c38;
}

.test-status-badge.failed {
  background: rgba(235, 64, 91, 0.2);
  color: #eb405b;
}

.test-logs {
  background: #1a1f2e;
  color: #e4e6eb;
  padding: 1rem;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.footer {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-size: 0.875rem;
}

@media (max-width: 768px) {
  .header-content { padding: 0 1rem; }
  .container { padding: 1rem; }
  .info-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
}

/* Loading spinner */
.spinner {
  border: 3px solid rgba(255,255,255,0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-left: 0.5rem;
}

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

.error-message {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-size: 1.125rem;
}

/* ── Test Results Cards ──────────────────────────────────────── */

.test-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

.test-result-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.test-card-header {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  gap: 0.75rem;
  flex-wrap: wrap;
}

.test-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.test-card-label {
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(99, 161, 250, 0.15);
  color: var(--fingo-blue);
}

.test-card-report-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--fingo-blue);
  text-decoration: none;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  background: rgba(99, 161, 250, 0.1);
  border: 1px solid rgba(99, 161, 250, 0.25);
  transition: all 0.2s;
  margin-left: auto;
}

.test-card-report-link:hover {
  background: rgba(99, 161, 250, 0.2);
  transform: translateY(-1px);
}

.test-card-body {
  padding: 1rem 1.25rem;
}

.test-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.test-card-summary {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.test-count-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.test-count-badge.passed {
  background: rgba(145, 200, 78, 0.15);
  color: #6b9c38;
}

.test-count-badge.failed {
  background: rgba(235, 64, 91, 0.15);
  color: #eb405b;
}

.test-count-badge.skipped {
  background: rgba(128, 128, 128, 0.15);
  color: var(--text-muted);
}

.test-project-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.test-project-row:first-child {
  border-top: none;
}

.test-project-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.test-project-icon.passed { background: #91c84e; }
.test-project-icon.failed { background: #eb405b; }
.test-project-icon.skipped { background: #999; }

.test-project-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 80px;
}

.test-project-stats {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.test-project-duration {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  margin-left: auto;
}

.test-project-report-link {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fingo-blue);
  text-decoration: none;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: rgba(99, 161, 250, 0.08);
  transition: all 0.2s;
}

.test-project-report-link:hover {
  background: rgba(99, 161, 250, 0.2);
}

.test-failure-list {
  padding-left: 1.75rem;
  margin-top: 0.25rem;
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.25s ease;
  max-height: 500px;
  opacity: 1;
}

.test-failure-list.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
}

.test-project-row.has-details {
  cursor: pointer;
  user-select: none;
}

.test-project-row.has-details:hover {
  background: rgba(128, 128, 128, 0.06);
  border-radius: 6px;
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.test-project-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  position: relative;
}

.test-project-chevron::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translate(-50%, -50%) rotate(-45deg);
  transition: transform 0.25s ease;
}

.test-project-row.has-details.expanded .test-project-chevron::after {
  transform: translate(-50%, -70%) rotate(45deg);
}

.test-failure-item {
  font-size: 0.8rem;
  color: #eb405b;
  padding: 0.15rem 0;
  line-height: 1.4;
}

.test-failure-item::before {
  content: '\25B8 ';
  font-weight: bold;
}

/* Section header split badges */
.test-type-badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.test-type-result {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.test-type-result.success {
  background: rgba(145, 200, 78, 0.15);
  color: #6b9c38;
}

.test-type-result.failed {
  background: rgba(235, 64, 91, 0.15);
  color: #eb405b;
}

/* Header bar overall test badge */
.header-test-badge {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  padding: 0.4rem 0.9rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 32px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  border: none;
}

.header-test-badge:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}

.header-test-badge.passed {
  background: rgba(145, 200, 78, 0.35);
}

.header-test-badge.failed {
  background: rgba(235, 64, 91, 0.35);
}

/* Project card clickable badges */
.test-status-badge.clickable {
  cursor: pointer;
  transition: all 0.2s;
}

.test-status-badge.clickable:hover {
  transform: scale(1.05);
  filter: brightness(1.15);
}

@media (max-width: 768px) {
  .test-results-grid {
    grid-template-columns: 1fr;
  }
  .test-project-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  .test-project-duration {
    margin-left: 0;
  }
}
