/* ============================================================
   ENHANCEMENTS.CSS – Premium UI Upgrades với GSAP support
   ============================================================ */

/* ── Initial hidden states (GSAP will reveal these) ──────── */
.gsap-hidden {
  opacity: 0;
  visibility: hidden;
}

/* ── Glassmorphism upgrade ───────────────────────────────── */
.glass {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ── Gradient border cards ───────────────────────────────── */
.gradient-border {
  position: relative;
  border-radius: var(--radius-xl);
  background: var(--bg-card);
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: calc(var(--radius-xl) + 2px);
  background: linear-gradient(135deg, var(--primary-400), var(--accent-500), #a78bfa);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-base);
}

.gradient-border:hover::before { opacity: 1; }

/* ── Magnetic button effect ──────────────────────────────── */
.btn-magnetic {
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast);
}

.btn-magnetic::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,.2), transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn-magnetic:hover::after { opacity: 1; }

/* ── Text gradient shimmer ───────────────────────────────── */
.text-shimmer {
  background: linear-gradient(
    90deg,
    #fff 0%,
    var(--accent-300) 40%,
    #fff 60%,
    var(--accent-300) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 4s linear infinite;
}

@keyframes shimmer {
  from { background-position: 0% center; }
  to   { background-position: 200% center; }
}

/* ── Noise texture overlay ───────────────────────────────── */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

/* ── Animated gradient mesh background ───────────────────── */
.mesh-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.mesh-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  mix-blend-mode: screen;
  animation: orbFloat 12s ease-in-out infinite;
}

.mesh-orb:nth-child(1) {
  width: 500px; height: 500px;
  background: rgba(59, 109, 232, 0.25);
  top: -100px; left: -100px;
  animation-delay: 0s;
}

.mesh-orb:nth-child(2) {
  width: 400px; height: 400px;
  background: rgba(6, 182, 212, 0.2);
  top: 20%; right: -50px;
  animation-delay: 4s;
}

.mesh-orb:nth-child(3) {
  width: 300px; height: 300px;
  background: rgba(167, 139, 250, 0.18);
  bottom: 0; left: 30%;
  animation-delay: 8s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -20px) scale(1.05); }
  66%  { transform: translate(-20px, 30px) scale(0.95); }
}

/* ── Cursor glow (landing only) ──────────────────────────── */
.cursor-glow {
  position: fixed;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,109,232,.08) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.15s ease;
}

/* ── Number counter animation target ─────────────────────── */
.counter { display: inline-block; }

/* ── Scroll progress indicator ───────────────────────────── */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
  z-index: 9999;
  transform-origin: left;
  transform: scaleX(0);
  border-radius: 0 2px 2px 0;
}

/* ── Feature card upgrade ────────────────────────────────── */
.feature-card {
  position: relative;
  overflow: hidden;
}

.feature-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-400), var(--accent-500));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
}

.feature-card:hover::after { transform: scaleX(1); }

/* ── Achievement row hover ───────────────────────────────── */
.achievement-row {
  border-radius: var(--radius-lg);
  padding-left: var(--space-3);
  padding-right: var(--space-3);
  margin-left: calc(-1 * var(--space-3));
  margin-right: calc(-1 * var(--space-3));
  transition: background var(--transition-fast);
}

.achievement-row:hover {
  background: var(--primary-50);
  border-bottom-color: transparent;
}

/* ── Score row animated fill ────────────────────────────── */
.score-row {
  position: relative;
  overflow: hidden;
}

.score-row::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: rgba(255,255,255,.04);
  transition: width 1s ease;
}

/* ── Stats bar counter ───────────────────────────────────── */
.stats-bar-container .stat-item-val {
  transition: all var(--transition-base);
}

/* ── Teacher card entrance ───────────────────────────────── */
.teacher-card {
  position: relative;
}

.teacher-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: calc(var(--radius-2xl) + 2px);
  background: linear-gradient(135deg, rgba(59,109,232,.4), rgba(6,182,212,.3), rgba(167,139,250,.4));
  z-index: -1;
  filter: blur(8px);
  opacity: 0.6;
  animation: cardGlow 4s ease-in-out infinite alternate;
}

@keyframes cardGlow {
  from { opacity: 0.4; filter: blur(6px); }
  to   { opacity: 0.8; filter: blur(12px); }
}

/* ── Nav link underline animation ───────────────────────── */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: var(--primary-500);
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

.nav-link:hover::after { width: 100%; }

/* ── Course card shine effect ────────────────────────────── */
.course-card {
  position: relative;
  overflow: hidden;
}

.course-card::before {
  content: '';
  position: absolute;
  top: -100%; left: -100%;
  width: 60%;
  height: 200%;
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(255,255,255,.08) 50%,
    transparent 70%
  );
  transition: none;
  z-index: 1;
  pointer-events: none;
}

.course-card:hover::before {
  animation: cardShine 0.6s ease forwards;
}

@keyframes cardShine {
  to { left: 160%; }
}

/* ── Countdown box pulse on seconds ─────────────────────── */
.countdown-flash {
  animation: cdFlash 0.15s ease;
}

@keyframes cdFlash {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ── Week day hover ─────────────────────────────────────── */
.week-day {
  position: relative;
  overflow: hidden;
}

.week-day::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  opacity: 0;
  border-radius: inherit;
  transition: opacity var(--transition-fast);
  z-index: -1;
}

/* ── File item highlight on hover ───────────────────────── */
.file-item {
  transition: all var(--transition-fast), border-left-color var(--transition-fast);
}

/* ── Sidebar item entrance ───────────────────────────────── */
.sidebar-nav .nav-item {
  opacity: 1;
  transform: none;
}

/* ── Page transition overlay ─────────────────────────────── */
.page-transition {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--primary-900), var(--primary-700));
  z-index: 99999;
  transform: translateY(100%);
  pointer-events: none;
}

/* ── Floating particles (landing) ────────────────────────── */
.particles-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,.4);
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-20px) scale(1.5); opacity: 0; }
}

/* ── Dashboard card stagger targets ──────────────────────── */
.dash-reveal {
  will-change: transform, opacity;
}

/* ── Active course card ──────────────────────────────────── */
.course-card.highlighted {
  border-color: var(--primary-300);
  box-shadow: 0 0 0 3px rgba(36,81,209,.12), var(--shadow-card-hover);
}

/* ── TOC item transition ─────────────────────────────────── */
.file-item.entering {
  animation: fileItemIn 0.3s ease forwards;
}

@keyframes fileItemIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Progress fill animated ──────────────────────────────── */
.progress-fill {
  transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Topbar refined ──────────────────────────────────────── */
.topbar {
  border-bottom: 1px solid rgba(36,81,209,.08);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(12px);
}

/* ── Register form inputs upgraded ──────────────────────── */
.register-form .form-input:focus + .input-highlight,
.form-input:focus + .input-highlight {
  transform: scaleX(1);
}

.input-wrap { position: relative; }

.input-highlight {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-500), var(--primary-400));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-base);
  border-radius: var(--radius-full);
}

/* ── Mobile hamburger animation ──────────────────────────── */
@media (max-width: 768px) {
  .landing-nav { padding: 0 var(--space-5); }
  .hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: var(--space-2);
  }
  .hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--gray-700);
    border-radius: 2px;
    transition: all var(--transition-base);
  }
  .hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
  .hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
  .hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

  .mobile-menu {
    position: fixed;
    inset: 68px 0 0;
    background: rgba(255,255,255,.98);
    backdrop-filter: blur(20px);
    z-index: 199;
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    transform: translateY(-100%);
    opacity: 0;
    transition: all var(--transition-base);
  }
  .mobile-menu.open { transform: translateY(0); opacity: 1; }
  .mobile-menu .nav-link { font-size: var(--font-size-lg); font-weight: 600; color: var(--gray-800); }
}
