/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #1a56db;
  --primary-hover: #1e429f;
  --success:       #057a55;
  --success-bg:    #def7ec;
  --danger:        #c81e1e;
  --danger-bg:     #fde8e8;
  --warning:       #92400e;
  --warning-bg:    #fef3c7;
  --running:       #1c64f2;
  --running-bg:    #e1effe;
  --idle-text:     #6b7280;
  --idle-bg:       #f3f4f6;
  --bg:            #f9fafb;
  --surface:       #ffffff;
  --text:          #111827;
  --text-muted:    #6b7280;
  --border:        #e5e7eb;
  --radius:        12px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Header ─────────────────────────────────────────────── */
header {
  background: linear-gradient(135deg, #1e3a5f 0%, #1a56db 100%);
  color: white;
  padding: 24px 32px;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  padding: 8px 14px;
  border-radius: 8px;
  flex-shrink: 0;
}

header h1 {
  font-size: 20px;
  font-weight: 700;
}

.subtitle {
  font-size: 13px;
  opacity: 0.8;
  margin-top: 2px;
}

/* ─── Main Content ───────────────────────────────────────── */
main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px;
  flex: 1;
  width: 100%;
}

/* ─── Environment Bar ────────────────────────────────────── */
.env-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.env-bar label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.env-bar select {
  padding: 7px 32px 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.168l3.71-3.938a.75.75 0 1 1 1.08 1.04l-4.25 4.5a.75.75 0 0 1-1.08 0l-4.25-4.5a.75.75 0 0 1 .02-1.06z' clip-rule='evenodd' /%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.env-bar select:focus,
.env-bar input[type="text"]:focus { outline: 2px solid var(--primary); outline-offset: 2px; }

.env-bar input[type="text"] {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  width: 160px;
}

/* ─── Cards ──────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover { box-shadow: var(--shadow-md); }

.card-running { border-color: #93c5fd; }
.card-passed  { border-color: #6ee7b7; }
.card-failed  { border-color: #fca5a5; }

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 20px 16px;
}

.suite-badge {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.suite-badge.pms { background: #e0e7ff; color: #3730a3; }
.suite-badge.web { background: #d1fae5; color: #065f46; }

.card-title h2 { font-size: 17px; font-weight: 700; }
.card-title p  { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* Card Body */
.card-body { padding: 0 20px 16px; }

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--idle-bg);
  color: var(--idle-text);
}

.status-badge.running  { background: var(--running-bg);  color: var(--running); }
.status-badge.passed   { background: var(--success-bg);  color: var(--success); }
.status-badge.failed   { background: var(--danger-bg);   color: var(--danger); }
.status-badge.canceled { background: var(--warning-bg);  color: var(--warning); }

.last-run { font-size: 11px; color: var(--text-muted); }

/* Progress Bar */
.progress-bar {
  height: 4px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  display: none;
}

.progress-bar.visible { display: block; }

.progress-fill {
  height: 100%;
  width: 40%;
  background: var(--primary);
  border-radius: 4px;
  animation: progress-sweep 1.6s ease-in-out infinite;
}

@keyframes progress-sweep {
  0%   { transform: translateX(-150%); }
  100% { transform: translateX(400%); }
}

/* Card Footer */
.card-footer {
  display: flex;
  gap: 10px;
  padding: 12px 20px 20px;
  border-top: 1px solid var(--border);
}

/* Buttons */
.btn-run {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  flex: 1;
  justify-content: center;
}

.btn-run svg { width: 16px; height: 16px; }
.btn-run:hover:not(:disabled) { background: var(--primary-hover); }
.btn-run:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-report {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.btn-report.visible { display: inline-flex; }
.btn-report svg { width: 16px; height: 16px; }
.btn-report:hover { background: var(--bg); border-color: #9ca3af; }

/* ─── Activity Log ───────────────────────────────────────── */
.log-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.log-header h3 { font-size: 14px; font-weight: 700; }

.btn-clear {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-clear:hover { background: var(--bg); color: var(--text); }

#activity-log {
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px 0;
}

#activity-log li {
  padding: 8px 20px;
  font-size: 13px;
  font-family: 'Menlo', 'Consolas', monospace;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

#activity-log li:last-child { border-bottom: none; }

.log-empty {
  color: var(--text-muted) !important;
  font-style: italic;
  font-family: inherit !important;
}

.log-time { color: var(--text-muted); margin-right: 6px; }

/* ─── Footer ─────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  header { padding: 18px 16px; }
  main   { padding: 24px 16px; }

  .logo { font-size: 18px; padding: 6px 10px; }
  header h1 { font-size: 17px; }

  .card-footer { flex-direction: column; }
  .btn-run, .btn-report { width: 100%; justify-content: center; }
}
