/**
 * Booking Reception — Admin Dashboard
 * Modern admin UI matching the onboarding wizard design system.
 *
 * Color palette
 *   Primary:  #6366f1 (indigo-500)
 *   Hover:    #4f46e5 (indigo-600)
 *   Light:    #818cf8 (indigo-400)
 *   Accent:   #eef2ff (indigo-50)
 *   Success:  #22c55e / #16a34a
 *   Warning:  #f59e0b / #fef3c7
 *   Danger:   #ef4444 / #fef2f2
 */

/* ------------------------------------------------------------------ */
/*  1. Design tokens                                                  */
/* ------------------------------------------------------------------ */
.br-admin-wrap {
  --br-indigo-500: #6366f1;
  --br-indigo-600: #4f46e5;
  --br-indigo-400: #818cf8;
  --br-indigo-50:  #eef2ff;

  --br-green-500: #22c55e;
  --br-green-600: #16a34a;
  --br-green-50:  #f0fdf4;

  --br-amber-500: #f59e0b;
  --br-amber-100: #fef3c7;

  --br-red-500: #ef4444;
  --br-red-50:  #fef2f2;

  --br-text:   #1e1e1e;
  --br-muted:  #6b7280;
  --br-border: #e5e7eb;
  --br-bg:     #f9fafb;

  --br-radius: 12px;
  --br-shadow: 0 4px 24px rgba(0, 0, 0, 0.08),
               0 1px 3px rgba(0, 0, 0, 0.04);

  max-width: 1200px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  color: var(--br-text);
}

/* ------------------------------------------------------------------ */
/*  2. Page header                                                    */
/* ------------------------------------------------------------------ */
.br-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 32px;
  background: linear-gradient(135deg, var(--br-indigo-500) 0%, var(--br-indigo-600) 100%);
  border-radius: var(--br-radius);
  color: #fff;
  margin-bottom: 24px;
  animation: brAdminFadeUp 0.4s ease both;
}

.br-page-header__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.br-page-header__icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.br-page-header__icon .dashicons {
  font-size: 24px;
  width: 24px;
  height: 24px;
  color: #fff;
}

.br-page-header__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  color: #fff;
}

.br-page-header__subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  margin: 2px 0 0;
}

.br-page-header__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/*  3. Buttons                                                        */
/* ------------------------------------------------------------------ */
.br-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
  font-family: inherit;
}

.br-btn .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  line-height: 16px;
}

.br-btn--primary {
  background: var(--br-indigo-500);
  color: #fff;
}

.br-btn--primary:hover,
.br-btn--primary:focus {
  background: var(--br-indigo-600);
  color: #fff;
}

/* Primary on dark bg (header) */
.br-page-header .br-btn--primary {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.br-page-header .br-btn--primary:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.br-page-header .br-btn--secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.br-page-header .br-btn--secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.br-btn--secondary {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
}

.br-btn--secondary:hover,
.br-btn--secondary:focus {
  border-color: #9ca3af;
  color: #1e1e1e;
}

.br-btn--danger {
  background: #fff;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.br-btn--danger:hover,
.br-btn--danger:focus {
  background: var(--br-red-50);
  border-color: #f87171;
}

.br-btn--sm {
  padding: 7px 14px;
  font-size: 13px;
}

.br-btn:active {
  transform: scale(0.97);
}

/* ------------------------------------------------------------------ */
/*  4. Cards grid                                                     */
/* ------------------------------------------------------------------ */
.br-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ------------------------------------------------------------------ */
/*  5. Card                                                           */
/* ------------------------------------------------------------------ */
.br-card {
  background: #fff;
  border-radius: var(--br-radius);
  box-shadow: var(--br-shadow);
  border: 1px solid var(--br-border);
  overflow: hidden;
  animation: brAdminFadeUp 0.4s ease both;
}

.br-card:nth-child(1) { animation-delay: 0s; }
.br-card:nth-child(2) { animation-delay: 0.05s; }
.br-card:nth-child(3) { animation-delay: 0.1s; }
.br-card:nth-child(4) { animation-delay: 0.15s; }
.br-card:nth-child(5) { animation-delay: 0.2s; }
.br-card:nth-child(6) { animation-delay: 0.25s; }

.br-card--wide {
  grid-column: 1 / -1;
}

.br-card__header {
  padding: 18px 24px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.br-card__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--br-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.br-card__title .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
  color: var(--br-indigo-500);
}

.br-card__body {
  padding: 24px;
}

.br-card__body p.br-desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--br-muted);
  line-height: 1.6;
}

/* ------------------------------------------------------------------ */
/*  6. Hero connection card                                           */
/* ------------------------------------------------------------------ */
.br-hero {
  padding: 28px;
}

.br-hero--connected {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border-color: #bbf7d0;
}

.br-hero--disconnected {
  background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
  border-color: #fde68a;
}

.br-hero__status {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.br-hero__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.br-hero__icon .dashicons {
  font-size: 26px;
  width: 26px;
  height: 26px;
}

.br-hero--connected .br-hero__icon {
  background: rgba(22, 163, 106, 0.12);
  color: var(--br-green-600);
}

.br-hero--disconnected .br-hero__icon {
  background: rgba(245, 158, 11, 0.15);
  color: #92400e;
}

.br-hero__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--br-text);
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.br-hero__desc {
  font-size: 14px;
  color: var(--br-muted);
  margin: 0;
  line-height: 1.6;
}

.br-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.br-hero__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 6px;
  font-size: 12px;
  color: #374151;
}

.br-hero__chip strong {
  color: var(--br-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.br-hero__chip code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  color: var(--br-text);
  background: transparent;
  padding: 0;
}

.br-hero__actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.br-hero__steps {
  margin: 16px 0 0;
  padding: 0 0 0 24px;
  line-height: 2;
  font-size: 14px;
  color: #374151;
}

.br-hero__steps a {
  color: var(--br-indigo-500);
  font-weight: 500;
}

/* ------------------------------------------------------------------ */
/*  7. Badges                                                         */
/* ------------------------------------------------------------------ */
.br-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.br-badge--success {
  background: #dcfce7;
  color: #166534;
}

.br-badge--warning {
  background: #fef3c7;
  color: #92400e;
}

.br-badge--neutral {
  background: #f3f4f6;
  color: #4b5563;
}

/* ------------------------------------------------------------------ */
/*  8. Pulse dot                                                      */
/* ------------------------------------------------------------------ */
.br-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--br-green-500);
  animation: brPulse 2s ease-in-out infinite;
}

.br-pulse--warning {
  background: var(--br-amber-500);
}

@keyframes brPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  50%      { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* ------------------------------------------------------------------ */
/*  9. API key section                                                */
/* ------------------------------------------------------------------ */
.br-key-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 16px 0;
}

.br-codebox {
  flex: 1;
  padding: 10px 16px;
  background: var(--br-bg);
  border: 1px solid var(--br-border);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
  color: #374151;
}

.br-key-actions {
  margin: 12px 0;
}

.br-key-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--br-amber-100);
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
  margin-top: 12px;
}

.br-key-warning .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #92400e;
}

#copy-api-key.copied {
  background: var(--br-green-500);
  border-color: var(--br-green-500);
  color: #fff;
}

/* ------------------------------------------------------------------ */
/*  10. Health indicators                                             */
/* ------------------------------------------------------------------ */
.br-health {
  list-style: none;
  margin: 0;
  padding: 0;
}

.br-health-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}

.br-health-item:last-child {
  border-bottom: none;
}

.br-health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.br-health-dot--ok    { background: var(--br-green-500); }
.br-health-dot--warn  { background: var(--br-amber-500); }
.br-health-dot--error { background: var(--br-red-500); }

.br-health-label {
  flex: 1;
  color: var(--br-muted);
}

.br-health-value {
  font-weight: 500;
  color: var(--br-text);
}

.br-health-value code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 11px;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 4px;
}

/* ------------------------------------------------------------------ */
/*  11. Stat tiles                                                    */
/* ------------------------------------------------------------------ */
.br-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.br-stat {
  text-align: center;
  padding: 22px 16px;
  background: var(--br-bg);
  border-radius: 10px;
  border: 1px solid var(--br-border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.br-stat:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.br-stat__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.br-stat__icon .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

.br-stat__icon--arrivals {
  background: var(--br-indigo-50);
  color: var(--br-indigo-500);
}

.br-stat__icon--departures {
  background: var(--br-green-50);
  color: var(--br-green-600);
}

.br-stat__value {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: var(--br-text);
  line-height: 1;
}

.br-stat__label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--br-muted);
  font-weight: 500;
}

/* ------------------------------------------------------------------ */
/*  12. Plugin rows                                                   */
/* ------------------------------------------------------------------ */
.br-active-plugin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--br-indigo-50);
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--br-text);
}

.br-plugin-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.br-plugin-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
}

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

.br-plugin-row__name {
  flex: 1;
  color: var(--br-text);
}

.br-plugin-selector {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f3f4f6;
}

.br-plugin-selector label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--br-text);
  margin-bottom: 8px;
}

.br-plugin-selector select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  margin-right: 8px;
}

/* ------------------------------------------------------------------ */
/*  13. Detected fields                                               */
/* ------------------------------------------------------------------ */
.br-detected-fields {
  background: var(--br-indigo-50);
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 16px;
}

.br-detected-fields strong {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--br-text);
}

.br-detected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.8;
  font-size: 13px;
  color: #374151;
}

.br-detected-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  background: #fff;
  border: 1px solid #c7d2fe;
  border-radius: 4px;
  font-size: 12px;
}

.br-detected-tag .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  color: var(--br-green-600);
}

.br-not-detected {
  color: #dc2626;
  font-size: 13px;
}

/* ------------------------------------------------------------------ */
/*  14. Accordion                                                     */
/* ------------------------------------------------------------------ */
.br-accordion {
  border: 1px solid var(--br-border);
  border-radius: 8px;
  overflow: hidden;
}

.br-accordion summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: #374151;
  background: var(--br-bg);
  transition: background 0.2s;
  list-style: none;
}

.br-accordion summary::-webkit-details-marker {
  display: none;
}

.br-accordion summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.2s;
}

.br-accordion[open] summary::before {
  transform: rotate(90deg);
}

.br-accordion summary:hover {
  background: #f3f4f6;
}

.br-accordion[open] summary {
  border-bottom: 1px solid var(--br-border);
}

.br-accordion__body {
  padding: 18px;
}

.br-accordion__body .form-table th {
  padding: 10px 10px 10px 0;
  font-weight: 500;
  font-size: 13px;
  width: 180px;
}

.br-accordion__body select {
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  font-size: 13px;
  max-width: 400px;
  width: 100%;
}

.br-accordion__body .description {
  font-size: 12px;
  color: var(--br-muted);
  margin-top: 4px;
}

.br-accordion__body .submit {
  display: flex;
  gap: 8px;
  padding-top: 10px;
}

/* ------------------------------------------------------------------ */
/*  15. Wizard banner                                                 */
/* ------------------------------------------------------------------ */
.br-wizard-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--br-indigo-50);
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 20px;
  font-size: 14px;
  animation: brAdminFadeUp 0.35s ease both;
}

.br-wizard-banner .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  color: var(--br-indigo-500);
  flex-shrink: 0;
}

.br-wizard-banner a {
  color: var(--br-indigo-500);
  font-weight: 600;
  text-decoration: none;
  margin-left: 6px;
}

.br-wizard-banner a:hover {
  color: var(--br-indigo-600);
  text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/*  16. No-plugin notice                                              */
/* ------------------------------------------------------------------ */
.br-notice {
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.br-notice--error {
  background: var(--br-red-50);
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.br-notice--error .dashicons {
  color: var(--br-red-500);
  font-size: 18px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ------------------------------------------------------------------ */
/*  17. Debug card                                                    */
/* ------------------------------------------------------------------ */
.br-debug-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.br-debug-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 500;
  color: var(--br-muted);
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
  width: 35%;
}

.br-debug-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

.br-debug-table code {
  font-size: 12px;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 3px;
}

.br-debug-table pre {
  max-height: 300px;
  overflow-y: auto;
  background: #f3f4f6;
  padding: 10px;
  font-size: 12px;
  border-radius: 6px;
  margin: 0;
}

.br-debug-table ul {
  margin: 5px 0 0;
  padding: 0 0 0 18px;
  font-size: 12px;
}

.br-debug-table li {
  margin-bottom: 4px;
}

/* ------------------------------------------------------------------ */
/*  18. Animations                                                    */
/* ------------------------------------------------------------------ */
@keyframes brAdminFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------ */
/*  19. Responsive                                                    */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
  .br-cards {
    grid-template-columns: 1fr;
  }

  .br-card--wide {
    grid-column: auto;
  }

  .br-page-header {
    flex-direction: column;
    text-align: center;
    padding: 20px;
  }

  .br-page-header__left {
    flex-direction: column;
  }

  .br-page-header__actions {
    justify-content: center;
  }

  .br-hero__status {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .br-hero__meta {
    justify-content: center;
  }

  .br-hero__actions {
    justify-content: center;
    flex-wrap: wrap;
  }

  .br-key-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ------------------------------------------------------------------ */
/*  20. Reduced-motion preference                                     */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .br-card,
  .br-page-header,
  .br-wizard-banner {
    animation: none;
  }

  .br-pulse {
    animation: none;
  }

  .br-btn:active {
    transform: none;
  }
}
