/* ==========================================================================
   Nova CRM - motion & polish layer (additive, presentation only)
   Loaded after app.css. Every animation is disabled by prefers-reduced-motion.
   ========================================================================== */
:root {
  --lx-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --lx-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Streaming re-renders must not replay entrance animations ------- */
body.no-enter-anim .page.active,
body.no-enter-anim .page.active * {
  animation-duration: 0.001s !important;
  animation-delay: 0s !important;
}

/* ---------- LOGIN: animated SVG scene -------------------------------------- */
#login-screen > .lx-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
#login-screen > .login-card { z-index: 1; }

.lx-orb { transform-box: fill-box; transform-origin: center; }
.lx-orb-a { animation: lxDriftA 18s ease-in-out infinite alternate; }
.lx-orb-b { animation: lxDriftB 22s ease-in-out infinite alternate; }
.lx-orb-c { animation: lxDriftC 26s ease-in-out infinite alternate; }
@keyframes lxDriftA { to { transform: translate(140px, 90px) scale(1.18); } }
@keyframes lxDriftB { to { transform: translate(-160px, -70px) scale(0.9); } }
@keyframes lxDriftC { to { transform: translate(90px, -120px) scale(1.12); } }

.lx-wave {
  fill: none;
  stroke: url(#lxWave);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 6 14;
  opacity: 0.55;
  animation: lxFlow 14s linear infinite;
}
.lx-wave:nth-of-type(2) { stroke-dasharray: 2 10; opacity: 0.4; animation-duration: 20s; animation-direction: reverse; }
.lx-wave:nth-of-type(3) { stroke-dasharray: 10 22; opacity: 0.3; animation-duration: 28s; }
@keyframes lxFlow { to { stroke-dashoffset: -400; } }

.lx-link {
  fill: none;
  stroke: rgba(222, 190, 112, 0.35);
  stroke-width: 1;
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: lxDraw 9s var(--lx-ease) infinite;
}
.lx-link:nth-of-type(2) { animation-delay: 2.2s; }
.lx-link:nth-of-type(3) { animation-delay: 4.4s; }
@keyframes lxDraw {
  0% { stroke-dashoffset: 260; opacity: 0; }
  25%, 70% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: -260; opacity: 0; }
}

.lx-star { fill: #e9cf8e; transform-box: fill-box; transform-origin: center; animation: lxTwinkle 4.5s ease-in-out infinite; }
.lx-star:nth-child(2n) { animation-duration: 6s; animation-delay: 1.2s; }
.lx-star:nth-child(3n) { animation-duration: 5.2s; animation-delay: 2.4s; }
.lx-star:nth-child(5n) { animation-delay: 3.3s; }
@keyframes lxTwinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.6) rotate(0deg); }
  50% { opacity: 0.95; transform: scale(1.15) rotate(45deg); }
}

/* Card entrance + focus feedback */
#login-screen .login-card { animation: lxCardIn 0.75s var(--lx-ease) both; }
@keyframes lxCardIn {
  from { opacity: 0; transform: translateY(26px) scale(0.97); filter: blur(6px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
#login-screen .login-hd > * { animation: lxFadeUp 0.6s var(--lx-ease) both; }
#login-screen .login-hd > :nth-child(2) { animation-delay: 0.12s; }
#login-screen .auth-form .fg2 { animation: lxFadeUp 0.55s var(--lx-ease) both; }
#login-screen .auth-form .fg2:nth-child(1) { animation-delay: 0.16s; }
#login-screen .auth-form .fg2:nth-child(2) { animation-delay: 0.24s; }
#login-screen .btn-login { animation: lxFadeUp 0.55s var(--lx-ease) 0.32s both; }
@keyframes lxFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-form .finp { transition: box-shadow 0.25s var(--lx-ease), border-color 0.2s ease, transform 0.25s var(--lx-ease); }
.auth-form .finp:focus {
  transform: translateY(-1px);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), 0 8px 18px -10px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* Startup/sign-in screen: breathing ring + gentle step pulse */
.startup-ring { animation: lxBreathe 2.6s ease-in-out infinite; }
@keyframes lxBreathe { 50% { transform: scale(1.06); filter: drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 55%, transparent)); } }
.startup-step.active i { animation: lxPulseDot 1.2s ease-in-out infinite; }
@keyframes lxPulseDot { 50% { transform: scale(1.35); opacity: 0.6; } }

/* ---------- NAVIGATION ------------------------------------------------------ */
.sidebar .nav { position: relative; }
.nav-glide {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 70%, transparent);
  opacity: 0;
  transition: transform 0.45s var(--lx-ease), height 0.3s var(--lx-ease), opacity 0.2s ease;
  pointer-events: none;
  z-index: 2;
}
.ni { transition: background-color 0.2s ease, color 0.2s ease, transform 0.25s var(--lx-ease), box-shadow 0.25s ease; }
.ni i { transition: transform 0.35s var(--lx-spring), color 0.2s ease; }
.ni:hover { transform: translateX(3px); }
.ni:hover i { transform: scale(1.18) rotate(-6deg); }
.ni:active { transform: translateX(1px) scale(0.98); }
.sidebar.collapsed .ni:hover, html.lk-nav-collapsed .ni:hover { transform: none; }
.ni.active i { animation: lxIconPop 0.5s var(--lx-spring); }
@keyframes lxIconPop { from { transform: scale(0.6); } to { transform: scale(1); } }

/* ---------- DASHBOARD & CARDS ----------------------------------------------- */
.stats-progress-bar-fill {
  transform-origin: left center;
  animation: lxFillGrow 1s var(--lx-ease) 0.2s backwards;
}
@keyframes lxFillGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.stats-icon-wrapper { animation: lxIconPop 0.65s var(--lx-spring) 0.12s backwards; transition: transform 0.35s var(--lx-spring); }
.sc:hover .stats-icon-wrapper { transform: scale(1.12) rotate(-5deg); }
.stats-trend i { animation: lxNudge 1.6s ease-in-out 0.8s 2; }
@keyframes lxNudge { 50% { transform: translateY(-3px); } }
.sc, .stats-card { transition: transform 0.3s var(--lx-ease), box-shadow 0.3s ease, border-color 0.2s ease; }
.sc:hover, .stats-card:hover { transform: translateY(-3px); }
.dashboard-task-stat, .task-alert { transition: transform 0.25s var(--lx-ease), box-shadow 0.25s ease; }
.dashboard-task-stat:hover { transform: translateY(-2px); }

/* Generic soft reveal for tables / sections inside the active page */
.page.active .task-section,
.page.active .card,
.page.active .tbl-wrap { animation: lxFadeUp 0.5s var(--lx-ease) 0.12s backwards; }

/* Button press ripple (JS adds .lx-ripple) */
.lx-ripple {
  position: absolute;
  border-radius: 50%;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  background: rgba(255, 255, 255, 0.45);
  transform: scale(0);
  animation: lxRipple 0.6s ease-out forwards;
  pointer-events: none;
}
.btn-g .lx-ripple { background: color-mix(in srgb, var(--accent) 30%, transparent); }
@keyframes lxRipple { to { transform: scale(34); opacity: 0; } }

/* Shimmer for any element given .lx-skeleton */
.lx-skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, color-mix(in srgb, var(--accent) 12%, var(--surface2)) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: lxShimmer 1.3s linear infinite;
  border-radius: 8px;
}
@keyframes lxShimmer { to { background-position: -200% 0; } }

/* ---------- ANIMATED CLOCKS & EMPTY-STATE ILLUSTRATIONS --------------------- */
.illo-hand { transform-box: view-box; transform-origin: 80px 60px; }
.illo-hand-sub { transform-origin: 80px 74px; animation: lxSpin 4s steps(8, end) infinite; }
.illo-hand-s { animation: lxSpin 6s linear infinite; }
.illo-hand-m { animation: lxSpin 24s linear infinite; }
.illo-hand-h { animation: lxSpin 288s linear infinite; }
@keyframes lxSpin { to { transform: rotate(360deg); } }

/* Magnifier slowly scans across the document */
.illo-scan { animation: lxScan 5s ease-in-out infinite; transform-box: view-box; }
@keyframes lxScan {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  30% { transform: translate(-34px, 6px) rotate(-6deg); }
  65% { transform: translate(-14px, 20px) rotate(4deg); }
}

/* Live analog clock in the dashboard time chip */
.lx-clock { width: 24px; height: 24px; flex: none; display: block; overflow: visible; }
.lx-clock-face { fill: var(--surface, #fff); stroke: var(--accent); stroke-width: 1.6; }
.lx-clock-tick { stroke: var(--accent2); stroke-width: 1.4; stroke-linecap: round; }
.lx-clock-h, .lx-clock-m { stroke: var(--text, #1d1d1b); stroke-linecap: round; }
.lx-clock-h { stroke-width: 2.2; }
.lx-clock-m { stroke-width: 1.6; }
.lx-clock-s { stroke: var(--accent); stroke-width: 1; stroke-linecap: round; }
.lx-clock-pin { fill: var(--accent); }
.lx-clock-hand { transform-box: view-box; transform-origin: 12px 12px; }
.lx-clock-s.lx-clock-hand { transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.hero-clock-badge .lx-clock { animation: lxClockPop 0.6s var(--lx-spring) both; }
@keyframes lxClockPop { from { transform: scale(0.4) rotate(-90deg); opacity: 0; } }

/* ---------- ALIGNMENT FIXES ------------------------------------------------- */
/* Dashboard: the two chart cards share one height instead of stopping at their own content */
#page-dashboard .dg { align-items: stretch; }
/* Empty state inside the 2-column "Hours by Project" list must not be split across columns */
#ds-pj .empty-state, #ds-cat .empty-state { column-span: all; }
#ds-pj .empty-state.has-illo, #ds-cat .empty-state.has-illo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 190px;
  text-align: center;
}

/* Smooth theme + scroll */
html { scroll-behavior: smooth; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .illo-hand, .illo-scan, .lx-clock-hand { animation: none !important; transition: none !important; }
  .lx-scene *, .nav-glide, .lx-ripple { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- WEBSITE HEALTH: client-declined reviews are muted & grouped last ---- */
#page-website-health tbody tr.wh-row.is-declined {
  opacity: 0.6;
  filter: grayscale(0.8);
  background: var(--surface2);
  transition: opacity 0.25s ease, filter 0.25s ease;
}
#page-website-health tbody tr.wh-row.is-declined:hover,
#page-website-health tbody tr.wh-row.is-declined:focus-within {
  opacity: 0.95;
  filter: none;
}
#page-website-health tbody tr.wh-row.is-declined .wh-project-name { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text3) 60%, transparent); }
#page-website-health tbody tr.wh-declined-divider td { padding: 0; background: transparent; border: 0; }
.wh-declined-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  margin-top: 6px;
  background: var(--surface2);
  border: 0;
  border-top: 1px dashed var(--border2);
  color: var(--text3);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.wh-declined-toggle:hover { color: var(--text2); background: var(--bg2); }
.wh-declined-count {
  min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: var(--border); color: var(--text2); text-align: center;
}
.wh-declined-hint { margin-left: auto; font-weight: 500; text-transform: none; letter-spacing: 0; opacity: 0.8; }

/* ==========================================================================
   LIGHT, LOW-STRAIN SIGN-IN / LOADING SCREENS
   Warm off-white background, dark high-contrast text, larger type, gentler motion.
   Applies in every theme (these screens are shown before the theme is chosen).
   ========================================================================== */
html body[data-theme] #startup-screen,
html body[data-theme] #login-screen {
  background: linear-gradient(135deg, #fcfaf5 0%, #f6f0e2 55%, #f1e9d7 100%) !important;
}
html body[data-theme] #startup-screen::before,
html body[data-theme] #login-screen::before {
  background: radial-gradient(circle, rgba(190, 157, 82, 0.20) 0%, transparent 68%) !important;
}

/* Sign-in progress card */
html body[data-theme] .startup-card {
  background: #ffffff;
  border: 1px solid #e4dccb;
  color: #1d1d1b;
  box-shadow: 0 18px 44px rgba(111, 88, 48, 0.14);
  backdrop-filter: none;
}
html body[data-theme] .startup-copy strong { color: #1d1d1b; font-size: 22px; letter-spacing: 0.1px; }
html body[data-theme] .startup-copy span { color: #4d4a42; font-size: 15px; }
html body[data-theme] .startup-step { color: #4d4a42; font-size: 12.5px; }
html body[data-theme] .startup-step i { color: #b9ad94; }
html body[data-theme] .startup-step.completed { color: #6f5830; }
html body[data-theme] .startup-step.active { color: #1d1d1b; text-decoration: underline; text-decoration-color: #be9d52; text-underline-offset: 4px; }
html body[data-theme] .startup-step-divider { background: #d7ccbb; }
html body[data-theme] .startup-ring-mark { filter: none; background: #fbf7ee; padding: 3px; }
html body[data-theme] .startup-ring .startup-spinner,
html body[data-theme] .startup-ring .spinner { border-color: rgba(190, 157, 82, 0.22); border-top-color: #9d7f3f; }

/* Gentler pulsing (smaller, slower) */
.startup-ring { animation: lxBreatheSoft 4s ease-in-out infinite; }
@keyframes lxBreatheSoft { 50% { transform: scale(1.025); } }
.startup-step.active i { animation-duration: 2.4s; }

/* In-app "Loading workspace..." overlay: light scrim instead of a dark one */
html body[data-theme] .loading-overlay { background: rgba(252, 250, 245, 0.78); }
html body[data-theme] .loading-card { background: #ffffff; color: #1d1d1b; border-color: #e4dccb; }
html body[data-theme] .loading-card #loading-message,
html body[data-theme] #loading-message { color: #1d1d1b; font-size: 15px; }

/* Login scene on a light background: darker gold line-work, soft glows, calmer motion */
#login-screen #lxWave stop { stop-color: #a8832f; }
#login-screen .lx-wave { opacity: 0.35; }
#login-screen .lx-link { stroke: rgba(157, 127, 63, 0.30); }
#login-screen .lx-star { fill: #b08d3c; }
#login-screen .lx-orb-a, #login-screen .lx-orb-c { fill: #e6cf94; }
#login-screen .lx-orb-b { fill: #f0dcae; }
.lx-orb-a { animation-duration: 30s; }
.lx-orb-b { animation-duration: 36s; }
.lx-orb-c { animation-duration: 42s; }
.lx-wave { animation-duration: 36s; }
#login-screen .login-card { box-shadow: 0 18px 44px rgba(111, 88, 48, 0.16); border-color: #e4dccb; }
#login-screen .login-hd p { font-size: 14px; color: #4d4a42; }

/* ---------- NOTIFICATIONS: dismiss / clear / group labels / info tone ------------- */
.notification-head-actions { display: flex; align-items: center; gap: 4px; }
.notification-clear-btn { color: var(--text3); }
.notification-clear-btn:hover { color: var(--bill, #c2410c); }
.notification-group-label {
  padding: 8px 10px 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
}
.notification-item { padding-right: 34px; }
.notification-dismiss {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.notification-item:hover .notification-dismiss,
.notification-item:focus-within .notification-dismiss,
.notification-item:focus .notification-dismiss { opacity: 1; }
.notification-dismiss:hover { background: var(--bg2); color: var(--text); }
@media (hover: none) { .notification-dismiss { opacity: 0.7; } }
.notification-unread-dot { right: 34px; }
.notification-restore {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 10px; margin-top: 4px;
  border: 0; border-top: 1px solid var(--border); background: transparent;
  color: var(--text3); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.notification-restore:hover { color: var(--accent3); background: var(--surface2); }
.notification-item.tone-info .notification-item-icon { background: var(--maint-bg, #eff6ff); color: var(--maint, #1d4ed8); }
