/* =====================================================
   MOTION.CSS — Modern animations & interactive utilities
   ===================================================== */

/* ---------- Reveal on Scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(1.4rem);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ---------- Stagger Children ---------- */
.stagger-children > * {
  opacity: 0;
  transform: translateY(1.2rem);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-children.is-visible > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.is-visible > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children.is-visible > *:nth-child(3) { transition-delay: 0.15s; }
.stagger-children.is-visible > *:nth-child(4) { transition-delay: 0.2s; }
.stagger-children.is-visible > *:nth-child(5) { transition-delay: 0.25s; }
.stagger-children.is-visible > *:nth-child(6) { transition-delay: 0.3s; }
.stagger-children.is-visible > *:nth-child(7) { transition-delay: 0.35s; }
.stagger-children.is-visible > *:nth-child(8) { transition-delay: 0.4s; }
.stagger-children.is-visible > *:nth-child(9) { transition-delay: 0.45s; }
.stagger-children.is-visible > *:nth-child(10) { transition-delay: 0.5s; }

.stagger-children.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Hover Lift ---------- */
.hover-lift {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.hover-lift:hover {
  transform: translateY(-0.35rem);
  box-shadow: 0 16px 34px rgba(18, 53, 100, 0.15);
}

.hover-lift-sm {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hover-lift-sm:hover {
  transform: translateY(-0.2rem);
  box-shadow: 0 8px 20px rgba(18, 53, 100, 0.12);
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.glass-dark {
  background: rgba(18, 53, 100, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ---------- Shimmer / Skeleton ---------- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #eef4ff 25%, #dbe9ff 50%, #eef4ff 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite;
  border-radius: 0.6rem;
}

/* ---------- Pulse / Float / Bounce ---------- */
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.pulse-soft {
  animation: pulse-soft 2.5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.6rem); }
}

.float {
  animation: float 4s ease-in-out infinite;
}

@keyframes bounce-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-0.5rem); }
}

.bounce-soft {
  animation: bounce-soft 1.8s ease-in-out infinite;
}

/* ---------- Fade & Slide Variants ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(1.2rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-1.2rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-1.2rem); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(1.2rem); }
  to { opacity: 1; transform: translateX(0); }
}

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

.anim-fade-in-up { animation: fadeInUp 0.6s ease both; }
.anim-fade-in-down { animation: fadeInDown 0.6s ease both; }
.anim-fade-in-left { animation: fadeInLeft 0.6s ease both; }
.anim-fade-in-right { animation: fadeInRight 0.6s ease both; }
.anim-scale-in { animation: scaleIn 0.5s ease both; }

.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }
.anim-delay-4 { animation-delay: 0.4s; }
.anim-delay-5 { animation-delay: 0.5s; }

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 18rem;
  padding: 0.9rem 1.1rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(12, 41, 83, 0.18);
  border: 1px solid rgba(17, 48, 77, 0.12);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: fadeInRight 0.4s ease both;
}

.toast.success { border-left: 4px solid #27ae60; }
.toast.error { border-left: 4px solid #e74c3c; }
.toast.info { border-left: 4px solid #3498db; }
.toast.warning { border-left: 4px solid #f39c12; }

.toast-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.toast-body {
  flex: 1;
  font-weight: 600;
  font-size: 0.95rem;
  color: #11304d;
}

/* ---------- Progress Bar ---------- */
.progress {
  height: 0.6rem;
  border-radius: 999px;
  background: #eef4ff;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1b74c9, #6cb7ff);
  transition: width 0.6s ease;
}

/* ---------- Skeleton Text ---------- */
.skeleton-text {
  height: 1em;
  border-radius: 0.3rem;
  margin-bottom: 0.5rem;
}

.skeleton-text:last-child {
  width: 60%;
}

/* ---------- Backdrop utilities ---------- */
.backdrop-blur-sm { backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.backdrop-blur { backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.backdrop-blur-lg { backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }

/* ---------- Modern scrollbar (webkit) ---------- */
.custom-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
  background: rgba(17, 48, 77, 0.25);
  border-radius: 999px;
}

.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(17, 48, 77, 0.45);
}

/* ---------- Selection ---------- */
::selection {
  background: rgba(27, 116, 201, 0.25);
  color: #0d4d90;
}

/* ---------- Focus Ring ---------- */
.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 116, 201, 0.25);
}

/* ---------- Loading Spinner ---------- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid #eef4ff;
  border-top-color: #1b74c9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-lg {
  width: 2.5rem;
  height: 2.5rem;
  border-width: 3px;
}

/* ---------- Ripple ---------- */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.35) 10%, transparent 10.5%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(0);
  opacity: 0;
  transition: transform 0.5s, opacity 0.4s;
}

.ripple:active::after {
  transform: scale(2.5);
  opacity: 1;
  transition: 0s;
}

/* ---------- Tooltip ---------- */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%) translateY(0.3rem);
  padding: 0.35rem 0.6rem;
  border-radius: 0.4rem;
  background: #11304d;
  color: #fff;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0.4rem;
  border-bottom: 1px solid rgba(17, 48, 77, 0.12);
}

.tab {
  padding: 0.6rem 1rem;
  border-radius: 0.6rem 0.6rem 0 0;
  cursor: pointer;
  font-weight: 600;
  color: #5f6f84;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  border-bottom: none;
}

.tab:hover {
  color: #1b74c9;
  background: rgba(27, 116, 201, 0.08);
}

.tab.active {
  color: #0d4d90;
  background: #ffffff;
  border-color: rgba(17, 48, 77, 0.12);
}

/* ---------- Accordion ---------- */
.accordion {
  border: 1px solid rgba(17, 48, 77, 0.12);
  border-radius: 0.9rem;
  overflow: hidden;
}

.accordion-item + .accordion-item {
  border-top: 1px solid rgba(17, 48, 77, 0.12);
}

.accordion-trigger {
  width: 100%;
  padding: 1rem 1.2rem;
  background: #ffffff;
  border: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  color: #11304d;
}

.accordion-trigger[aria-expanded="true"] {
  color: #0d4d90;
}

.accordion-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  padding: 0 1.2rem;
}

.accordion-panel.open {
  max-height: 12rem;
  padding: 0.8rem 1.2rem 1.1rem;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 41, 83, 0.45);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #ffffff;
  border-radius: 1.2rem;
  box-shadow: 0 20px 50px rgba(12, 41, 83, 0.25);
  max-width: 32rem;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(1rem) scale(0.98);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.2rem 1.4rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #11304d;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: #5f6f84;
  line-height: 1;
}

.modal-body {
  padding: 1rem 1.4rem 1.4rem;
  color: #5f6f84;
}

/* ---------- Badge ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  background: #eef4ff;
  color: #0d4d90;
}

.badge-success { background: #e6f9ee; color: #0d7a33; }
.badge-warning { background: #fff5e0; color: #8a5a00; }
.badge-danger { background: #fdecea; color: #8a1c1c; }
.badge-info { background: #e6f3ff; color: #0d4d90; }

/* ---------- Modern Card ---------- */
.card {
  background: #ffffff;
  border: 1px solid rgba(17, 48, 77, 0.12);
  border-radius: 1rem;
  box-shadow: 0 18px 50px rgba(12, 41, 83, 0.12);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  overflow: hidden;
}

.card-hover:hover {
  transform: translateY(-0.35rem);
  box-shadow: 0 16px 34px rgba(18, 53, 100, 0.15);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  border-color: rgba(27, 116, 201, 0.4);
}

.card-figure {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.card-figure img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.card-interactive:hover .card-figure img {
  transform: scale(1.04);
}

.card-body {
  padding: 1.1rem 1.2rem 1.3rem;
}

.card-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #11304d;
  line-height: 1.3;
}

.card-brief {
  margin: 0;
  font-size: 0.9rem;
  color: #5f6f84;
  line-height: 1.55;
}

.card-tag {
  display: inline-block;
  margin: 0.35rem 0.35rem 0 0;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: #eef4ff;
  color: #0d4d90;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.card-tag:hover {
  text-decoration: underline;
}

/* ---------- Section spacing ---------- */
.section {
  padding: clamp(3rem, 5vw, 5rem) 0;
}

.section-tight {
  padding: clamp(2rem, 4vw, 4rem) 0;
}

/* ---------- Container ---------- */
.container {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.container-narrow {
  width: min(860px, calc(100% - 2rem));
  margin-inline: auto;
}

/* ---------- Text Utilities ---------- */
.text-balance {
  text-wrap: balance;
}

.text-pretty {
  text-wrap: pretty;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Aspect Ratios ---------- */
.ratio-16-9 { aspect-ratio: 16 / 9; }
.ratio-4-3 { aspect-ratio: 4 / 3; }
.ratio-1-1 { aspect-ratio: 1 / 1; }

/* ---------- Safe area / notch support ---------- */
.safe-top { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
.safe-left { padding-left: env(safe-area-inset-left); }
.safe-right { padding-right: env(safe-area-inset-right); }

/* ---------- Print ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; color: #000; }
}
