/* ── MATERIAL DESIGN 3 DESIGN TOKENS ─────────────────────────────────── */
:root {
  /* Surface Tokens */
  --md-sys-color-surface: #f6f8fc;
  --md-sys-color-surface-dim: #d9dae0;
  --md-sys-color-surface-bright: #f8f9fc;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f0f3f9;
  --md-sys-color-surface-container: #eaedf4;
  --md-sys-color-surface-container-high: #e4e7ee;
  --md-sys-color-surface-container-highest: #dee1e8;

  /* On-Surface Tokens */
  --md-sys-color-on-surface: #191c20;
  --md-sys-color-on-surface-variant: #43474e;
  --md-sys-color-outline: #73777f;
  --md-sys-color-outline-variant: #c3c7d0;

  /* Primary Tokens */
  --md-sys-color-primary: #0061a4;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d1e4ff;
  --md-sys-color-on-primary-container: #001d36;

  /* Secondary Tokens */
  --md-sys-color-secondary: #535f70;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #d7e3f7;
  --md-sys-color-on-secondary-container: #101c2b;

  /* Tertiary / Accent Tokens */
  --md-sys-color-tertiary: #6b5778;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #f2daff;
  --md-sys-color-on-tertiary-container: #251431;

  /* Success Semantic Tokens */
  --md-sys-color-success: #196837;
  --md-sys-color-on-success: #ffffff;
  --md-sys-color-success-container: #c3eed0;
  --md-sys-color-on-success-container: #00210b;

  /* Error Semantic Tokens */
  --md-sys-color-error: #ba1a1a;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #ffdad6;
  --md-sys-color-on-error-container: #410002;

  /* M3 Shape Scale */
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* M3 Motion */
  --md-sys-motion-easing: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-duration: 250ms;
}

* {
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── AMBIENT DYNAMIC BACKGROUND ORBS (VIBRANT & ALIVE) ────────────────── */
.m3-ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.m3-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.6;
  animation: orbDrift 20s infinite alternate ease-in-out;
}

.m3-orb-1 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(168, 204, 255, 0.7) 0%, rgba(209, 228, 255, 0) 70%);
  top: -120px;
  left: -100px;
  animation-duration: 18s;
}

.m3-orb-2 {
  width: 580px;
  height: 580px;
  background: radial-gradient(circle, rgba(235, 207, 255, 0.65) 0%, rgba(242, 218, 255, 0) 70%);
  top: 25%;
  right: -150px;
  animation-duration: 24s;
  animation-delay: -5s;
}

.m3-orb-3 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(187, 240, 203, 0.6) 0%, rgba(195, 238, 208, 0) 70%);
  bottom: 5%;
  left: -80px;
  animation-duration: 22s;
  animation-delay: -10s;
}

.m3-orb-4 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(255, 224, 187, 0.55) 0%, rgba(255, 235, 210, 0) 70%);
  bottom: -100px;
  right: 15%;
  animation-duration: 20s;
  animation-delay: -15s;
}

@keyframes orbDrift {
  0% {
    transform: translate(0px, 0px) scale(1);
  }
  50% {
    transform: translate(40px, 60px) scale(1.08);
  }
  100% {
    transform: translate(-30px, 40px) scale(0.95);
  }
}

/* ── M3 SURFACE CARDS ─────────────────────────────────────────────────── */
.m3-card {
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--md-sys-shape-corner-extra-large);
  border: 1px solid rgba(195, 199, 208, 0.7);
  box-shadow: 0 4px 20px -2px rgba(25, 28, 32, 0.05), 0 2px 6px -1px rgba(25, 28, 32, 0.03);
  transition: all var(--md-sys-motion-duration) var(--md-sys-motion-easing);
}

.m3-card:hover {
  border-color: rgba(195, 199, 208, 0.95);
  box-shadow: 0 8px 30px -4px rgba(25, 28, 32, 0.08);
}

@media (max-width: 640px) {
  .m3-card {
    border-radius: 20px;
  }
}

/* ── M3 STICKY SUMMARY BANNER (FLOATING ONLY) ─────────────────────────── */
.m3-sticky-banner {
  border-radius: var(--md-sys-shape-corner-full);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 8px 28px -4px rgba(25, 28, 32, 0.12), 0 2px 8px -1px rgba(25, 28, 32, 0.06);
  transition: all var(--md-sys-motion-duration) var(--md-sys-motion-easing);
}

@media (max-width: 640px) {
  .m3-sticky-banner {
    border-radius: 20px;
    padding: 0.75rem 1rem !important;
  }
}

/* ── M3 OUTLINED TEXT FIELD ───────────────────────────────────────────── */
.m3-outlined-input {
  width: 100%;
  padding: 0.875rem 1rem;
  background-color: #ffffff;
  border: 1.5px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-large);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
  outline: none;
  transition: all 180ms var(--md-sys-motion-easing);
}

.m3-outlined-input:hover {
  border-color: var(--md-sys-color-outline);
}

.m3-outlined-input:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 3px rgba(0, 97, 164, 0.18);
}

/* ── MATERIAL 3 ADAPTIVE DROPDOWN (INSPIRED BY MATERIAL 3 SPEC) ──────── */
.m3-dropdown-trigger {
  height: 48px;
  border-radius: 18px;
  background: #ffffff;
  border: 1.5px solid var(--md-sys-color-outline-variant);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  cursor: pointer;
  transition: all 0.22s var(--md-sys-motion-easing);
  outline: none;
  width: 100%;
}

.m3-dropdown-trigger:hover {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 4px rgba(0, 97, 164, 0.08);
}

.m3-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  min-width: 170px;
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(25, 28, 32, 0.12);
  border: 1px solid rgba(0, 0, 0, 0.06);
  z-index: 50;
  animation: dropdownPop 0.2s var(--md-sys-motion-easing);
}

@keyframes dropdownPop {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.m3-dropdown-item {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface);
}

.m3-dropdown-item:hover {
  background: #eef4ff;
}

.m3-dropdown-item.active {
  background: #e7f0ff;
  color: var(--md-sys-color-primary);
  font-weight: 700;
}

/* ── M3 SEGMENTED BUTTON ──────────────────────────────────────────────── */
.m3-segmented-container {
  display: inline-flex;
  background-color: rgba(234, 237, 244, 0.85);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
  padding: 3px;
  gap: 2px;
}

.m3-segment-button {
  padding: 0.5rem 1rem;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: 0.8125rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 180ms var(--md-sys-motion-easing);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
}

.m3-segment-button.active {
  background-color: #ffffff;
  color: var(--md-sys-color-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.m3-segment-button:not(.active) {
  background-color: transparent;
  color: var(--md-sys-color-on-surface-variant);
}

.m3-segment-button:not(.active):hover {
  background-color: rgba(67, 71, 78, 0.08);
  color: var(--md-sys-color-on-surface);
}

/* ── M3 FILTER CHIPS ──────────────────────────────────────────────────── */
.m3-filter-chip {
  padding: 0.4rem 0.875rem;
  border-radius: var(--md-sys-shape-corner-small);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--md-sys-color-outline-variant);
  cursor: pointer;
  transition: all 180ms var(--md-sys-motion-easing);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 32px;
}

.m3-filter-chip.active {
  background-color: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  border-color: transparent;
}

.m3-filter-chip:not(.active) {
  background-color: rgba(255, 255, 255, 0.8);
  color: var(--md-sys-color-on-surface-variant);
}

.m3-filter-chip:not(.active):hover {
  background-color: #ffffff;
  border-color: var(--md-sys-color-outline);
}

/* ── M3 TIER BADGES ───────────────────────────────────────────────────── */
.badge-tier-1 {
  background-color: #f2daff;
  color: #521c70;
  border: 1px solid #e1b9f7;
}

.badge-tier-2 {
  background-color: #d1e4ff;
  color: #00325b;
  border: 1px solid #b6d4fe;
}

.badge-tier-3 {
  background-color: #ffebd2;
  color: #6d3900;
  border: 1px solid #fed29c;
}

.badge-tier-4 {
  background-color: #eaedf4;
  color: #43474e;
  border: 1px solid #dee1e8;
}

/* ── TOUCH TARGET MINIMUM ─────────────────────────────────────────────── */
.touch-target {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── SCROLLBAR ────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-corner-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--md-sys-color-outline);
}

/* ── PRINT STYLES ─────────────────────────────────────────────────────── */
@media print {
  body {
    background: #ffffff !important;
  }
  .m3-ambient-bg, .no-print, .m3-sticky-banner {
    display: none !important;
  }
  .m3-card {
    box-shadow: none !important;
    border: 1px solid #c3c7d0 !important;
    background: #ffffff !important;
  }
}
