/* ═══════════════════════════════════════════════════════════════
   OCEUM PREMIUM DESIGN SYSTEM
   Obsidian Command — micro-interactions, depth, motion
   ═══════════════════════════════════════════════════════════════ */

:root {
  --spring-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth-out: cubic-bezier(0.16, 1, 0.3, 1);
  --smooth-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --mono: 'JetBrains Mono', 'SF Mono', monospace;
}

/* ═══ PAGE ENTRANCE ═══ */
.page-enter {
  animation: pageReveal 0.6s var(--smooth-out) both;
}
@keyframes pageReveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ SKELETON LOADERS ═══ */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(26, 26, 31, 0.8) 0%,
    rgba(42, 42, 50, 0.6) 40%,
    rgba(42, 42, 50, 0.6) 60%,
    rgba(26, 26, 31, 0.8) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(201, 169, 110, 0.03) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; width: 60%; margin-bottom: 8px; }
.skeleton-text.short { width: 35%; }
.skeleton-text.long { width: 85%; }
.skeleton-heading { height: 32px; width: 40%; margin-bottom: 12px; }
.skeleton-card { height: 120px; }
.skeleton-stat { height: 100px; }
.skeleton-row { height: 52px; margin-bottom: 2px; }
.skeleton-avatar { width: 32px; height: 32px; border-radius: 50%; }
.skeleton-badge { height: 20px; width: 64px; border-radius: 10px; }

/* ═══ GLASSMORPHISM ═══ */
.glass {
  background: linear-gradient(
    135deg,
    rgba(17, 17, 20, 0.85) 0%,
    rgba(26, 26, 31, 0.65) 100%
  );
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border: 1px solid rgba(201, 169, 110, 0.08);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(201, 169, 110, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}
.glass-subtle {
  background: linear-gradient(
    135deg,
    rgba(17, 17, 20, 0.6) 0%,
    rgba(26, 26, 31, 0.4) 100%
  );
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid rgba(201, 169, 110, 0.06);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

/* ═══ STAGGER ANIMATIONS ═══ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.stagger-1  { animation: fadeUp 0.5s var(--spring-bounce) 0.03s both; }
.stagger-2  { animation: fadeUp 0.5s var(--spring-bounce) 0.07s both; }
.stagger-3  { animation: fadeUp 0.5s var(--spring-bounce) 0.11s both; }
.stagger-4  { animation: fadeUp 0.5s var(--spring-bounce) 0.15s both; }
.stagger-5  { animation: fadeUp 0.5s var(--spring-bounce) 0.19s both; }
.stagger-6  { animation: fadeUp 0.5s var(--spring-bounce) 0.23s both; }
.stagger-7  { animation: fadeUp 0.5s var(--spring-bounce) 0.27s both; }
.stagger-8  { animation: fadeUp 0.5s var(--spring-bounce) 0.31s both; }
.stagger-9  { animation: fadeUp 0.5s var(--spring-bounce) 0.35s both; }
.stagger-10 { animation: fadeUp 0.5s var(--spring-bounce) 0.39s both; }
.stagger-11 { animation: fadeUp 0.5s var(--spring-bounce) 0.43s both; }
.stagger-12 { animation: fadeUp 0.5s var(--spring-bounce) 0.47s both; }

/* ═══ STATUS DOTS WITH GLOW ═══ */
.glow-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.glow-dot::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s;
}
.glow-dot.active {
  background: #28c840;
  box-shadow: 0 0 6px rgba(40, 200, 64, 0.4);
}
.glow-dot.active::before {
  background: radial-gradient(circle, rgba(40, 200, 64, 0.25) 0%, transparent 70%);
  opacity: 1;
  animation: dotPulse 2.5s ease-in-out infinite;
}
.glow-dot.idle {
  background: #c9a96e;
  box-shadow: 0 0 4px rgba(201, 169, 110, 0.3);
}
.glow-dot.idle::before {
  background: radial-gradient(circle, rgba(201, 169, 110, 0.15) 0%, transparent 70%);
  opacity: 1;
}
.glow-dot.error {
  background: #e54d42;
  box-shadow: 0 0 6px rgba(229, 77, 66, 0.4);
}
.glow-dot.error::before {
  background: radial-gradient(circle, rgba(229, 77, 66, 0.25) 0%, transparent 70%);
  opacity: 1;
  animation: dotPulse 1.5s ease-in-out infinite;
}
.glow-dot.warning {
  background: #ffbd2e;
  box-shadow: 0 0 4px rgba(255, 189, 46, 0.3);
}
.glow-dot.warning::before {
  background: radial-gradient(circle, rgba(255, 189, 46, 0.2) 0%, transparent 70%);
  opacity: 1;
}
.glow-dot.offline {
  background: #4a4a56;
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.4); opacity: 0.3; }
}

/* ═══ CARD HOVER DEPTH ═══ */
.hover-lift {
  transition: transform 0.35s var(--smooth-out),
              box-shadow 0.35s var(--smooth-out),
              border-color 0.35s var(--smooth-out);
}
.hover-lift:hover {
  transform: translateY(-3px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(201, 169, 110, 0.1);
  border-color: rgba(201, 169, 110, 0.15);
}
.hover-lift:active {
  transform: translateY(-1px);
  transition-duration: 0.1s;
}

/* ═══ INPUT FOCUS GLOW ═══ */
.input-glow {
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
}
.input-glow:focus {
  border-color: rgba(201, 169, 110, 0.4) !important;
  box-shadow:
    0 0 0 3px rgba(201, 169, 110, 0.08),
    0 0 16px rgba(201, 169, 110, 0.06);
  transform: translateY(-1px);
  outline: none;
}

/* ═══ BUTTON EFFECTS ═══ */
.btn-ripple {
  position: relative;
  overflow: hidden;
}
.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transform: translate(-50%, -50%);
  transition: width 0.5s var(--smooth-out), height 0.5s var(--smooth-out), opacity 0.5s;
  opacity: 0;
}
.btn-ripple:active::after {
  width: 400px;
  height: 400px;
  opacity: 1;
  transition: width 0s, height 0s, opacity 0s;
}

.btn-press {
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-press:active {
  transform: scale(0.97);
}

/* ═══ PANEL SPRING PHYSICS ═══ */
.spring-slide {
  transition: transform 0.5s var(--spring-bounce),
              opacity 0.4s var(--smooth-out);
}
.spring-slide-right {
  transform: translateX(100%);
  opacity: 0;
}
.spring-slide-right.open {
  transform: translateX(0);
  opacity: 1;
}
.spring-slide-up {
  transform: translateY(24px);
  opacity: 0;
}
.spring-slide-up.open {
  transform: translateY(0);
  opacity: 1;
}
.spring-scale {
  transition: transform 0.4s var(--spring-bounce),
              opacity 0.3s var(--smooth-out);
}
.spring-scale.hidden {
  transform: scale(0.95);
  opacity: 0;
  pointer-events: none;
}
.spring-scale.visible {
  transform: scale(1);
  opacity: 1;
}

/* ═══ TOPBAR SCROLL ═══ */
.topbar {
  transition: box-shadow 0.3s, height 0.3s, background 0.3s;
}
.topbar.scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  background: rgba(10, 10, 12, 0.85);
}

/* ═══ EMPTY STATE ═══ */
.float-idle {
  animation: floatIdle 3.5s ease-in-out infinite;
}
@keyframes floatIdle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ═══ TOOLTIPS ═══ */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  padding: 6px 12px;
  background: rgba(26, 26, 31, 0.95);
  border: 1px solid rgba(201, 169, 110, 0.12);
  border-radius: 6px;
  font-family: var(--sans, 'Instrument Sans', sans-serif);
  font-size: 11px;
  font-weight: 500;
  color: #b8b8c4;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s var(--smooth-out);
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══ SUCCESS / CELEBRATION ═══ */
@keyframes celebrate {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes checkDraw {
  from { stroke-dashoffset: 24; }
  to { stroke-dashoffset: 0; }
}
.celebrate { animation: celebrate 0.5s var(--spring-bounce); }

/* ═══ ROW HOVER ACCENT ═══ */
.row-accent {
  position: relative;
}
.row-accent::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #c9a96e;
  border-radius: 0 1px 1px 0;
  transform: scaleY(0);
  transition: transform 0.25s var(--smooth-out);
  transform-origin: center;
}
.row-accent:hover::before {
  transform: scaleY(1);
}

/* ═══ LOGO MICRO-INTERACTION ═══ */
.logo-hover {
  transition: transform 0.3s var(--spring-bounce), box-shadow 0.3s;
}
.logo-hover:hover {
  transform: scale(1.08) rotate(2deg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ═══ SECTION REVEAL ═══ */
.section-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--smooth-out), transform 0.6s var(--smooth-out);
}
.section-reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ═══ COUNTER ANIMATION (JS helper) ═══
   Usage: <span data-count-to="42" data-count-duration="800">0</span>
   Call: animateCounters() after data loads
*/

/* ═══ CONNECTED GLOW ═══ */
.connected-glow {
  position: relative;
}
.connected-glow::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(40, 200, 64, 0.08), transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.connected-glow.active::after {
  opacity: 1;
}

/* ═══ LEVEL CHIP PULSE ═══ */
@keyframes chipPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 8px currentColor; }
}
.chip-pulse-new {
  animation: chipPulse 1s ease-in-out 2;
}

/* ═══ PROGRESS BAR SMOOTH ═══ */
.progress-smooth {
  transition: width 0.6s var(--smooth-out);
}

/* ═══ CARD SELECTION ═══ */
.select-card {
  transition: transform 0.2s var(--spring-bounce),
              border-color 0.2s,
              box-shadow 0.2s;
  cursor: pointer;
}
.select-card:hover {
  transform: scale(1.02);
  border-color: rgba(201, 169, 110, 0.2);
}
.select-card.selected {
  border-color: rgba(201, 169, 110, 0.5);
  box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.1),
              0 8px 24px rgba(0, 0, 0, 0.3);
  transform: scale(1.02);
}
.select-card:active {
  transform: scale(0.98);
  transition-duration: 0.1s;
}

/* ═══ SPINNER ═══ */
.spinner-sm {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(201, 169, 110, 0.2);
  border-top-color: #c9a96e;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .glow-dot::before { animation: none !important; }
  .skeleton-shimmer::after { animation: none !important; }
  .spring-bounce { transition: none !important; }
}

/* ═══ ACCESSIBILITY: VISIBLE FOCUS ═══
   WCAG 2.4.7 — all interactive elements need a visible focus indicator.
   Uses :focus-visible so mouse clicks don't show the ring, but keyboard nav does. */
*:focus-visible {
  outline: 2px solid var(--champagne-light, #dfc28a);
  outline-offset: 2px;
  border-radius: inherit;
}
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible {
  outline: 2px solid var(--champagne-light, #dfc28a);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(201, 169, 110, 0.18);
}
/* Skip link — appears on keyboard focus only */
.skip-to-main {
  position: absolute;
  top: -48px;
  left: 16px;
  padding: 12px 20px;
  background: var(--champagne, #c9a96e);
  color: var(--obsidian, #0a0a0c);
  font-weight: 600;
  border-radius: 4px;
  z-index: 10000;
  transition: top 0.2s ease;
}
.skip-to-main:focus {
  top: 16px;
}
