/* components.css — Shared UI components ======================== */
/* Contains: loading overlay, notifications, modals, badges,
   form inputs, animations, and shared component patterns.
   Merged from: loading.css, notifications.css, and shared
   component sections of style.css. */


/* ================================================================
   LOADING OVERLAY
   ================================================================ */

/* loading.css - Modern Loading Overlay
 * 
 * Design: Refined minimalism with glassmorphism
 * Features:
 * - Dual-ring orbital spinner
 * - Glassmorphism backdrop  
 * - Shimmer text effect
 * - Progress bar (optional)
 * - Dark mode support
 * - Reduced motion support
 */

/* ================================================================
   LOADING OVERLAY - BASE
   ================================================================ */

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  
  /* Glassmorphism backdrop */
  background: rgba(250, 248, 246, 0.85);
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  
  /* Flexbox centering */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  
  /* Smooth transitions */
  opacity: 1;
  visibility: visible;
  transition: 
    opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ================================================================
   LOADING CARD
   ================================================================ */

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 56px;
  
  /* Card styling */
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    0 4px 6px -1px rgba(0, 0, 0, 0.05),
    0 10px 15px -3px rgba(0, 0, 0, 0.08),
    0 20px 40px -10px rgba(0, 0, 0, 0.1);
  
  /* Subtle float animation */
  animation: cardFloat 3s ease-in-out infinite;
}

@keyframes cardFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* ================================================================
   SPINNER - Orbital Design
   ================================================================ */

.loading-spinner-container {
  position: relative;
  width: 64px;
  height: 64px;
}

/* Outer ring */
.loading-spinner {
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-top-color: var(--accent, #FA582D);
  border-right-color: var(--accent, #FA582D);
  border-radius: 50%;
  animation: spinOuter 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

/* Inner ring - counter rotation */
.loading-spinner::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 2px solid transparent;
  border-bottom-color: var(--accent-light, #ff8a65);
  border-left-color: var(--accent-light, #ff8a65);
  border-radius: 50%;
  animation: spinInner 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
}

/* Center dot with pulse */
.loading-spinner::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  background: linear-gradient(135deg, var(--accent, #FA582D) 0%, var(--accent-light, #ff8a65) 100%);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes spinOuter {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spinInner {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.8); opacity: 0.7; }
}

/* ================================================================
   TEXT CONTENT
   ================================================================ */

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.loading-text {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg, #1c1917);
  letter-spacing: -0.02em;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Shimmer effect */
  background: linear-gradient(
    90deg,
    var(--fg, #1c1917) 0%,
    var(--fg, #1c1917) 40%,
    var(--fg-muted, #78716c) 50%,
    var(--fg, #1c1917) 60%,
    var(--fg, #1c1917) 100%
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.loading-subtext {
  margin: 0;
  font-size: 14px;
  font-weight: 400;
  color: var(--fg-muted, #78716c);
  max-width: 280px;
  line-height: 1.5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ================================================================
   PROGRESS BAR (Optional)
   ================================================================ */

.loading-progress {
  width: 200px;
  height: 4px;
  background: var(--border-subtle, #e7e5e4);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
}

.loading-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent, #FA582D) 0%, var(--accent-light, #ff8a65) 50%, var(--accent, #FA582D) 100%);
  background-size: 200% 100%;
  border-radius: inherit;
  width: 30%;
  animation: indeterminate 1.5s ease-in-out infinite;
}

@keyframes indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* ================================================================
   MINI MODE - For Quick Operations
   ================================================================ */

.loading-overlay.mini {
  background: rgba(250, 248, 246, 0.6);
  backdrop-filter: blur(4px);
}

.loading-overlay.mini .loading-card {
  padding: 24px 36px;
  animation: none;
}

.loading-overlay.mini .loading-spinner-container {
  width: 40px;
  height: 40px;
}

.loading-overlay.mini .loading-spinner {
  border-width: 2px;
}

.loading-overlay.mini .loading-spinner::before {
  inset: 4px;
}

.loading-overlay.mini .loading-spinner::after {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
}

.loading-overlay.mini .loading-text {
  font-size: 15px;
}

.loading-overlay.mini .loading-subtext,
.loading-overlay.mini .loading-progress {
  display: none;
}

/* ================================================================
   LEGACY SUPPORT - Original Structure
   ================================================================ */

/* If using original HTML structure without .loading-card wrapper */
.loading-overlay > .loading-spinner:first-child {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-subtle, #e7e5e4);
  border-top-color: var(--accent, #FA582D);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-overlay > .loading-spinner:first-child::before,
.loading-overlay > .loading-spinner:first-child::after {
  display: none;
}

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

.loading-overlay > .loading-text {
  margin-top: 16px;
  font-size: 16px;
  color: var(--fg-muted, #78716c);
  font-weight: 500;
}

.loading-overlay > .loading-subtext {
  margin-top: 8px;
  font-size: 13px;
  color: var(--fg-muted, #a8a29e);
}

/* ================================================================
   DARK MODE
   ================================================================ */

:root[data-theme="dark"] .loading-overlay {
  background: rgba(12, 10, 9, 0.85);
  backdrop-filter: blur(12px) saturate(150%);
}

:root[data-theme="dark"] .loading-card {
  background: rgba(28, 25, 23, 0.95);
  border-color: rgba(68, 64, 60, 0.5);
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.2),
    0 10px 15px -3px rgba(0, 0, 0, 0.3),
    0 20px 40px -10px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .loading-overlay.mini {
  background: rgba(12, 10, 9, 0.6);
}

/* ================================================================
   ACCESSIBILITY - Reduced Motion
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  .loading-overlay,
  .loading-card,
  .loading-spinner,
  .loading-spinner::before,
  .loading-spinner::after,
  .loading-text,
  .loading-progress-bar {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  /* Simple rotating spinner for reduced motion */
  .loading-spinner {
    border-color: transparent;
    border-top-color: var(--accent, #FA582D);
    animation: spin 2s linear infinite !important;
  }
  
  .loading-spinner::before,
  .loading-spinner::after {
    display: none;
  }
  
  .loading-text {
    background: none !important;
    color: var(--fg, #1c1917) !important;
    -webkit-background-clip: unset;
    background-clip: unset;
  }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 480px) {
  .loading-card {
    padding: 32px 40px;
    margin: 0 16px;
    border-radius: 16px;
  }
  
  .loading-spinner-container {
    width: 56px;
    height: 56px;
  }
  
  .loading-text {
    font-size: 16px;
  }
  
  .loading-subtext {
    font-size: 13px;
    max-width: 240px;
  }
  
  .loading-progress {
    width: 160px;
  }
}

/* ================================================================
   NOTIFICATIONS
   ================================================================ */

/* ===== Notification Bell ===== */

.notification-bell {
  position: relative;
}

.notification-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
  animation: notification-pulse 2s ease-in-out infinite;
}

@keyframes notification-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* ===== Notification Dropdown ===== */

.notification-dropdown {
  position: fixed;
  z-index: 1000;
  width: 360px;
  max-height: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.notification-dropdown--open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Header */
.notification-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.notification-dropdown-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}

.notification-mark-all-btn {
  background: none;
  border: none;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
  transition: background 0.15s ease;
}

.notification-mark-all-btn:hover {
  background: var(--accent-soft);
}

/* Body */
.notification-dropdown-body {
  overflow-y: auto;
  flex: 1;
  max-height: 400px;
}

/* Empty state */
.notification-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  color: var(--fg-muted);
}

.notification-empty svg {
  width: 32px;
  height: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.notification-empty p {
  margin: 0;
  font-size: 13px;
}

/* Individual notification item */
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
}

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

.notification-item:hover {
  background: var(--accent-soft);
}

.notification-item--unread {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.notification-item--unread:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

/* Icon */
.notification-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

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

/* Content */
.notification-item-content {
  flex: 1;
  min-width: 0;
}

.notification-item-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--fg);
  word-wrap: break-word;
}

.notification-item--unread .notification-item-message {
  font-weight: 500;
}

.notification-item-time {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--fg-muted);
}

/* Unread dot */
.notification-item-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
}

/* ===== Reduced Motion ===== */

@media (prefers-reduced-motion: reduce) {
  .notification-badge {
    animation: none;
  }
}

/* ===== Mobile Responsive ===== */

@media (max-width: 768px) {
  .notification-dropdown {
    width: auto;
    max-width: calc(100vw - 32px);
    max-height: 60vh;
    border-radius: 12px;
  }
}


/* ================================================================
   PB MODAL SYSTEM
   ================================================================ */

/* ========== Modal Overlay ========== */
.pb-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

/* ========== Main Modal ========== */
.pb-modal {
  background: var(--bg-card, #fff);
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 10001;
}

/* ========== Modal Header ========== */
.pb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle, #e7e5e4);
}

.pb-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--fg, #1c1917);
}

.pb-close-btn {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  color: var(--fg-muted, #78716c);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.pb-close-btn:hover {
  background: var(--accent-soft);
  color: var(--fg);
}

/* ========== Modal Body ========== */
.pb-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ========== Existing Links Section ========== */
.pb-existing-links-section {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--success-bg, #D6ECD8);
  border: 2px solid var(--success, #00CC66);
  border-radius: 8px;
}

.pb-existing-links-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--success, #00CC66);
}

.pb-existing-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--success, #00CC66);
  border-radius: 6px;
  margin-bottom: 8px;
}

.pb-existing-link-item:last-child {
  margin-bottom: 0;
}

/* ========== Product Filter Section ========== */
.pb-product-section {
  margin-bottom: 20px;
}

.pb-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg, #1c1917);
  margin-bottom: 8px;
}

.pb-product-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle, #e7e5e4);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card, #fff);
  color: var(--fg, #1c1917);
  cursor: pointer;
}

.pb-product-select:focus {
  outline: none;
  border-color: var(--accent, #FA582D);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

/* ========== Search Section ========== */
.pb-search-section {
  margin-bottom: 20px;
}

.pb-search-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle, #e7e5e4);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card, #fff);
  color: var(--fg, #1c1917);
}

.pb-search-input:focus {
  outline: none;
  border-color: var(--accent, #FA582D);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

/* ========== Search Results ========== */
.pb-search-results {
  margin-bottom: 24px;
  max-height: 300px;
  overflow-y: auto;
}

.pb-search-hint,
.pb-no-results,
.pb-loading,
.pb-error {
  padding: 16px;
  text-align: center;
  color: var(--fg-muted, #78716c);
  font-size: 14px;
}

.pb-error {
  color: var(--danger, #C94727);
  background: var(--danger-soft, #F6E4DF);
  border-radius: 8px;
}

.pb-success {
  padding: 16px;
  text-align: center;
  color: var(--success, #00CC66);
  background: var(--success-bg, #D6ECD8);
  border-radius: 8px;
  font-weight: 500;
}

/* ========== Search Result Items ========== */
.pb-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border-subtle, #e7e5e4);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: background 0.2s, border-color 0.2s;
}

.pb-result-item:hover {
  background: var(--bg-elevated, #faf8f6);
  border-color: var(--accent-soft, #FECDC0);
}

.pb-result-info {
  flex: 1;
  min-width: 0;
}

.pb-result-title {
  font-weight: 500;
  color: var(--fg, #1c1917);
  margin-bottom: 6px;
}

.pb-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

/* ========== Badges ========== */
.pb-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  text-transform: capitalize;
}

/* Status badges */
.pb-status-released,
.pb-status-shipped,
.pb-status-done {
  background: var(--success-soft);
  color: color-mix(in srgb, var(--success) 70%, black);
}

.pb-status-in-development,
.pb-status-in-progress {
  background: var(--info-soft);
  color: color-mix(in srgb, var(--info) 70%, black);
}

.pb-status-planned {
  background: var(--warning-soft);
  color: color-mix(in srgb, var(--warning) 60%, black);
}

.pb-status-new-idea,
.pb-status-under-consideration {
  background: var(--bg-elevated);
  color: var(--fg-muted);
}

.pb-status-archived {
  background: var(--bg);
  color: var(--fg-muted);
}

/* Impact badges */
.pb-impact-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.pb-impact-blocker {
  background: var(--danger-soft);
  color: var(--danger);
}

.pb-impact-high {
  background: var(--accent-soft);
  color: var(--accent-text);
}

.pb-impact-medium {
  background: var(--info-soft);
  color: color-mix(in srgb, var(--info) 70%, black);
}

.pb-impact-low {
  background: var(--bg-elevated);
  color: var(--fg-muted);
}

/* Product & type tags */
.pb-product-tag,
.pb-type-tag,
.pb-date-tag {
  color: var(--fg-muted, #78716c);
  background: var(--bg-elevated, #faf8f6);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}

/* ========== Buttons ========== */
.pb-btn {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.pb-btn-primary {
  background: var(--accent, #FA582D);
  color: white;
}

.pb-btn-primary:hover:not(:disabled) {
  background: var(--accent-hover, #E14F28);
}

.pb-btn-secondary {
  background: transparent;
  color: var(--fg, #1c1917);
  border: 1px solid var(--border-subtle, #e7e5e4);
}

.pb-btn-secondary:hover {
  background: var(--bg-elevated, #faf8f6);
}

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

.pb-btn-link {
  padding: 6px 12px;
  background: var(--accent, #FA582D);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.pb-btn-link:hover {
  background: var(--accent-hover, #E14F28);
}

.pb-btn-link.pb-btn-linked {
  background: var(--success, #00CC66);
}

.pb-btn-link.pb-btn-linked:hover {
  background: var(--success-hover, #00B359);
}

.pb-btn-link:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pb-btn-remove {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.pb-btn-remove:hover {
  background: var(--danger-soft, #F6E4DF);
}

/* ========== Recent Features Section ========== */
.pb-recent-section,
.pb-hot-ers-section {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-elevated, #faf8f6);
  border-radius: 8px;
}

.pb-recent-section h3,
.pb-hot-ers-section h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg, #1c1917);
}

.pb-recent-item {
  padding: 10px 12px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle, #e7e5e4);
  border-radius: 6px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.pb-feature-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-subtle, #e7e5e4);
  border-radius: 6px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.pb-recent-item:hover,
.pb-feature-item:hover {
  background: var(--accent-soft, #FECDC0);
  border-color: var(--accent, #FA582D);
}

.pb-feature-info {
  flex: 1;
  min-width: 0;
}

.pb-feature-title {
  font-weight: 600;
  color: var(--fg, #1c1917);
  margin-bottom: 8px;
  font-size: 14px;
}

.pb-feature-description {
  font-size: 13px;
  color: var(--fg-muted, #78716c);
  margin-bottom: 8px;
  line-height: 1.5;
}

.pb-expand-btn {
  background: none;
  border: none;
  color: var(--accent, #FA582D);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  margin-left: 4px;
  text-decoration: underline;
}

.pb-expand-btn:hover {
  color: var(--accent-hover, #E14F28);
}

.pb-feature-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.pb-link-count {
  color: var(--fg-muted, #78716c);
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-elevated, #faf8f6);
  border-radius: 4px;
}

.pb-recent-title {
  font-weight: 500;
  color: var(--fg, #1c1917);
  margin-bottom: 6px;
}

.pb-recent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

/* ========== Linked Features Section ========== */
.pb-linked-section {
  margin-bottom: 24px;
}

/* ========== Create ER Section ========== */
.pb-create-er-hint {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-elevated, #faf8f6);
  border-radius: 6px;
  text-align: center;
  color: var(--fg-muted, #78716c);
  font-style: italic;
}

.pb-create-er-section {
  margin-top: 12px;
  padding-bottom: 8px;
  text-align: center;
}

.pb-btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.pb-linked-section h3 {
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg, #1c1917);
}

.pb-links-list {
  max-height: 300px;
  overflow-y: auto;
}

.pb-no-links {
  padding: 16px;
  text-align: center;
  color: var(--fg-muted, #78716c);
  font-size: 14px;
  font-style: italic;
}

.pb-link-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--border-subtle, #e7e5e4);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--bg-card, #fff);
}

.pb-link-info {
  flex: 1;
  min-width: 0;
}

.pb-link-title {
  font-weight: 500;
  color: var(--fg, #1c1917);
  margin-bottom: 6px;
}

.pb-link-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 4px;
}

.pb-insight-badge {
  font-size: 11px;
  color: var(--success, #00CC66);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ========== Modal Footer ========== */
.pb-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle, #e7e5e4);
}

/* ========== Insight Form Overlay ========== */
.pb-insight-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.pb-insight-form {
  background: var(--bg-card, #fff);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.pb-insight-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle, #e7e5e4);
}

.pb-insight-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--fg, #1c1917);
}

.pb-insight-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.pb-insight-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle, #e7e5e4);
}

/* ========== Form Fields ========== */
.pb-form-field {
  margin-bottom: 20px;
}

.pb-form-field:last-child {
  margin-bottom: 0;
}

.pb-importance-select,
.pb-customer-impact {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle, #e7e5e4);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card, #fff);
  color: var(--fg, #1c1917);
  cursor: pointer;
}

.pb-insight-text,
.pb-se-notes {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-subtle, #e7e5e4);
  border-radius: 8px;
  font-size: 14px;
  font-family: monospace;
  background: var(--bg-card, #fff);
  color: var(--fg, #1c1917);
  resize: vertical;
  line-height: 1.5;
}

.pb-insight-text:focus,
.pb-se-notes:focus,
.pb-needed-by-date:focus,
.pb-importance-select:focus,
.pb-customer-impact:focus {
  outline: none;
  border-color: var(--accent, #FA582D);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.pb-needed-by-date {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle, #e7e5e4);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-card, #fff);
  color: var(--fg, #1c1917);
}

.pb-field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--fg-muted, #78716c);
  line-height: 1.4;
}

.pb-field-hint strong {
  color: var(--danger, #C94727);
  font-weight: 600;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .pb-modal {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .pb-insight-form {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .pb-result-item,
  .pb-link-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .pb-btn-link,
  .pb-btn-remove {
    align-self: flex-end;
  }
}

/* ========== Dark Mode Support ========== */
@media (prefers-color-scheme: dark) {
  .pb-modal,
  .pb-insight-form,
  .pb-result-item,
  .pb-recent-item,
  .pb-link-item {
    --bg-card: #1c1917;
    --bg-elevated: #292524;
    --fg: #e7e5e4;
    --fg-muted: #a8a29e;
    --border-subtle: #44403c;
  }
}


/* ================================================================
   PRODUCTBOARD STYLES (MODAL CONTENT)
   ================================================================ */

/* productboard/styles.css */
/* ProductBoard Modal Styles - Enhanced with link indicators */

/* Feature items that are linked */
.pb-feature-item-linked {
  background-color: var(--success-soft) !important;
  border-left: 4px solid var(--success) !important;
}

.pb-feature-item-linked .pb-feature-title {
  color: var(--success) !important;
  font-weight: 500 !important;
}

/* Linked button state */
.pb-btn-linked {
  background-color: var(--success) !important;
  color: white !important;
  cursor: default !important;
}

.pb-btn-linked:hover {
  background-color: color-mix(in srgb, var(--success) 85%, black) !important;
}

/* Use case badge */
.pb-use-case-badge {
  display: inline-block;
  padding: 2px 8px;
  background-color: var(--accent);
  color: white;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-left: 8px;
}

/* Base feature item styles (if not already defined) */
.pb-feature-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background-color: var(--bg-elevated);
  transition: all 0.2s ease;
}

.pb-feature-item:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pb-feature-info {
  flex: 1;
  margin-right: 12px;
}

.pb-feature-title {
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--fg);
}

.pb-feature-description {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.pb-feature-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pb-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.pb-product-tag {
  display: inline-block;
  padding: 2px 8px;
  background-color: var(--bg-elevated);
  color: var(--fg-muted);
  border-radius: 4px;
  font-size: 12px;
}

/* Status badge colors */
.pb-status-released,
.pb-status-shipped,
.pb-status-done {
  background-color: var(--success);
  color: white;
}

.pb-status-in-development,
.pb-status-in-progress {
  background-color: var(--info);
  color: white;
}

.pb-status-planned {
  background-color: var(--warning);
  color: #1c1917;
}

.pb-status-under-consideration {
  background-color: var(--fg-muted);
  color: white;
}

.pb-status-archived {
  background-color: #78716c;
  color: white;
}

/* Link button */
.pb-btn-link {
  padding: 6px 16px;
  background-color: var(--accent);
  color: white;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.pb-btn-link:hover {
  background-color: var(--accent-hover);
}

.pb-btn-link:disabled {
  background-color: var(--fg-muted);
  cursor: not-allowed;
}

/* Existing links section */
.pb-existing-links-section {
  margin-bottom: 24px;
  padding: 16px;
  background-color: var(--bg);
  border-radius: 4px;
}

.pb-existing-link-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  background-color: var(--bg-card);
}

.pb-link-info {
  flex: 1;
  margin-right: 12px;
}

.pb-link-title {
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--fg);
}

.pb-link-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.pb-btn-unlink {
  padding: 6px 16px;
  background-color: var(--danger);
  color: white;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

.pb-btn-unlink:hover {
  background-color: color-mix(in srgb, var(--danger) 85%, black);
}

/* Modal base styles (if not already defined) */
.pb-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.pb-modal {
  background-color: var(--bg-card);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

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

.pb-modal-header h2 {
  margin: 0;
  font-size: 24px;
  color: var(--fg);
}

.pb-close-btn {
  background: none;
  border: none;
  font-size: 32px;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.2s, color 0.2s;
}

.pb-close-btn:hover {
  color: var(--fg);
  background: var(--accent-soft);
}

.pb-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.pb-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.pb-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.pb-btn-primary {
  background-color: var(--accent);
  color: white;
}

.pb-btn-primary:hover {
  background-color: var(--accent-hover);
}

.pb-btn-secondary {
  background-color: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--border-subtle);
}

.pb-btn-secondary:hover {
  background-color: var(--bg-elevated);
}

/* Create ER Modal Form Styles */
.pb-create-er-modal {
  max-width: 550px;
}

.pb-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

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

.pb-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
}

.pb-form-row {
  display: flex;
  gap: 16px;
}

.pb-form-row .pb-form-group {
  flex: 1;
}

.pb-input,
.pb-textarea,
.pb-select {
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--fg);
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.pb-input:focus,
.pb-textarea:focus,
.pb-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.pb-input::placeholder,
.pb-textarea::placeholder {
  color: var(--fg-muted);
}

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

.pb-select {
  cursor: pointer;
}

/* Sections */
.pb-product-section,
.pb-search-section {
  margin-bottom: 20px;
}

.pb-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--fg);
}

.pb-product-select,
.pb-search-input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 14px;
  background: var(--bg-elevated);
  color: var(--fg);
}

.pb-product-select:focus,
.pb-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.pb-search-results {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 24px;
}

.pb-search-hint,
.pb-no-results,
.pb-loading,
.pb-error {
  padding: 20px;
  text-align: center;
  color: var(--fg-muted);
}

.pb-error {
  color: var(--danger);
}

.pb-hot-ers-section,
.pb-recent-section {
  margin-bottom: 24px;
}

.pb-hot-ers-section h3,
.pb-recent-section h3,
.pb-existing-links-section h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 18px;
  color: var(--fg);
}

.pb-expand-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  margin-left: 4px;
}

.pb-expand-btn:hover {
  text-decoration: underline;
}

.pb-create-er-hint {
  margin-bottom: 12px;
  padding: 12px;
  background-color: var(--warning-soft);
  border-radius: 4px;
  color: var(--warning);
}

.pb-create-er-section {
  text-align: center;
}

.pb-btn-sm {
  padding: 6px 16px;
  font-size: 13px;
}

/* Error & Success Notifications */
.pb-error-notification,
.pb-success-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  max-width: 400px;
  background: var(--bg-card);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  z-index: 10001;
  transform: translateX(450px);
  transition: transform 0.3s ease;
}

.pb-error-notification.show,
.pb-success-notification.show {
  transform: translateX(0);
}

.pb-error-notification {
  border-left: 4px solid var(--danger, #C94727);
}

.pb-success-notification {
  border-left: 4px solid var(--success, #00CC66);
}

.pb-error-icon,
.pb-success-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.pb-error-icon {
  color: var(--danger, #C94727);
}

.pb-success-icon {
  color: var(--success, #00CC66);
  font-weight: bold;
}

.pb-error-message,
.pb-success-message {
  flex: 1;
  font-size: 14px;
  color: var(--fg, #1c1917);
  line-height: 1.5;
}

.pb-error-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--fg-muted, #78716c);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.pb-error-close:hover {
  background: var(--bg-elevated, #faf8f6);
}


/* ================================================================
   CREATE INSIGHT MODAL
   ================================================================ */

/* ================================================================
   CREATE INSIGHT MODAL STYLES
   ================================================================ */

.insight-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.insight-modal-content {
  background: var(--bg-card);
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.insight-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--accent);
  color: white;
}

.insight-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.insight-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: white;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.8;
}

.insight-modal-close:hover {
  opacity: 1;
}

.insight-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.insight-form-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.insight-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.insight-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.insight-value {
  font-size: 14px;
  color: var(--fg);
  padding: 8px 0;
}

.insight-feature-title {
  font-weight: 600;
  color: var(--accent);
}

.insight-input,
.insight-textarea,
.insight-select {
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.insight-input:focus,
.insight-textarea:focus,
.insight-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

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

.insight-select {
  cursor: pointer;
  background: var(--bg-card);
}

/* Preview Section */
.insight-preview-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-subtle);
}

.insight-preview-section h4 {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.insight-preview-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px;
}

.insight-preview-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.insight-preview-company {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 12px;
}

.insight-preview-content {
  font-size: 14px;
  color: var(--fg);
  white-space: pre-wrap;
  line-height: 1.5;
}

/* Footer */
.insight-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.insight-btn {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.insight-btn-cancel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--fg-muted);
}

.insight-btn-cancel:hover {
  background: var(--bg-elevated);
  border-color: var(--fg-muted);
}

.insight-btn-create {
  background: var(--accent);
  border: none;
  color: white;
}

.insight-btn-create:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent);
}

.insight-btn-create:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.insight-btn-icon {
  font-size: 16px;
}

/* Dark Mode */
:root[data-theme="dark"] .insight-modal-content {
  background: var(--bg-card);
}

:root[data-theme="dark"] .insight-modal-header {
  border-color: var(--border-subtle);
}

:root[data-theme="dark"] .insight-input,
:root[data-theme="dark"] .insight-textarea,
:root[data-theme="dark"] .insight-select {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
  color: var(--fg);
}

:root[data-theme="dark"] .insight-preview-box {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
}

:root[data-theme="dark"] .insight-modal-footer {
  background: var(--bg-elevated);
  border-color: var(--border-subtle);
}
