/* =========================================================
   COMPONENTS.CSS — Cards, Buttons, Badges, Tables, Tabs, etc.
   PAN Portfolio v11
   ========================================================= */

/* ===================
   BUTTONS
   =================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-base) var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
}

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

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Primary */
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md), 0 0 20px rgba(46,123,214,0.2);
}
.btn-primary:hover {
  box-shadow: var(--shadow-lg), 0 0 30px rgba(46,123,214,0.35);
  transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
  background: var(--glass-bg);
  color: var(--text-primary);
  border-color: var(--border);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background: var(--glass-bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* Accent / Gold */
.btn-accent {
  background: var(--gradient-accent);
  color: #0A1628;
  font-weight: 700;
}
.btn-accent:hover {
  box-shadow: var(--shadow-lg), 0 0 25px rgba(212,168,67,0.3);
  transform: translateY(-1px);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--glass-bg);
}

/* Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
}
.btn-lg {
  padding: var(--space-4) var(--space-7);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* ===================
   CARDS
   =================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  background: var(--glass-bg);
  border: 1px solid var(--border);
  color: var(--primary-light);
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

.card-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary-light);
  margin-bottom: var(--space-2);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  line-height: 1.2;
}

.card-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

/* Glass Card */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.glass-card:hover {
  background: var(--glass-bg-hover);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

/* Pillar Card — larger, with icon and link */
.pillar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pillar-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity var(--duration-base) var(--ease-out);
}

.pillar-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-4px);
}

.pillar-card:hover::before {
  opacity: 1;
}

.pillar-card .card-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
}

.pillar-card .card-icon svg {
  width: 28px;
  height: 28px;
}

.pillar-card .card-link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary-light);
  margin-top: auto;
  padding-top: var(--space-4);
  transition: gap var(--duration-base) var(--ease-out);
}

.pillar-card:hover .card-link-arrow {
  gap: var(--space-3);
}

.pillar-card .card-link-arrow svg {
  width: 16px;
  height: 16px;
  transition: transform var(--duration-base) var(--ease-out);
}

.pillar-card:hover .card-link-arrow svg {
  transform: translateX(4px);
}

/* Stat Card */
.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: center;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: var(--space-1);
}

.stat-card .stat-value.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-card .stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 500;
}

/* ===================
   BADGES
   =================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}

.badge-new {
  background: rgba(46, 123, 214, 0.15);
  color: var(--primary-light);
  border: 1px solid rgba(46, 123, 214, 0.3);
}

.badge-strong {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-moderate {
  background: rgba(251, 191, 36, 0.12);
  color: var(--warning);
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-gap {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-none {
  background: rgba(100, 116, 139, 0.12);
  color: var(--text-muted);
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.badge-accent {
  background: rgba(212, 168, 67, 0.12);
  color: var(--accent);
  border: 1px solid rgba(212, 168, 67, 0.3);
}

.badge-sm {
  padding: 2px 8px;
  font-size: 0.65rem;
}

/* Dot indicator for badges */
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-no-dot::before {
  display: none;
}

/* ===================
   TABLES
   =================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

.table-wrapper table {
  min-width: 600px;
}

.table-wrapper th {
  background: var(--surface-elevated);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table-wrapper td {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table-wrapper tr:last-child td {
  border-bottom: none;
}

.table-wrapper tr:hover td {
  background: var(--glass-bg);
}

/* ===================
   ACCORDIONS
   =================== */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--border);
}

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

.accordion-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--duration-fast) ease;
}

.accordion-trigger:hover {
  background: var(--glass-bg);
}

.accordion-trigger svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform var(--duration-base) var(--ease-out);
  flex-shrink: 0;
}

.accordion-item.active .accordion-trigger svg {
  transform: rotate(180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out);
}

.accordion-item.active .accordion-content {
  max-height: 2000px;
}

.accordion-body {
  padding: 0 var(--space-5) var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ===================
   TABS
   =================== */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-base) ease;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary-light);
  font-weight: 600;
}

.tab-panel {
  display: none;
  padding-top: var(--space-5);
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================
   TAG FILTERS
   =================== */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.tag-filter {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.tag-filter:hover {
  background: var(--glass-bg-hover);
  color: var(--text-primary);
}

.tag-filter.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-light);
}

/* ===================
   CODE BLOCKS
   =================== */
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-secondary);
}

.code-block code {
  color: inherit;
}

.inline-code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ===================
   ALERT / CALLOUT
   =================== */
.callout {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--glass-bg);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.callout-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
}

.callout-info {
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.06);
}
.callout-info .callout-icon { color: var(--info); }

.callout-success {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.06);
}
.callout-success .callout-icon { color: var(--success); }

.callout-warning {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.06);
}
.callout-warning .callout-icon { color: var(--warning); }

.callout-error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.06);
}
.callout-error .callout-icon { color: var(--error); }

/* ===================
   TOOLTIP
   =================== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-primary);
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all var(--duration-fast) ease;
  z-index: var(--z-toast);
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===================
   DIVIDER
   =================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-8) 0;
}

/* ===================
   TICKER / WHAT'S NEW
   =================== */
.ticker-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.ticker-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) ease;
}

.ticker-item:hover {
  background: var(--glass-bg-hover);
  border-color: var(--border-hover);
}

.ticker-date {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 70px;
  padding-top: 2px;
}

.ticker-content {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.ticker-content strong {
  color: var(--text-primary);
}

/* ===================
   ICON BOX (for pillar icons)
   =================== */
.icon-box {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.icon-box svg {
  width: 24px;
  height: 24px;
}

.icon-box--blue {
  background: rgba(46, 123, 214, 0.12);
  color: var(--primary-light);
}

.icon-box--gold {
  background: rgba(212, 168, 67, 0.12);
  color: var(--accent);
}

.icon-box--green {
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
}

.icon-box--red {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
}

.icon-box--purple {
  background: rgba(139, 92, 246, 0.12);
  color: #8B5CF6;
}

.icon-box--cyan {
  background: rgba(34, 211, 238, 0.12);
  color: #22D3EE;
}

.icon-box--orange {
  background: rgba(249, 115, 22, 0.12);
  color: #F97316;
}

/* ===================
   PRODUCT HELP TOOLTIPS
   =================== */
.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  background: rgba(11, 83, 148, 0.15);
  color: var(--primary-light, #2E7BD6);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: help;
  vertical-align: middle;
  flex-shrink: 0;
  transition: background var(--duration-fast, 150ms) ease, color var(--duration-fast, 150ms) ease;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}
.help-tip::after {
  content: '?';
}
.help-tip:hover,
.help-tip:focus {
  background: var(--primary, #0B5394);
  color: #fff;
}

/* Tooltip bubble */
.help-tip .help-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 280px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-elevated, #162236);
  border: 1px solid var(--glass-border, rgba(255,255,255,0.08));
  border-radius: var(--radius-md, 8px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-secondary, #94A3B8);
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
  z-index: 100;
}
/* Arrow */
.help-tip .help-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--surface-elevated, #162236);
}
/* Show on hover + focus + active (touch) */
.help-tip:hover .help-tooltip,
.help-tip:focus .help-tooltip,
.help-tip.active .help-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
/* Flip tooltip below if near top of viewport (handled by JS) */
.help-tip.tip-below .help-tooltip {
  bottom: auto;
  top: calc(100% + 8px);
}
.help-tip.tip-below .help-tooltip::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--surface-elevated, #162236);
}
/* Right-align if near left edge */
.help-tip.tip-right .help-tooltip {
  left: 0;
  transform: none;
}
.help-tip.tip-right .help-tooltip::after {
  left: 8px;
  transform: none;
}
