/* ============================================
   CORPERHQ SHARED COMPONENTS
   Modals, toasts, tabs, stars, search, filters
   ============================================ */

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none;
  transition: opacity var(--t-base);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: white; border-radius: var(--r-2xl);
  padding: 36px; max-width: 520px; width: 100%;
  transform: translateY(16px); transition: transform var(--t-base);
  position: relative; max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal-box { transform: translateY(0); }
.modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); border: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); cursor: pointer; transition: all var(--t-fast);
}
.modal-close:hover { background: var(--surface-2); color: var(--ink); }
.modal-title { font-size: 22px; margin-bottom: 6px; }
.modal-subtitle { font-size: 14px; color: var(--ink-soft); margin-bottom: 28px; }

/* ---- TOAST ---- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: var(--r-lg);
  font-size: 14px; font-weight: 500;
  transform: translateY(80px); opacity: 0;
  transition: all var(--t-base); box-shadow: var(--shadow-lg);
  max-width: 320px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: var(--ink); color: white; }
.toast-success svg { color: var(--dark-green); }
.toast-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.toast-error svg { color: #E53E3E; }

/* ---- TOOLTIP ---- */
.tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); pointer-events: none;
  background: var(--ink); color: white;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  padding: 5px 10px; border-radius: var(--r-sm);
  opacity: 0; transition: opacity var(--t-fast);
}
.tooltip::after {
  content: ''; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%); border: 5px solid transparent;
  border-top-color: var(--ink);
}
[data-tooltip]:hover .tooltip { opacity: 1; }

/* ---- TAB SYSTEM ---- */
.tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: var(--r-lg); }
.tab-btn {
  flex: 1; padding: 8px 16px; border: none; border-radius: var(--r-md);
  background: transparent; font-family: var(--font-display); font-weight: 600;
  font-size: 13px; color: var(--ink-soft); cursor: pointer; transition: all var(--t-fast);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { background: white; color: var(--ink); box-shadow: var(--shadow-sm); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- STAR RATING ---- */
.stars { display: flex; gap: 3px; }
.star { color: #F59E0B; font-size: 14px; }
.star-empty { color: var(--surface-2); }
.star-input {
  color: #D1D5DB; font-size: 22px; cursor: pointer;
  transition: color var(--t-fast);
}
.star-input.hover, .star-input.selected { color: #F59E0B; }

/* ---- SEARCH BAR ---- */
.search-bar {
  display: flex; align-items: center; gap: 0;
  background: white; border: 1.5px solid var(--border-mid);
  border-radius: var(--r-lg); overflow: hidden;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-bar:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(13,122,85,0.1);
}
.search-bar-icon {
  padding: 0 14px; color: var(--ink-faint);
  display: flex; align-items: center; flex-shrink: 0;
}
.search-bar input {
  flex: 1; padding: 12px 0; border: none; outline: none;
  font-family: var(--font-body); font-size: 14px; color: var(--ink);
  background: transparent; min-width: 0;
}
.search-bar input::placeholder { color: var(--ink-faint); }
.search-bar-btn {
  padding: 8px 18px; margin: 6px; border-radius: var(--r-md);
  background: var(--green); color: white; border: none;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  cursor: pointer; transition: background var(--t-base); white-space: nowrap;
}
.search-bar-btn:hover { background: var(--green-dark); }

/* ---- FILTER CHIPS ---- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-chip {
  padding: 6px 14px; border-radius: var(--r-full);
  border: 1.5px solid var(--border-mid); background: white;
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
}
.filter-chip:hover { border-color: var(--green); color: var(--green); background: var(--green-xlight); }
.filter-chip.active { border-color: var(--green); color: var(--green); background: var(--green-light); font-weight: 600; }
.filter-label { font-size: 13px; font-weight: 600; color: var(--ink-mid); white-space: nowrap; }

/* ---- PAGINATION ---- */
.pagination { display: flex; align-items: center; gap: 6px; }
.page-btn {
  width: 36px; height: 36px; border-radius: var(--r-md);
  border: 1px solid var(--border-mid); background: white;
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all var(--t-fast);
}
.page-btn:hover { border-color: var(--green); color: var(--green); }
.page-btn.active { background: var(--green); color: white; border-color: var(--green); }
.page-btn:disabled { opacity: 0.4; cursor: default; pointer-events: none; }

/* ---- STAT CARD ---- */
.stat-card {
  background: var(--surface); border-radius: var(--r-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 4px;
}
.stat-card-dark {
  background: var(--dark-surface); border: 1px solid var(--dark-border);
  border-radius: var(--r-lg); padding: 20px;
}
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--ink-faint); }
.stat-label-dark { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--dark-muted); }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: var(--ink); letter-spacing: -1px; }
.stat-value-dark { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: white; letter-spacing: -1px; }
.stat-change { font-size: 13px; font-weight: 500; }
.stat-change-up   { color: var(--green); }
.stat-change-down { color: #E53E3E; }

/* ---- AVATAR ---- */
.avatar {
  border-radius: 50%; background: var(--green);
  color: white; font-family: var(--font-display);
  font-weight: 700; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm  { width: 32px; height: 32px; font-size: 12px; }
.avatar-md  { width: 40px; height: 40px; font-size: 14px; }
.avatar-lg  { width: 52px; height: 52px; font-size: 17px; }
.avatar-xl  { width: 72px; height: 72px; font-size: 22px; }
.avatar-gold   { background: var(--gold); }
.avatar-purple { background: #7C3AED; }
.avatar-blue   { background: #2563EB; }

/* ---- PROGRESS BAR ---- */
.progress-bar {
  height: 6px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden;
}
.progress-fill { height: 100%; background: var(--green); border-radius: var(--r-full); transition: width 0.8s ease; }

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px; padding: 60px 20px;
  text-align: center;
}
.empty-state-icon {
  width: 72px; height: 72px; border-radius: var(--r-xl);
  background: var(--green-light); display: flex; align-items: center;
  justify-content: center; color: var(--green);
}
.empty-state h4 { color: var(--ink-mid); }
.empty-state p  { font-size: 14px; max-width: 280px; }

/* ---- LOADING SPINNER ---- */
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-mid);
  border-top-color: var(--green);
  animation: spin 0.7s linear infinite;
}
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

/* ---- DIVIDER ---- */
.divider { border: none; border-top: 1px solid var(--border); margin: var(--space-lg) 0; }
.divider-dark { border-top-color: var(--dark-border); }

/* ---- BREADCRUMB ---- */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; row-gap: 6px; line-height: 1; }
.breadcrumb-item { font-size: 13px; color: var(--ink-faint); display: inline-flex; align-items: center; white-space: nowrap; }
.breadcrumb-item a { color: var(--ink-soft); transition: color var(--t-fast); display: inline-flex; align-items: center; }
.breadcrumb-item a:hover { color: var(--green); }
.breadcrumb-item.active { color: var(--ink-mid); font-weight: 500; }
.breadcrumb-sep { display: inline-flex; align-items: center; justify-content: center; color: var(--ink-faint); margin: 0 8px; flex-shrink: 0; }
.breadcrumb-sep svg { display: block; }

/* ---- TRUST BADGES ---- */
.trust-bar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 18px 5%;
}
.trust-inner { max-width: var(--max-w); margin: 0 auto; }
.trust-items { display: flex; align-items: center; justify-content: center; gap: 40px; flex-wrap: wrap; }
.trust-item { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
.trust-item-icon { width: 28px; height: 28px; border-radius: var(--r-md); background: var(--green-light); display: flex; align-items: center; justify-content: center; color: var(--green); }
