/* =============================================================================
   Bizzdesign Support Diagnostics — Styles
   Brand guidelines: Inter font, blue palette, clean layout
   ============================================================================= */

:root {
  --bd-white: #FFFFFF;
  --bd-blue: #1659FF;
  --bd-dark-blue: #001D6C;
  --bd-black-blue: #02133E;
  --bd-light-grey: #E7EFFD;
  --bd-yellow: #FFD607;
  --bd-green: #53D576;
  --bd-violet: #9259EF;
  --bd-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bd-radius: 8px;
  --bd-shadow: 0 2px 8px rgba(2, 19, 62, 0.08);
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--bd-font);
  color: var(--bd-dark-blue);
  background: var(--bd-light-grey);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Header --- */
.header {
  background: var(--bd-black-blue);
  color: var(--bd-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  height: 28px;
  width: auto;
}

.header-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-email {
  font-size: 13px;
  opacity: 0.85;
}

/* --- Buttons --- */
.btn {
  font-family: var(--bd-font);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--bd-radius);
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:hover { opacity: 0.9; }

.btn-primary {
  background: var(--bd-blue);
  color: var(--bd-white);
}

.btn-secondary {
  background: var(--bd-light-grey);
  color: var(--bd-dark-blue);
}

.btn-outline {
  background: transparent;
  color: var(--bd-white);
  border: 1px solid rgba(255,255,255,0.3);
}

.btn-large {
  font-size: 15px;
  padding: 12px 32px;
}

/* --- Main --- */
.main {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

/* --- Breadcrumb --- */
.breadcrumb {
  font-size: 13px;
  margin-bottom: 16px;
  color: var(--bd-dark-blue);
}

.breadcrumb a {
  color: var(--bd-blue);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; opacity: 0.4; }

/* --- Views --- */
.view h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--bd-dark-blue);
}

/* --- Landing --- */
.landing {
  text-align: center;
  padding-top: 80px;
}

.landing h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--bd-dark-blue);
  margin-bottom: 12px;
  line-height: 1.2;
}

.landing p {
  font-size: 15px;
  color: var(--bd-dark-blue);
  opacity: 0.7;
  margin-bottom: 24px;
}

/* --- Card grid --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.card {
  background: var(--bd-white);
  border-radius: var(--bd-radius);
  padding: 16px;
  box-shadow: var(--bd-shadow);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.card:hover {
  border-color: var(--bd-blue);
}

.card-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.card-subtitle {
  font-size: 13px;
  opacity: 0.6;
}

/* --- Loading --- */
.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 0;
  font-size: 14px;
  color: var(--bd-dark-blue);
  opacity: 0.7;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--bd-light-grey);
  border-top-color: var(--bd-blue);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Error --- */
.error-container {
  background: #FFF3F3;
  border: 1px solid #FFCDD2;
  border-radius: var(--bd-radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.error-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.error-content { flex: 1; }

.error-code {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: #C62828;
}

.error-message {
  font-size: 14px;
  color: #B71C1C;
  margin-top: 2px;
}

.error-dismiss {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #C62828;
  line-height: 1;
}

/* --- Metrics grid --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--bd-white);
  border-radius: var(--bd-radius);
  padding: 16px;
  box-shadow: var(--bd-shadow);
}

.metric-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--bd-dark-blue);
}

.chart-wrapper {
  position: relative;
  height: 220px;
  width: 100%;
}

.metric-card canvas {
  width: 100%;
  height: 100%;
}

/* --- Footer --- */
.footer {
  background: var(--bd-black-blue);
  color: var(--bd-white);
  text-align: center;
  padding: 12px 24px;
  font-size: 12px;
  opacity: 0.7;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.footer-link {
  background: none;
  border: none;
  color: var(--bd-white);
  font-size: 12px;
  font-family: var(--bd-font);
  cursor: pointer;
  text-decoration: underline;
  opacity: 0.8;
  padding: 0;
}
.footer-link:hover { opacity: 1; }

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: 40px 0;
  font-size: 14px;
  opacity: 0.6;
}

/* --- AE activation filter --- */
.ae-active-count {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  padding: 8px 0;
}

.ae-warning-banner {
  font-size: 13px;
  font-weight: 500;
  color: #92400e;
  background: #fef3c7;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

/* --- Toolbar (search + view toggle) --- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  font-family: var(--bd-font);
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: var(--bd-radius);
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--bd-blue);
}

.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--bd-white);
  border-radius: var(--bd-radius);
  padding: 2px;
  box-shadow: var(--bd-shadow);
}

.view-toggle-btn {
  font-family: var(--bd-font);
  font-size: 18px;
  background: transparent;
  border: none;
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  color: var(--bd-dark-blue);
  opacity: 0.4;
  transition: opacity 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-toggle-btn:hover { opacity: 0.7; }
.view-toggle-btn.active { opacity: 1; background: var(--bd-light-grey); }

/* --- List view --- */
.list-view {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-view .card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 8px 16px;
  border-radius: 4px;
  box-shadow: none;
  border: 1px solid transparent;
  border-bottom: 1px solid #e0e0e0;
}

.list-view .card:hover {
  border-color: var(--bd-blue);
  background: var(--bd-white);
}

.list-view .card-title {
  margin-bottom: 0;
  font-size: 13px;
  font-weight: 500;
}

.list-view .card-subtitle {
  font-size: 12px;
  white-space: nowrap;
  text-align: right;
}

/* --- Sort dropdown --- */
.sort-select {
  font-family: var(--bd-font);
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: var(--bd-radius);
  background: var(--bd-white);
  color: var(--bd-dark-blue);
  cursor: pointer;
  outline: none;
  min-width: 140px;
}

.sort-select:focus {
  border-color: var(--bd-blue);
}

/* --- Product Selector --- */
.product-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  max-width: 640px;
}

.product-card {
  background: var(--bd-blue);
  color: var(--bd-white);
  border-radius: var(--bd-radius);
  padding: 32px 24px;
  box-shadow: 0 4px 12px rgba(22, 89, 255, 0.25);
  cursor: pointer;
  border: 2px solid var(--bd-blue);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
  text-align: center;
}

.product-card:hover,
.product-card:focus {
  background: var(--bd-dark-blue);
  border-color: var(--bd-dark-blue);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 29, 108, 0.3);
  outline: none;
}

.product-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.product-name {
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 6px;
  color: var(--bd-white);
}

.product-desc {
  font-size: 13px;
  opacity: 0.75;
}

/* --- Run state badges --- */
.run-state {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: capitalize;
}

.run-state--running {
  background: #E8F5E9;
  color: #2E7D32;
}

.run-state--stopped {
  background: #FFF3E0;
  color: #E65100;
}

.run-state--terminated {
  background: #ECEFF1;
  color: #546E7A;
}

.run-state--launched,
.run-state--unknown {
  background: #E3F2FD;
  color: #1565C0;
}

/* --- Session Picker Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(2, 19, 62, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bd-white);
  border-radius: var(--bd-radius);
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(2, 19, 62, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--bd-dark-blue);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--bd-dark-blue);
  line-height: 1;
}

.session-picker-list {
  padding: 8px 0;
}

.session-picker-item {
  padding: 12px 20px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s;
}

.session-picker-item:hover {
  background: var(--bd-light-grey);
}

.session-picker-item:last-child {
  border-bottom: none;
}

.session-picker-empty {
  padding: 24px 20px;
  text-align: center;
  color: #888;
  font-size: 14px;
}

/* =============================================================================
   Workspaces Performance — wp.js styles
   ============================================================================= */

.wp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.wp-date-filter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wp-date-filter label {
  font-size: 13px;
  color: var(--bd-dark-blue);
}

.wp-date-filter input[type="date"] {
  font-family: var(--bd-font);
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: var(--bd-radius);
}

.wp-search-sort {
  display: flex;
  gap: 8px;
  align-items: center;
}

.wp-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 16px;
  background: var(--bd-white);
  border-radius: var(--bd-radius);
  box-shadow: var(--bd-shadow);
  margin-bottom: 16px;
  font-size: 13px;
}

.wp-stat {
  white-space: nowrap;
}

.wp-view-header {
  margin-bottom: 16px;
}

.wp-view-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--bd-dark-blue);
}

.wp-user-name {
  font-size: 14px;
  color: #666;
  margin-top: 2px;
}

.wp-region-badge {
  font-size: 12px;
  font-weight: 400;
  color: var(--bd-blue);
  background: var(--bd-light-grey);
  padding: 2px 8px;
  border-radius: 12px;
  vertical-align: middle;
}

.wp-repeat-badge {
  font-size: 11px;
  color: #b45309;
  font-weight: 500;
}

.wp-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.wp-issue-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  background: #e0e7ff;
  color: var(--bd-dark-blue);
  font-weight: 500;
}

.wp-severity-warning {
  background: #fef3c7;
  color: #92400e;
}

.wp-severity-critical {
  background: #fee2e2;
  color: #991b1b;
}

/* Performance warning badge (used in wa.js and wp.js) */
.wp-perf-warning {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: #b45309;
  background: #fef3c7;
  padding: 3px 8px;
  border-radius: 12px;
  margin-top: 6px;
  width: fit-content;
}

/* --- Release Notes Modal --- */
.release-notes-modal {
  max-width: 560px;
}

.release-notes-body {
  padding: 16px 20px;
}

.release-entry {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}
.release-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.release-version {
  font-size: 15px;
  font-weight: 600;
  color: var(--bd-dark-blue);
  margin-bottom: 6px;
}

.release-date {
  font-weight: 400;
  font-size: 12px;
  color: #888;
  margin-left: 6px;
}

.release-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.release-tag-new {
  background: #e8f5e9;
  color: #2e7d32;
}
.release-tag-improved {
  background: #e3f2fd;
  color: #1565c0;
}

.release-entry ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.6;
  color: #444;
}
.release-entry li {
  margin-bottom: 4px;
}
