/**
 * Best Practices Checker - FINAL ULTRA COMPACT
 */

/* ============================================
   Best Practices Button Row
   ============================================ */

.card-insights-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

/* ============================================
   Best Practices Button
   ============================================ */

.btn-best-practices {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 126px;
  min-height: 36px;
  padding: 0 14px;
  background: #ffffff !important;
  color: #047857 !important;
  border: 1px solid rgba(16, 185, 129, 0.22) !important;
  border-radius: 6px !important;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04) !important;
}

.btn-best-practices:hover {
  background: #f3fbf7 !important;
  color: #047857 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  transform: translateY(-0.5px);
  box-shadow: none !important;
}

.btn-best-practices:active {
  background: #edf9f3 !important;
  color: #047857 !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  transform: translateY(0);
  box-shadow: none !important;
}

.btn-best-practices svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn-best-practices span {
  line-height: 1;
}

/* ============================================
   Panel - Ultra Compact
   ============================================ */

.bp-panel {
  margin-top: 10px;
  margin-bottom: 10px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 8px;
  box-shadow: none;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transform: translateY(-6px);
  transition: opacity 0.22s ease, max-height 0.28s ease, transform 0.22s ease;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

.bp-panel.visible {
  opacity: 1;
  max-height: 520px;
  overflow-y: visible;
  transform: translateY(0);
}

.output-card.is-zoomed .bp-panel.visible {
  max-height: 22vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Custom scrollbar for Best Practices panel - Subtle */
.bp-panel::-webkit-scrollbar {
  width: 8px; /* Slightly thicker but more refined */
}

.bp-panel::-webkit-scrollbar-track {
  background: #f9fafb; /* Very subtle grey background */
  border-radius: 0 10px 10px 0; /* Match panel right edge */
  margin: 4px 0; /* Inset from edges */
}

.bp-panel::-webkit-scrollbar-thumb {
  background: rgba(30, 136, 229, 0.25); /* Subtle blue - matches gradient */
  border-radius: 4px;
  border: 2px solid #f9fafb; /* Inset effect for elegance */
}

.bp-panel::-webkit-scrollbar-thumb:hover {
  background: rgba(30, 136, 229, 0.4); /* Slightly more visible on hover */
}

/* ============================================
   Header - EXACT MATCH to Card Top Stripe
   ============================================ */

.bp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px 8px;
  background: rgba(59, 130, 246, 0.08);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  border-radius: 8px 8px 0 0;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

.bp-panel.bp-score-excellent .bp-header {
  background: rgba(16, 185, 129, 0.09);
}

.bp-panel.bp-score-good .bp-header {
  background: rgba(59, 130, 246, 0.08);
}

.bp-panel.bp-score-warning .bp-header {
  background: rgba(245, 158, 11, 0.1);
}

.bp-panel.bp-score-poor .bp-header {
  background: rgba(239, 68, 68, 0.09);
}

.bp-score {
  display: flex;
  align-items: center;
  gap: 5px;
}

.bp-score-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  color: #1f2937;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

.bp-panel.bp-score-excellent .bp-score-value {
  color: #047857;
}

.bp-panel.bp-score-good .bp-score-value {
  color: #1d4ed8;
}

.bp-panel.bp-score-warning .bp-score-value {
  color: #b45309;
}

.bp-panel.bp-score-poor .bp-score-value {
  color: #b91c1c;
}

.bp-score-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

.bp-close {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 7px;
  color: #64748b;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.bp-close:hover {
  background: #f8fafc;
  color: #334155;
}

/* ============================================
   Body - Compact, No Internal Scroll
   ============================================ */

.bp-body {
  position: relative;
  padding: 12px 14px 34px;
  background: rgba(255, 255, 255, 0.18);
  overflow-y: visible;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

/* Zoomed cards - same treatment */
.output-card.is-zoomed .bp-header {
  flex: 0 0 auto;
}

.output-card.is-zoomed .bp-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 20px;
}

.output-card.is-zoomed .bp-body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.bp-scroll-indicator {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 32px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, rgba(248, 250, 252, 0.78) 48%, rgba(248, 250, 252, 0.98) 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.bp-body.has-scroll .bp-scroll-indicator {
  opacity: 1;
}

.output-card:not(.is-zoomed) .bp-scroll-indicator {
  display: none !important;
}

.bp-scroll-indicator-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-bottom: 5px;
  color: rgba(71, 85, 105, 0.92);
  font-size: 14px;
  line-height: 1;
}

.bp-section {
  margin-bottom: 4px;
}

.bp-section:last-child {
  margin-bottom: 0;
}

.bp-section h4 {
  margin: 0 0 4px 0;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

.bp-section h4 svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.bp-section ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.bp-section li {
  position: relative;
  padding: 6px 8px 6px 16px;
  margin-bottom: 4px;
  background: rgba(241, 245, 249, 0.78);
  border: none;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.35;
  color: #374151;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
}

.bp-section li:last-child {
  margin-bottom: 0;
}

.bp-section li::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 7px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #3b82f6;
}

/* Issues */
.bp-issues li {
  background: rgba(254, 242, 242, 0.3);
  border-left: 3px solid #ef4444;
  color: #991b1b;
}

.bp-issues li::before {
  background: #ef4444;
}

/* Recommendations */
.bp-recommendations li {
  background: rgba(254, 243, 199, 0.3);
  border-left: 3px solid #f59e0b;
  color: #92400e;
}

.bp-recommendations li::before {
  background: #f59e0b;
}

/* Best Practices */
.bp-practices-met li {
  background: rgba(236, 253, 245, 0.4);
  border-left: 3px solid #10b981;
  color: #065f46;
}

.bp-practices-met li::before {
  background: #10b981;
}

/* ============================================
   Footer - Compact
   ============================================ */

.bp-footer {
  padding: 10px 12px 12px;
  background: rgba(255, 255, 255, 0.14);
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 0 0 8px 8px;
}

.output-card.is-zoomed .bp-footer {
  flex: 0 0 auto;
  padding-bottom: 20px;
}

.btn-apply-fixes {
  width: auto;
  min-width: 0;
  max-width: 100%;
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  min-height: 36px;
  background: #f3f7ff;
  color: #2153a9;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: 6px !important;
  font-size: 13px;
  font-weight: 700;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.btn-apply-fixes:hover {
  background: #eaf2ff;
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.24);
  transform: translateY(-0.5px);
  box-shadow: none !important;
}

.btn-apply-fixes:active {
  background: #e4eeff;
  transform: translateY(0);
  box-shadow: none !important;
}

/* ============================================
   Loading & Error States
   ============================================ */

.bp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  gap: 10px;
}

.bp-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #e5e7eb;
  border-top-color: #1E88E5;
  border-radius: 50%;
  animation: bp-spin 0.8s linear infinite;
}

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

.bp-loading p {
  margin: 0;
  color: #6b7280;
  font-size: 12px;
}

.bp-error {
  padding: 12px;
  text-align: center;
}

.bp-error h4 {
  margin: 0 0 6px 0;
  color: #ef4444;
  font-size: 13px;
}

.bp-error p {
  margin: 0 0 10px 0;
  color: #6b7280;
  font-size: 11px;
}

.btn-retry {
  padding: 6px 14px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.btn-retry:hover {
  background: #2563eb;
}
