/* ════════════════════════════════���══════════════════════════════════════════════
   MB Design System v1.0 — Shared across all Michel Baakliny platforms
   Loaded via: <link rel="stylesheet" href="/shared/mb-design-system.css">
   Nginx alias: /shared/ → /var/www/shared/

   Each platform keeps its own :root color palette.
   This file provides: animations, liquid glass, utilities, transitions.
   ════════════════════════════���══════════════════════════��═══════════════════════ */

/* ── Liquid Glass — Web adaptation of Apple's iOS 26 Liquid Glass ──────────── */

.glass-panel {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(40px) saturate(180%) brightness(1.05);
  -webkit-backdrop-filter: blur(40px) saturate(180%) brightness(1.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-top-color: rgba(255,255,255,0.28);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -1px 0 rgba(255,255,255,0.04),
    0 8px 32px rgba(0,0,0,0.35),
    0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,255,255,0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.28),
    inset 0 -1px 0 rgba(255,255,255,0.06),
    0 12px 40px rgba(0,0,0,0.4),
    0 4px 12px rgba(0,0,0,0.25);
}

.glass-card {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255,255,255,0.08);
  border-top-color: rgba(255,255,255,0.18);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.15),
    0 4px 16px rgba(0,0,0,0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    0 8px 28px rgba(0,0,0,0.35),
    0 2px 8px rgba(0,0,0,0.2);
}

.glass-subtle {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.06);
}

.glass-prominent {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(60px) saturate(220%) brightness(1.1);
  -webkit-backdrop-filter: blur(60px) saturate(220%) brightness(1.1);
  border: 1px solid rgba(255,255,255,0.22);
  border-top-color: rgba(255,255,255,0.38);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.35),
    inset 1px 0 0 rgba(255,255,255,0.15),
    inset -1px 0 0 rgba(255,255,255,0.05),
    0 24px 64px rgba(0,0,0,0.45),
    0 8px 20px rgba(0,0,0,0.25);
}

/* Liquid Glass Refraction — simulates light bending */
.glass-refract {
  position: relative;
  overflow: hidden;
}

.glass-refract::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(
    ellipse at 30% 20%,
    rgba(255,255,255,0.08) 0%,
    transparent 50%
  );
  pointer-events: none;
  animation: glassRefract 8s ease-in-out infinite alternate;
}

@keyframes glassRefract {
  0%   { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(5%, 3%) rotate(2deg); }
}

/* Liquid Glass Shine — top edge highlight */
.glass-shine {
  position: relative;
  overflow: hidden;
}

.glass-shine::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.5) 40%,
    rgba(255,255,255,0.7) 50%,
    rgba(255,255,255,0.5) 60%,
    transparent 100%
  );
  animation: glassShine 6s ease-in-out infinite;
}

@keyframes glassShine {
  0%   { left: -100%; }
  50%  { left: 100%; }
  100% { left: 100%; }
}

/* ── Animations ────────────────────────────────────────────────────────────── */

/* Entry animations */
@keyframes mb-fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes mb-slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes mb-slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes mb-slideLeft {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes mb-slideRight {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes mb-scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes mb-popIn {
  0%   { opacity: 0; transform: scale(0.8); }
  70%  { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

/* Continuous animations */
@keyframes mb-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}

@keyframes mb-breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%      { transform: scale(1.02); opacity: 1; }
}

@keyframes mb-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes mb-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

@keyframes mb-glow {
  0%, 100% { box-shadow: 0 0 5px var(--glow-color, rgba(79,172,254,0.3)); }
  50%      { box-shadow: 0 0 20px var(--glow-color, rgba(79,172,254,0.5)); }
}

@keyframes mb-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes mb-blobDrift {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -40px) scale(1.06); }
  66%  { transform: translate(-25px, 35px) scale(0.96); }
  100% { transform: translate(50px, 15px) scale(1.04); }
}

/* Stagger animation helper — apply to children with CSS variables */
.mb-stagger > * {
  animation: mb-slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.mb-stagger > *:nth-child(1)  { animation-delay: 0ms; }
.mb-stagger > *:nth-child(2)  { animation-delay: 50ms; }
.mb-stagger > *:nth-child(3)  { animation-delay: 100ms; }
.mb-stagger > *:nth-child(4)  { animation-delay: 150ms; }
.mb-stagger > *:nth-child(5)  { animation-delay: 200ms; }
.mb-stagger > *:nth-child(6)  { animation-delay: 250ms; }
.mb-stagger > *:nth-child(7)  { animation-delay: 300ms; }
.mb-stagger > *:nth-child(8)  { animation-delay: 350ms; }
.mb-stagger > *:nth-child(9)  { animation-delay: 400ms; }
.mb-stagger > *:nth-child(10) { animation-delay: 450ms; }
.mb-stagger > *:nth-child(n+11) { animation-delay: 500ms; }

/* Utility animation classes */
.mb-animate-fadeIn    { animation: mb-fadeIn 0.3s ease both; }
.mb-animate-slideUp   { animation: mb-slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both; }
.mb-animate-slideDown { animation: mb-slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1) both; }
.mb-animate-scaleIn   { animation: mb-scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) both; }
.mb-animate-popIn     { animation: mb-popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.mb-animate-pulse     { animation: mb-pulse 2s ease-in-out infinite; }
.mb-animate-breathe   { animation: mb-breathe 3s ease-in-out infinite; }
.mb-animate-float     { animation: mb-float 3s ease-in-out infinite; }
.mb-animate-spin      { animation: mb-spin 1s linear infinite; }

/* Shimmer loading effect */
.mb-shimmer {
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: mb-shimmer 1.5s ease-in-out infinite;
}

/* ── Transitions ───────────────────────────────────��───────────────────────── */

.mb-transition-fast   { transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1); }
.mb-transition        { transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.mb-transition-slow   { transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.mb-transition-bounce { transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.mb-transition-spring { transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }

/* Hover transform helpers */
.mb-hover-lift:hover   { transform: translateY(-3px); }
.mb-hover-scale:hover  { transform: scale(1.03); }
.mb-hover-glow:hover   { box-shadow: 0 0 20px var(--glow-color, rgba(79,172,254,0.3)); }

/* ── Scrollbar ───────────────────────────────────────────────────────���─────── */

.mb-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
.mb-scrollbar::-webkit-scrollbar-track { background: transparent; }
.mb-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.10);
  border-radius: 4px;
}
.mb-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.18);
}

/* ���─ Status indicators ─────────────────────────────────────────────────────── */

.mb-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.mb-status-dot.online {
  background: #30d158;
  box-shadow: 0 0 8px rgba(48, 209, 88, 0.5);
}

.mb-status-dot.online::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 1.5px solid rgba(48, 209, 88, 0.3);
  animation: mb-pulse 2s ease-in-out infinite;
}

.mb-status-dot.warning {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.mb-status-dot.error {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
  animation: mb-pulse 1.5s ease-in-out infinite;
}

.mb-status-dot.offline {
  background: #64748b;
}

/* ── Tooltip ─────────��─────────────────────────────────────────────────────── */

[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
}

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

/* ── Focus ring ─────────────────────────────────────���──────────────────────── */

.mb-focus-ring:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(79, 172, 254, 0.5);
}

/* ── Badge ───���─────────────────────────────────────────────────────────────── */

.mb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.mb-badge.accent {
  background: var(--accent-dim, rgba(79,172,254,0.12));
  color: var(--accent, #4facfe);
  border: 1px solid var(--accent-dim, rgba(79,172,254,0.2));
}

.mb-badge.success {
  background: rgba(48, 209, 88, 0.12);
  color: #30d158;
  border: 1px solid rgba(48, 209, 88, 0.2);
}

.mb-badge.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.mb-badge.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ── Empty state ───────��───────────────────────────────────────────────────── */

.mb-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: rgba(255,255,255,0.35);
  font-size: 14px;
  gap: 12px;
}

.mb-empty-state svg {
  width: 48px; height: 48px;
  opacity: 0.3;
}

/* ── Loading spinner ───────────────────────────────────────────���───────────── */

.mb-spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent, #4facfe);
  border-radius: 50%;
  animation: mb-spin 0.6s linear infinite;
}

.mb-spinner.lg { width: 32px; height: 32px; border-width: 3px; }
.mb-spinner.xl { width: 48px; height: 48px; border-width: 3px; }

/* ── Reduced motion ────────��───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
