/* ==========================================================================
   WABA Speed Tester - Shadcn-inspired Design System
   ========================================================================== */

:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 142.1 76.2% 36.3%;
  --primary-foreground: 355.7 100% 97.3%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 142.1 76.2% 36.3%;
  --radius: 0.5rem;
}

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

button, input, select, textarea {
  font-family: inherit;
}

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ============ Header ============ */
.header {
  background: hsl(var(--card));
  border-bottom: 1px solid hsl(var(--border));
  position: sticky;
  top: 0;
  z-index: 50;
}

.header__container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header__logo {
  width: 20px;
  height: 20px;
  color: hsl(var(--primary));
}

.header__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
  border-radius: 9999px;
}

.status-badge__dot {
  width: 6px;
  height: 6px;
  background: hsl(var(--primary));
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}

.btn-logout:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.btn-logout i {
  width: 16px;
  height: 16px;
}

/* ============ Dashboard ============ */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.section-header {
  margin-bottom: 1.5rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: hsl(var(--foreground));
}

.section-subtitle {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

/* ============ Stats Grid ============ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-card__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.stat-card__icon-wrapper {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  color: hsl(var(--muted-foreground));
}

.stat-card__icon-wrapper i {
  width: 16px;
  height: 16px;
}

.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}

/* Stat variants */
.stat-card--current .stat-card__icon-wrapper {
  background: hsl(217.2 91.2% 59.8% / 0.1);
  color: hsl(217.2 91.2% 59.8%);
}

.stat-card--peak .stat-card__icon-wrapper {
  background: hsl(262.1 83.3% 57.8% / 0.1);
  color: hsl(262.1 83.3% 57.8%);
}

.stat-card--success .stat-card__icon-wrapper {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.stat-card--failed .stat-card__icon-wrapper {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

/* ============ Bottom Grid ============ */
.dashboard__bottom {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 1.5rem;
}

/* ============ Card ============ */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.5rem;
}

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

.card-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-icon {
  width: 16px;
  height: 16px;
  color: hsl(var(--muted-foreground));
}

.card__title {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

/* ============ Controls ============ */
.controls__content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.controls__group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.controls__label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.controls__input-row {
  display: flex;
  gap: 0.5rem;
}

.input-with-unit {
  position: relative;
  flex: 1;
}

.input-with-unit .unit {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.controls__help {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

/* ============ Form Elements ============ */
.input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--foreground));
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input-with-unit .input {
  padding-right: 2rem;
}

/* ============ Buttons ============ */
.btn-primary-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary-sm:hover {
  opacity: 0.9;
}

.btn-text-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--destructive));
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-text-danger:hover {
  background: hsl(var(--destructive) / 0.1);
}

.btn-text-danger i {
  width: 14px;
  height: 14px;
}

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-ghost-sm:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.btn-ghost-sm i {
  width: 14px;
  height: 14px;
}

/* ============ Endpoint ============ */
.endpoint__content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.code-block-modern {
  background: hsl(var(--muted));
  border-radius: var(--radius);
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
}

.code-header .method {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--primary));
}

.code-header .endpoint-type {
  font-size: 0.625rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-block-modern code {
  display: block;
  padding: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
  word-break: break-all;
}

.endpoint-meta-modern {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.meta-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  min-width: 50px;
}

.meta-value {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  color: hsl(var(--foreground));
  background: hsl(var(--muted));
  padding: 0.25rem 0.5rem;
  border-radius: calc(var(--radius) - 2px);
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transform: translateY(calc(100% + 2rem));
  transition: transform 0.2s ease-out;
  z-index: 100;
}

.toast--visible {
  transform: translateY(0);
}

/* ============ Login Page ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--muted));
  padding: 1rem;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 2rem;
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.brand-app {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.brand-icon {
  width: 24px;
  height: 24px;
  color: hsl(var(--primary));
}

.login-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.login-header p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font-size: 0.875rem;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  background: transparent;
  color: hsl(var(--foreground));
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrapper input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: hsl(var(--muted-foreground));
  pointer-events: none;
}

.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 0.5rem;
}

.btn-login:hover {
  opacity: 0.9;
}

.btn-login .btn-icon {
  width: 16px;
  height: 16px;
}

.error-message {
  display: none;
  padding: 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.1);
  border-radius: var(--radius);
  text-align: center;
}

.error-message.visible {
  display: block;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  .dashboard__bottom {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .header__container {
    padding: 0.75rem 1rem;
  }

  .dashboard {
    padding: 1rem;
  }
}

/* ============ Tab Navigation ============ */
.header__nav {
  display: flex;
  gap: 0.25rem;
}

.nav-tab {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-tab:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.nav-tab.active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============ Webhook Tab ============ */
.webhook-status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card--info .stat-card__icon-wrapper {
  background: hsl(199 89% 48% / 0.1);
  color: hsl(199 89% 48%);
}

.stat-card__value--small {
  font-size: 1.25rem;
}

.status--active {
  color: hsl(var(--primary)) !important;
}

.status--disabled {
  color: hsl(var(--muted-foreground)) !important;
}

.card--wide {
  grid-column: span 2;
}

.card--full {
  width: 100%;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.controls__input-row--full {
  width: 100%;
}

.input--full {
  width: 100%;
}

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
}

.toggle-input {
  display: none;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.toggle-switch {
  width: 44px;
  height: 24px;
  background: hsl(var(--muted));
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-input:checked + .toggle-label .toggle-switch {
  background: hsl(var(--primary));
}

.toggle-input:checked + .toggle-label .toggle-switch::after {
  transform: translateX(20px);
}

.toggle-text {
  font-size: 0.875rem;
  color: hsl(var(--foreground));
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: hsl(var(--primary));
}

.controls__row {
  display: flex;
  gap: 1.5rem;
}

.controls__group--inline {
  flex: 1;
}

.controls__actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--border));
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--primary-foreground));
  background: hsl(var(--primary));
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: transparent;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-ghost:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

/* Code Block Dark */
.code-block--dark {
  background: hsl(240 10% 3.9%);
}

.code-block--dark .code-header {
  border-bottom-color: hsl(240 5% 20%);
}

.code-block--dark code,
.code-block--dark pre {
  color: hsl(0 0% 90%);
}

.code-content {
  margin: 0;
  padding: 1rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
}

/* ============ Messages Tab ============ */
.message-stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card--small {
  padding: 1rem;
}

.stat-card--small .stat-card__value {
  font-size: 1.5rem;
}

.messages-filter {
  margin-bottom: 1rem;
}

.input--select {
  max-width: 200px;
  cursor: pointer;
}

.messages-table-wrapper {
  overflow-x: auto;
}

.messages-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.messages-table th,
.messages-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.messages-table th {
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
}

.messages-table tbody tr:hover {
  background: hsl(var(--muted) / 0.5);
}

.messages-empty td {
  text-align: center;
  color: hsl(var(--muted-foreground));
  padding: 2rem;
}

.msg-id {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

.status-badge--accepted {
  background: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

.status-badge--queued {
  background: hsl(38 92% 50% / 0.12);
  color: hsl(38 92% 45%);
}

.status-badge--sent {
  background: hsl(199 89% 48% / 0.1);
  color: hsl(199 89% 48%);
}

.status-badge--delivered {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.status-badge--read {
  background: hsl(262.1 83.3% 57.8% / 0.1);
  color: hsl(262.1 83.3% 57.8%);
}

.status-badge--failed {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.btn-icon i {
  width: 16px;
  height: 16px;
}

.messages-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--border));
}

.page-info {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.btn-ghost-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ Modal ============ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
}

.modal--visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal__content {
  position: relative;
  background: hsl(var(--card));
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.modal__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  transition: background 0.15s;
}

.modal__close:hover {
  background: hsl(var(--muted));
}

.modal__close i {
  width: 20px;
  height: 20px;
}

.modal__body {
  padding: 1.5rem;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
}

.detail-group {
  margin-bottom: 1.25rem;
}

.detail-group:last-child {
  margin-bottom: 0;
}

.detail-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.375rem;
}

.detail-group code {
  display: block;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.8125rem;
  color: hsl(var(--foreground));
  word-break: break-all;
}

.detail-group span {
  font-size: 0.875rem;
  color: hsl(var(--foreground));
}

.status-badge-inline {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

.status-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: hsl(var(--muted));
  border-radius: var(--radius);
}

.timeline-status {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
}

.timeline-time {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.code-block-small {
  margin: 0;
  padding: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  background: hsl(var(--muted));
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============ Responsive - New Components ============ */
@media (max-width: 768px) {
  .header__nav {
    display: none;
  }

  .webhook-status-grid {
    grid-template-columns: 1fr;
  }

  .card--wide {
    grid-column: span 1;
  }

  .message-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .controls__row {
    flex-direction: column;
    gap: 1rem;
  }
}

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

  .messages-table th:nth-child(4),
  .messages-table td:nth-child(4) {
    display: none;
  }
}

/* ============ Tests Tab ============ */
.tests-table-wrapper {
  overflow-x: auto;
}

.tests-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tests-table th,
.tests-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid hsl(var(--border));
}

.tests-table th {
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
}

.tests-table tbody tr {
  transition: background 0.15s;
}

.tests-table tbody tr:hover {
  background: hsl(var(--muted) / 0.5);
}

.tests-empty td {
  text-align: center;
  padding: 3rem 1rem;
  color: hsl(var(--muted-foreground));
}

.th-checkbox,
.td-checkbox {
  width: 48px;
  text-align: center !important;
  padding-left: 1rem !important;
}

/* Custom checkbox styling */
.test-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.test-checkbox:hover {
  border-color: hsl(var(--primary));
}

.test-checkbox:checked {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

.test-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid hsl(var(--primary-foreground));
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.test-checkbox:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

.test-name {
  font-weight: 500;
  color: hsl(var(--foreground));
}

.td-actions {
  display: flex;
  gap: 0.25rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.btn-icon--danger:hover {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

.success-rate {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

.success-rate--good {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.success-rate--ok {
  background: hsl(45 93% 47% / 0.15);
  color: hsl(32 95% 44%);
}

.success-rate--bad {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

/* ============ Save Test Modal ============ */
.modal__content--small {
  max-width: 420px;
}

.modal__content--wide {
  max-width: 700px;
}

.input--textarea {
  min-height: 80px;
  resize: vertical;
}

.test-preview {
  margin-top: 1.5rem;
  padding: 1rem;
  background: hsl(var(--muted) / 0.5);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

.test-preview h4 {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.test-preview__stats {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.preview-stat__label {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

.preview-stat__value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}

/* ============ Compare Modal ============ */
.compare-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid hsl(var(--border));
}

.compare-test {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.compare-test--left {
  text-align: left;
}

.compare-test--right {
  text-align: right;
}

.compare-test__name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.compare-test__date {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.compare-vs {
  padding: 0.375rem 0.875rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted));
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.compare-metrics {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.compare-row {
  display: grid;
  grid-template-columns: 140px 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid hsl(var(--border));
}

.compare-row:last-child {
  border-bottom: none;
}

.compare-row__label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.compare-row__value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  font-variant-numeric: tabular-nums;
}

.compare-row__value:nth-child(2) {
  text-align: right;
}

.compare-row__value:nth-child(4) {
  text-align: left;
}

.compare-row__diff {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  min-width: 60px;
}

.diff--positive {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.diff--negative {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

/* ============ Test Detail Modal ============ */
.test-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.detail-stat {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem;
}

.detail-stat__value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(var(--foreground));
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.detail-stat__label {
  display: block;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

.detail-stat--success .detail-stat__value {
  color: hsl(var(--primary));
}

.detail-stat--failed .detail-stat__value {
  color: hsl(var(--destructive));
}

/* ============ Tests Responsive ============ */
@media (max-width: 768px) {
  .test-detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .compare-row {
    grid-template-columns: 100px 1fr auto 1fr;
    gap: 0.5rem;
  }

  .compare-header {
    grid-template-columns: 1fr;
    gap: 1rem;
    text-align: center;
  }

  .compare-test--left,
  .compare-test--right {
    text-align: center;
  }

  .tests-table th:nth-child(3),
  .tests-table td:nth-child(3) {
    display: none;
  }
}

@media (max-width: 480px) {
  .test-detail-stats {
    grid-template-columns: 1fr;
  }

  .compare-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .compare-row__label {
    grid-column: span 2;
    margin-bottom: 0.25rem;
  }

  .compare-row__diff {
    grid-column: span 2;
    justify-self: center;
    margin-top: 0.25rem;
  }

  .compare-row__value:nth-child(2),
  .compare-row__value:nth-child(4) {
    text-align: center;
  }

  .tests-table th:nth-child(5),
  .tests-table td:nth-child(5) {
    display: none;
  }
}

/* ============ Test Status Bar ============ */
.test-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.test-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.test-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: background 0.2s;
}

.test-status-dot--idle {
  background: hsl(var(--muted-foreground));
}

.test-status-dot--running {
  background: hsl(var(--primary));
  animation: pulse 1s infinite;
}

.test-status-dot--completed {
  background: hsl(217.2 91.2% 59.8%);
}

.test-status-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.btn-primary-sm:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary-sm i,
.btn-primary-sm svg {
  width: 14px;
  height: 14px;
}
