/* Bộ token giao diện · The Ivy League Vietnam (demo2)
   Ngoài khối đánh dấu dưới đây, không đặt mã màu trực tiếp trong HTML. */

:root,
.force-light {
  color-scheme: light;

  /* Bộ mặt: Topbar / Clean (P13) · Sắc: Tinted (P17) */
  /* ===== FONT, KHAI MỘT LẦN, DÙNG CHUNG ===== */
  --app-font: "Inter", ui-sans-serif, system-ui, sans-serif;
  /* ========================================== */

  /* ===== MÀU NHẤN THƯƠNG HIỆU (NỀN SÁNG) ===== */
  --primary: #146834;
  --primary-hover: #1a7a3e;
  --primary-foreground: #ffffff;
  --primary-light: rgba(20, 104, 52, 0.08);
  /* =========================================== */

  /* ===== SẮC PHÂN LOẠI TINTED (P17: chỉ cho ô icon, chấm, thanh) ===== */
  --cat-1: #2563eb;
  --cat-2: #0d9488;
  --cat-3: #7c3aed;
  --cat-4: #c026d3;
  --cat-5: #0284c7;
  --cat-6: #4f46e5;
  /* =================================================================== */

  --background: #f4f4f6;
  --surface: #ffffff;
  --surface-overlay: #ffffff;
  --foreground: #2c2c2c;
  --muted: #707070;

  --border: #f7f7f8;
  --border-strong: #eaeaea;
  --tab-rail: color-mix(in srgb, var(--foreground) 10%, transparent);

  --elevation-card: 0 1px 2px 0 rgb(0 0 0 / 0.04), 0 2px 8px -2px rgb(0 0 0 / 0.06);
  --elevation-popover: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --elevation-modal: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --item-hover: #f4f4f6;
  --chart-fill: var(--primary);
  --secondary: #e7e8ec;
  --secondary-hover: #dbdce2;
  --tab-selected: color-mix(in srgb, var(--foreground) 8%, transparent);
  --background-hover: #e7e7ea;
  --surface-hover: #f8f8fa;

  --button-hover-surface: #f1f1f3;
  --button-hover-page: #e4e4e7;
  --button-hover: var(--button-hover-page);

  --shadow-segment-track: inset 0 0 0 1px rgb(0 0 0 / 0.05), inset 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow-segment-thumb: 0 0 0 1px rgb(0 0 0 / 0.04), 0 1px 2px rgb(0 0 0 / 0.06), 0 2px 6px -2px rgb(0 0 0 / 0.08);

  --ring-focus: rgba(20, 104, 52, 0.12);
  --border-focus: var(--primary);

  --danger: #c70036;
  --danger-bg: rgb(255 32 86 / 0.1);
  --danger-bg-hover: rgb(255 32 86 / 0.15);

  --error: #fb2c36;
  --error-ring: rgb(251 44 54 / 0.1);
  --error-text: #e7000b;
  --error-bg: #fef2f2;
  --error-border: #ffc9c9;
  --error-strong: #c10007;

  --success-bg: #ecfdf5;
  --success: #007a55;
  --warning-bg: #fffbeb;
  --warning: #bb4d00;
  --neutral-bg: #f4f4f5;
  --neutral: #52525c;

  --radius: 0.75rem;
}

.dark,
.force-dark {
  color-scheme: dark;

  /* ===== MÀU NHẤN THƯƠNG HIỆU (VÙNG KHOÁ TỐI .force-dark) ===== */
  --primary: #34d374;
  --primary-hover: #28b862;
  --primary-foreground: #07190e;
  --primary-light: rgba(52, 211, 116, 0.12);
  /* ============================================================ */

  /* ===== SẮC PHÂN LOẠI BẢN TỐI ===== */
  --cat-1: #60a5fa;
  --cat-2: #2dd4bf;
  --cat-3: #a78bfa;
  --cat-4: #e879f9;
  --cat-5: #38bdf8;
  --cat-6: #818cf8;
  /* ================================= */

  --background: #09110d;
  --surface: #0f1a14;
  --surface-overlay: #16241c;
  --foreground: #eaf2ed;
  --muted: #8fa396;

  --border: rgba(168, 204, 182, 0.12);
  --border-strong: rgba(168, 204, 182, 0.16);
  --tab-rail: color-mix(in srgb, var(--foreground) 12%, transparent);

  --elevation-card: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --elevation-popover: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
  --elevation-modal: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.6);

  --item-hover: rgb(255 255 255 / 0.05);
  --chart-fill: color-mix(in srgb, var(--primary) 70%, transparent);
  --secondary: rgb(255 255 255 / 0.08);
  --secondary-hover: rgb(255 255 255 / 0.13);
  --tab-selected: color-mix(in srgb, var(--foreground) 10%, transparent);
  --background-hover: #16241c;
  --surface-hover: #132019;

  --button-hover-surface: rgb(255 255 255 / 0.08);
  --button-hover-page: rgb(255 255 255 / 0.08);
  --button-hover: var(--button-hover-page);

  --shadow-segment-track: inset 0 0 0 1px var(--border), inset 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-segment-thumb: 0 0 0 1px var(--border-strong), inset 0 1px 0 rgb(255 255 255 / 0.06), 0 1px 2px rgb(0 0 0 / 0.5);

  --ring-focus: rgba(52, 211, 116, 0.14);
  --border-focus: rgba(52, 211, 116, 0.45);

  --danger: #ff637e;
  --danger-bg: rgb(255 32 86 / 0.1);
  --danger-bg-hover: rgb(255 32 86 / 0.15);

  --error: #fb2c36;
  --error-ring: rgb(251 44 54 / 0.15);
  --error-text: #ff6467;
  --error-bg: rgb(251 44 54 / 0.1);
  --error-border: rgb(251 44 54 / 0.3);
  --error-strong: #ff6467;

  --success-bg: rgb(0 188 125 / 0.15);
  --success: #00d492;
  --warning-bg: rgb(254 154 0 / 0.15);
  --warning: #ff8904;
  --neutral-bg: rgb(113 113 123 / 0.15);
  --neutral: #9f9fa9;
}

/* Nền rê của nút viền tự đổi theo bề mặt phía sau */
.bg-surface *,
.bg-surface-overlay * {
  --button-hover: var(--button-hover-surface);
}
.bg-surface .bg-background *,
[class~="hover:bg-item-hover"]:hover * {
  --button-hover: var(--button-hover-page);
}

/* Lớp nền trang tĩnh siêu nhẹ cho máy yếu: không filter blur, contain paint để không vẽ lại khi cuộn */
.ivy-ambient-bg {
  contain: strict;
}

/* Ẩn thanh cuộn và làm mờ mép 32px cho hàng chip/tab cuộn ngang (responsive.md sau R10) */
.scrollbar-clean {
  scrollbar-width: none;
}
.scrollbar-clean::-webkit-scrollbar {
  display: none;
}
.hscroll-fade-r {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent);
}
.hscroll-fade-l {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 32px);
  mask-image: linear-gradient(to right, transparent, #000 32px);
}
.hscroll-fade-lr {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 32px, #000 calc(100% - 32px), transparent);
}

/* Hệ thống hiệu ứng mượt 60fps tối ưu cho cả máy cấu hình thấp:
   Chỉ biến đổi opacity & transform 2D/3D nhẹ, không filter blur, không giữ will-change dài hạn */
.ivy-reveal {
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  transition: opacity 460ms cubic-bezier(0.22, 1, 0.36, 1), transform 460ms cubic-bezier(0.22, 1, 0.36, 1);
}
.ivy-reveal.is-visible {
  opacity: 1;
  transform: none;
}

@keyframes ivyPanelFadeIn {
  from {
    opacity: 0.25;
    transform: translate3d(0, 6px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
.ivy-panel-anim {
  animation: ivyPanelFadeIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ivyCardEnter {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale3d(0.985, 0.985, 1);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale3d(1, 1, 1);
  }
}
.ivy-card-enter {
  animation: ivyCardEnter 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Hiệu ứng chữ mọc lần lượt theo từng từ (Hero & Lộ trình) */
@keyframes ivyWordRise {
  from {
    opacity: 0;
    transform: translate3d(0, 13px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
html.ivy-motion-ready .ivy-word-rise {
  display: inline-block;
  opacity: 0;
  animation: ivyWordRise 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--w-idx, 0) * 32ms);
}

/* Hiệu ứng chữ cuộn dọc kiểu bảng điện tử (Live Activity Ticker & Badge) */
@keyframes ivySlotEnter {
  from {
    opacity: 0;
    transform: translate3d(0, 90%, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
html.ivy-motion-ready .ivy-slot-enter {
  display: inline-block;
  animation: ivySlotEnter 360ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Hiệu ứng nảy nhẹ dứt khoát khi con số đếm chạm đích */
@keyframes ivyNumPop {
  0% {
    transform: scale3d(1, 1, 1);
  }
  45% {
    transform: scale3d(1.055, 1.055, 1);
  }
  100% {
    transform: scale3d(1, 1, 1);
  }
}
html.ivy-motion-ready .ivy-num-pop {
  display: inline-block;
  transform-origin: left center;
  animation: ivyNumPop 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ivyIconPop {
  0% {
    transform: scale3d(0.86, 0.86, 1);
  }
  60% {
    transform: scale3d(1.06, 1.06, 1);
  }
  100% {
    transform: scale3d(1, 1, 1);
  }
}
html.ivy-motion-ready .ivy-icon-pop {
  animation: ivyIconPop 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Hiệu ứng hình ảnh: Ken Burns mượt trên Hero + Vệt sáng chéo (Sheen) + Phóng ảnh khóa học */
@keyframes ivyKenBurns {
  from {
    transform: scale3d(1.075, 1.075, 1);
  }
  to {
    transform: scale3d(1, 1, 1);
  }
}
html.ivy-motion-ready .ivy-ken-burns {
  animation: ivyKenBurns 6000ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
html.ivy-motion-ready .ivy-banner-paused .ivy-ken-burns {
  animation-play-state: paused;
}

.ivy-img-sheen {
  position: relative;
  overflow: hidden;
}
html.ivy-motion-ready .ivy-img-sheen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(112deg, transparent 28%, rgba(255, 255, 255, 0.28) 50%, transparent 72%);
  transform: translate3d(-135%, 0, 0);
  transition: transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
html.ivy-motion-ready .group:hover .ivy-img-sheen::after,
html.ivy-motion-ready .ivy-img-sheen:hover::after,
html.ivy-motion-ready .ivy-sheen-burst::after {
  transform: translate3d(135%, 0, 0);
}

html.ivy-motion-ready .ivy-course-img {
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}
html.ivy-motion-ready .group:hover .ivy-course-img {
  transform: scale3d(1.065, 1.065, 1);
}

html.ivy-motion-ready .ivy-lift-card {
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), border-color 200ms ease-out;
}
html.ivy-motion-ready .ivy-lift-card:hover {
  transform: translate3d(0, -4px, 0);
}

html.ivy-motion-ready .ivy-avatar-zoom {
  transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}
html.ivy-motion-ready .group:hover .ivy-avatar-zoom {
  transform: scale3d(1.08, 1.08, 1);
}

html.ivy-motion-ready .ivy-stagger-item {
  animation: ivyCardEnter 380ms cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--stagger-idx, 0) * 55ms);
}

@keyframes ivyFloatGentle {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -4px, 0);
  }
}
html.ivy-motion-ready .ivy-float-gentle {
  animation: ivyFloatGentle 4200ms ease-in-out infinite;
}

@keyframes ivyLivePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
  50% {
    opacity: 0.4;
    transform: scale3d(0.82, 0.82, 1);
  }
}
html.ivy-motion-ready .ivy-live-dot {
  animation: ivyLivePulse 2000ms ease-in-out infinite;
}

@keyframes ivySlideProgress {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
.ivy-progress-run {
  transform-origin: left center;
  animation: ivySlideProgress 6000ms linear forwards;
}
.ivy-banner-paused .ivy-progress-run {
  animation-play-state: paused;
}

.ivy-bar-smooth {
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  .ivy-reveal,
  .ivy-word-rise {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
  .ivy-panel-anim,
  .ivy-card-enter,
  .ivy-slot-enter,
  .ivy-num-pop,
  .ivy-icon-pop,
  .ivy-ken-burns,
  .ivy-stagger-item,
  .ivy-float-gentle,
  .ivy-live-dot,
  .ivy-progress-run {
    animation: none !important;
  }
  .ivy-course-img,
  .ivy-lift-card,
  .ivy-avatar-zoom,
  .ivy-bar-smooth {
    transition: none !important;
  }
}

/* Thanh cuộn tự ẩn 4px (I18) */
* {
  --scrollbar-thumb: transparent;
}
*:hover {
  --scrollbar-thumb: color-mix(in srgb, var(--foreground) 16%, transparent);
}
.is-scrolling {
  --scrollbar-thumb: color-mix(in srgb, var(--foreground) 28%, transparent);
}
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--foreground) 40%, transparent);
}

@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
  }
  *:hover {
    scrollbar-color: color-mix(in srgb, var(--foreground) 18%, transparent) transparent;
  }
  .is-scrolling {
    scrollbar-color: color-mix(in srgb, var(--foreground) 28%, transparent) transparent;
  }
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === ADMIN SHELL & OVERLAY MOTION START === */
/* N11: dịch đúng 100% bề rộng khung để panel điều hướng/chi tiết trượt mượt từ mép màn theo overlay.md */
.ivy-drawer-left {
  transform: translate3d(-100%, 0, 0);
  transition: transform 350ms cubic-bezier(0.32, 0.72, 0, 1);
}
.ivy-drawer-left[data-open="true"] {
  transform: translate3d(0, 0, 0);
  transition-duration: 500ms;
}
.ivy-drawer-right {
  transform: translate3d(100%, 0, 0);
  transition: transform 350ms cubic-bezier(0.32, 0.72, 0, 1);
}
.ivy-drawer-right[data-open="true"] {
  transform: translate3d(0, 0, 0);
  transition-duration: 500ms;
}
.ivy-backdrop {
  opacity: 0;
  transition: opacity 350ms cubic-bezier(0.32, 0.72, 0, 1);
}
.ivy-backdrop[data-open="true"] {
  opacity: 1;
  transition-duration: 500ms;
}
.ivy-modal-backdrop {
  opacity: 0;
  transition: opacity 100ms ease-in;
}
.ivy-modal-backdrop[data-open="true"] {
  opacity: 1;
  transition: opacity 150ms ease-out;
}
.ivy-modal-panel {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 100ms ease-in, transform 100ms ease-in;
}
.ivy-modal-panel[data-open="true"] {
  opacity: 1;
  transform: scale(1);
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}
/* N11: dịch 4px về phía nút mở cho popover/dropdown/select theo bảng Chuyển động overlay.md */
.ivy-popover-panel {
  opacity: 0;
  transform: translate3d(0, -4px, 0) scale(0.96);
  transition: opacity 100ms ease-in, transform 100ms ease-in;
}
.ivy-popover-panel[data-side="top"] {
  transform: translate3d(0, 4px, 0) scale(0.96);
}
.ivy-popover-panel[data-open="true"] {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  transition: opacity 150ms ease-out, transform 150ms ease-out;
}
/* N11: trượt hết chiều cao toast từ đáy ở màn rộng và từ đỉnh ở màn hẹp dưới 640px theo overlay.md */
.ivy-toast-item {
  opacity: 0;
  transform: translate3d(0, 100%, 0);
  transition: opacity 200ms ease-in, transform 200ms ease-in;
}
@media (max-width: 639px) {
  .ivy-toast-item {
    transform: translate3d(0, -100%, 0);
  }
}
.ivy-toast-item[data-open="true"] {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition: opacity 300ms ease-out, transform 300ms ease-out;
}
/* N11: mở rộng vùng chạm công tắc 24px lên 40px cho ngón tay theo choice-controls.md */
.ivy-switch-hit::before {
  content: "";
  position: absolute;
  inset: -8px;
}
.ivy-sidebar-scroll {
  --fade-top: 0px;
  --fade-bottom: 0px;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent);
}
@media (prefers-reduced-motion: reduce) {
  .ivy-drawer-left,
  .ivy-drawer-right,
  .ivy-modal-panel,
  .ivy-popover-panel,
  .ivy-toast-item {
    transition-duration: 0.01ms !important;
  }
}
/* === ADMIN SHELL & OVERLAY MOTION END === */
