/*
 * WF polish layer — loaded AFTER wf-theme.css on every layout (front,
 * app/dashboard, admin, guest, landing, full). Purely additive visual
 * refinement: no layout, spacing, or display changes — only color, shadow,
 * border, typography, and micro-interaction upgrades. It styles both the
 * wf-* classes (redesign layer) and the compiled theme's own primitives
 * (.card, .btn, .form-input, table) so the dashboard and admin pick up the
 * same finish without markup edits.
 */

/* ==========================================================================
   1. Token refinements
   ========================================================================== */
:root {
  /* Layered shadow recipe (Josh Comeau style) shared by cards/popovers */
  --wfp-shadow-sm:
    0 1px 1px hsl(var(--wf-shadow-color) / 0.05),
    0 2px 4px -2px hsl(var(--wf-shadow-color) / 0.08);
  --wfp-shadow-md:
    0 1px 2px hsl(var(--wf-shadow-color) / 0.05),
    0 4px 8px -4px hsl(var(--wf-shadow-color) / 0.1),
    0 12px 24px -12px hsl(var(--wf-shadow-color) / 0.22);
  --wfp-shadow-lg:
    0 2px 4px hsl(var(--wf-shadow-color) / 0.06),
    0 10px 20px -8px hsl(var(--wf-shadow-color) / 0.14),
    0 28px 56px -24px hsl(var(--wf-shadow-color) / 0.3);
  --wfp-ring: 0 0 0 3px rgba(var(--wf-accent-rgb), 0.28);
}

html.dark {
  --wfp-shadow-sm:
    0 1px 1px rgba(0, 0, 0, 0.25),
    0 2px 6px -2px rgba(0, 0, 0, 0.35);
  --wfp-shadow-md:
    0 1px 2px rgba(0, 0, 0, 0.3),
    0 6px 14px -6px rgba(0, 0, 0, 0.45),
    0 16px 32px -16px rgba(0, 0, 0, 0.55);
  --wfp-shadow-lg:
    0 2px 4px rgba(0, 0, 0, 0.35),
    0 12px 24px -10px rgba(0, 0, 0, 0.55),
    0 32px 64px -28px rgba(0, 0, 0, 0.65);
}

/* ==========================================================================
   2. Global rendering / typography
   ========================================================================== */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Nudge the whole site's rem-based type up slightly (~16px -> ~17px) */
  font-size: 106%;
}

/* Sidebar menu labels a touch larger than the rest of the nav chrome */
.wf-nav-item {
  font-size: 0.875rem;
}

h1, h2, h3, .wf-stat__value, .fzh-stat__value {
  letter-spacing: -0.02em;
}

b, strong {
  font-weight: 700;
}

/* Numbers line up everywhere they represent money/stats */
td, .wf-stat__value, .fzh-stat__value, .wf-mini-stat__value {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   3. Accessible focus ring (mouse clicks stay clean, keyboard gets a ring)
   ========================================================================== */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid transparent;
  box-shadow: var(--wfp-ring);
  border-radius: 6px;
  transition: box-shadow 0.15s ease;
}

/* ==========================================================================
   4. Theme-aware slim scrollbars
   ========================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--wf-accent-rgb), 0.35) transparent;
}
*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: rgba(var(--wf-accent-rgb), 0.3);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--wf-accent-rgb), 0.55);
  border: 2px solid transparent;
  background-clip: content-box;
}

/* ==========================================================================
   5. Cards — wf-card (front) and .card (dashboard/admin compiled theme)
   ========================================================================== */
.wf-card,
.card {
  box-shadow: var(--wfp-shadow-sm);
}
.wf-card--hover:hover {
  box-shadow: var(--wfp-shadow-lg), 0 0 0 1px rgba(var(--wf-accent-rgb), 0.25);
}

/* Dashboard cards: soften the flat look with a hairline + hover lift */
.card {
  border: 1px solid var(--wf-border-subtle);
  transition: box-shadow 0.3s var(--wf-ease), border-color 0.3s var(--wf-ease);
}
.card:hover {
  box-shadow: var(--wfp-shadow-md);
}
html.dark .card {
  border-color: rgba(255, 255, 255, 0.06);
}

/* ==========================================================================
   6. Buttons — sheen sweep on gradient buttons, crisper secondary
   ========================================================================== */
.wf-btn--primary,
.fzh-cta .wf-btn--light {
  overflow: hidden;
}
.wf-btn--primary::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70%;
  width: 45%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s var(--wf-ease);
  pointer-events: none;
}
.wf-btn--primary:hover::after {
  left: 130%;
}

.wf-btn--secondary {
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Compiled-theme buttons (dashboard/admin) get the same press feel */
.btn {
  transition: transform 0.15s var(--wf-ease), box-shadow 0.25s var(--wf-ease), filter 0.25s var(--wf-ease);
}
.btn:active {
  transform: scale(0.97);
}

/* ==========================================================================
   7. Forms — wf-input (front) and .form-input/.form-select (dashboard)
   ========================================================================== */
.form-input,
.form-select,
.form-textarea {
  transition: border-color 0.2s var(--wf-ease), box-shadow 0.2s var(--wf-ease);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--wf-accent) !important;
  box-shadow: 0 0 0 3px rgba(var(--wf-accent-rgb), 0.16);
}
.wf-input:focus {
  box-shadow: 0 0 0 3px rgba(var(--wf-accent-rgb), 0.16);
}

/* ==========================================================================
   8. Tables — softer headers, calmer row hover on both table systems
   ========================================================================== */
.wf-table thead th {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.wf-table tbody td {
  font-size: 0.88rem;
}

/* Dashboard "is-hoverable" tables */
.is-hoverable tbody tr {
  transition: background-color 0.18s var(--wf-ease);
}
.is-hoverable tbody tr:hover {
  background: rgba(var(--wf-accent-rgb), 0.05) !important;
}

/* ==========================================================================
   9. Chrome — topbar, sidebar, header get a finer glass finish
   ========================================================================== */
.wf-topbar {
  border-bottom-color: rgba(var(--wf-accent-rgb), 0.1);
}
.wf-topbar--scrolled,
.wf-header--scrolled {
  box-shadow: var(--wfp-shadow-md);
}

/* Dashboard blur header: hairline under it so content scrolls "under" cleanly */
.is-header-blur nav.header {
  border-bottom: 1px solid var(--wf-border-subtle);
}
html.dark .is-header-blur nav.header {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.wf-sidebar-rail,
.main-sidebar {
  box-shadow: 1px 0 0 var(--wf-border-subtle);
}
html.dark .wf-sidebar-rail,
html.dark .main-sidebar {
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   10. Badges, alerts, modals, misc micro-polish
   ========================================================================== */
.wf-badge {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.wf-alert {
  box-shadow: var(--wfp-shadow-sm);
}

.wf-modal,
.modal-content {
  box-shadow: var(--wfp-shadow-lg);
}

.wf-modal-overlay {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Back-to-top button (front layout) matches the brand */
#back-to-top {
  background: var(--wf-gradient-brand) !important;
  box-shadow: 0 10px 22px -10px rgba(var(--wf-accent-rgb), 0.65);
  transition: transform 0.2s var(--wf-ease), box-shadow 0.2s var(--wf-ease);
}
#back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -10px rgba(var(--wf-accent-rgb), 0.8);
}

/* Skeleton shimmer follows the accent, both systems */
.skeleton.animate-wave {
  position: relative;
  overflow: hidden;
}

/* Images never overflow their card */
.wf-card img,
.card img {
  max-width: 100%;
}

/* Smooth theme switch: fade colors instead of hard-swapping */
body,
.wf-card,
.card,
.wf-table thead th,
.wf-input,
.form-input,
.form-select {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0.25s;
  transition-timing-function: var(--wf-ease);
}

/* ==========================================================================
   12. Featured Surveys carousel (horizontal scroll-snap row)
   ========================================================================== */
.wf-survey-row {
  display: flex;
  gap: 0.85rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  padding: 0.15rem 0.15rem 0.75rem;
}
.wf-survey-card {
  position: relative;
  overflow: hidden;
  scroll-snap-align: start;
  flex-shrink: 0;
  width: 10rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.6rem;
  padding: 1.1rem 1rem 0.9rem;
}
.wf-survey-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--wf-gradient-brand);
  opacity: 0;
  transition: opacity 0.25s var(--wf-ease);
}
.wf-survey-card:hover::before {
  opacity: 1;
}
.wf-survey-card:hover {
  transform: translateY(-4px) scale(1.02);
}
.wf-survey-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--wf-gradient-brand-soft);
  box-shadow: 0 6px 16px -8px rgba(var(--wf-accent-rgb), 0.5);
  overflow: hidden;
}
.wf-survey-icon img {
  width: 1.6rem;
  height: 1.6rem;
  object-fit: contain;
  border-radius: 999px;
}
.wf-survey-reward {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--wf-warning);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.wf-survey-reward img {
  width: 1.05rem;
  height: 1.05rem;
}
.wf-survey-time {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  color: var(--wf-text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  background: var(--wf-bg-surface-raised);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}
.wf-survey-time i {
  font-size: 0.65rem;
  color: var(--wf-accent);
}

/* ==========================================================================
   11. Reduced motion — kill the new animations too
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .wf-btn--primary::after {
    display: none;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
