/* ============================================================
   LMS — UX ENHANCEMENT STYLES v2.0
   ============================================================ */

/* ============================================================
   1. TOP PROGRESS BAR
   ============================================================ */
#ux-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 99999;
  pointer-events: none;
}
#ux-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7c3aed, #a855f7, #60a5fa);
  background-size: 200% 100%;
  animation: ux-progress-shimmer 1.4s linear infinite;
  transition: width 0.25s ease;
  box-shadow: 0 0 12px rgba(139,92,246,0.8);
  border-radius: 0 99px 99px 0;
}
@keyframes ux-progress-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============================================================
   2. TOAST NOTIFICATIONS
   ============================================================ */
#ux-toasts {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99990;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 380px;
  width: calc(100vw - 40px);
}

.ux-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 18px;
  border-radius: 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
  pointer-events: all;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateX(120%);
  transition: opacity 0.35s cubic-bezier(0.16,1,0.3,1), transform 0.35s cubic-bezier(0.16,1,0.3,1);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: 'Inter', 'Plus Jakarta Sans', sans-serif;
  will-change: transform, opacity;
}
.ux-toast.ux-toast-show {
  opacity: 1;
  transform: translateX(0);
}
.ux-toast.ux-toast-hide {
  opacity: 0;
  transform: translateX(120%);
}

.ux-toast-success { background: rgba(6, 25, 18, 0.92); color: #34d399; }
.ux-toast-error   { background: rgba(25, 6, 6, 0.92);  color: #f87171; }
.ux-toast-info    { background: rgba(6, 18, 35, 0.92);  color: #93c5fd; }
.ux-toast-warning { background: rgba(25, 18, 4, 0.92);  color: #fbbf24; }

.ux-toast-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1;
}
.ux-toast-success .ux-toast-icon { color: #10b981; }
.ux-toast-error   .ux-toast-icon { color: #ef4444; }
.ux-toast-info    .ux-toast-icon { color: #3b82f6; }
.ux-toast-warning .ux-toast-icon { color: #f59e0b; }

.ux-toast-body { flex: 1; line-height: 1.45; }

.ux-toast-close {
  background: none;
  border: none;
  color: currentColor;
  opacity: 0.5;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.ux-toast-close:hover { opacity: 1; }

.ux-toast-progress {
  position: absolute;
  bottom: 0; left: 0;
  height: 3px;
  width: 100%;
  border-radius: 0 0 14px 14px;
  transition: width 4000ms linear;
}
.ux-toast-success .ux-toast-progress { background: #10b981; }
.ux-toast-error   .ux-toast-progress { background: #ef4444; }
.ux-toast-info    .ux-toast-progress { background: #3b82f6; }
.ux-toast-warning .ux-toast-progress { background: #f59e0b; }

/* ============================================================
   3. BUTTON RIPPLE
   ============================================================ */
.ux-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  transform: scale(0);
  animation: ux-ripple-anim 0.6s linear;
  pointer-events: none;
}
@keyframes ux-ripple-anim {
  to { transform: scale(2.5); opacity: 0; }
}

/* ============================================================
   4. SCROLL-TO-TOP BUTTON
   ============================================================ */
#ux-scroll-top {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 4px 20px rgba(124,58,237,0.5);
  opacity: 0;
  transform: translateY(16px) scale(0.8);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16,1,0.3,1);
  z-index: 9990;
  pointer-events: none;
}
#ux-scroll-top.ux-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
#ux-scroll-top:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 8px 28px rgba(124,58,237,0.7);
}
#ux-scroll-top:active { transform: translateY(0) scale(0.95); }

/* ============================================================
   5. FORM INPUT STATES
   ============================================================ */
.form-group.ux-focused .form-label {
  color: var(--accent-light, #a78bfa);
}
.form-group.ux-valid .form-control {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12) !important;
}
.form-group.ux-valid::after {
  content: '';
}
.form-group.ux-invalid .form-control {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12) !important;
}

/* Input group icon wrapper */
.form-group {
  position: relative;
  transition: margin 0.2s;
}

/* Character counter */
.ux-char-count {
  font-size: 0.78rem;
  text-align: right;
  color: #64748b;
  margin-top: 4px;
  transition: color 0.2s;
}
.ux-char-count.ux-char-warn { color: #f59e0b; }
.ux-char-count.ux-char-over { color: #ef4444; font-weight: 600; }

/* ============================================================
   6. CUSTOM CONFIRM DIALOG
   ============================================================ */
.ux-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99995;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 20px;
}
.ux-confirm-overlay.ux-confirm-open { opacity: 1; }

.ux-confirm-box {
  background: #0f0f1a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05);
  transform: scale(0.92) translateY(12px);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  animation: ux-confirm-in 0.3s cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes ux-confirm-in {
  from { transform: scale(0.88) translateY(20px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.ux-confirm-icon {
  font-size: 2.4rem;
  color: #f59e0b;
  margin-bottom: 16px;
  animation: ux-pulse 2s ease infinite;
}
@keyframes ux-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

.ux-confirm-box h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.ux-confirm-box p {
  font-size: 0.9rem;
  color: #94a3b8;
  margin-bottom: 28px;
  line-height: 1.6;
}
.ux-confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.ux-confirm-actions .btn { min-width: 110px; }

/* ============================================================
   7. TOOLTIP
   ============================================================ */
#ux-tooltip {
  position: fixed;
  background: rgba(15,15,26,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  pointer-events: none;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  max-width: 220px;
  white-space: normal;
}
#ux-tooltip.ux-tooltip-show { opacity: 1; }

/* ============================================================
   8. HAMBURGER X ANIMATION
   ============================================================ */
.hamburger.is-open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.hamburger.is-open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================================
   9. SMOOTH IMAGE FADE — already handled in JS, just enforce
   ============================================================ */
img { transition: opacity 0.4s ease; }

/* ============================================================
   10. GLOBAL FOCUS RING (Accessibility)
   ============================================================ */
*:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============================================================
   11. SKELETON PULSE ANIMATION (improved)
   ============================================================ */
.skeleton {
  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: ux-skeleton 1.6s ease-in-out infinite;
  border-radius: 8px;
}
@keyframes ux-skeleton {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============================================================
   12. PAGE-LEVEL FADE IN
   ============================================================ */
html {
  scroll-behavior: smooth;
}

/* ============================================================
   13. LOADING SPINNER BUTTON STATE
   ============================================================ */
.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.65;
}

/* ============================================================
   14. BETTER SCROLLBARS (webkit)
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,0.3);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.55); }

/* ============================================================
   15. SELECTION COLOR
   ============================================================ */
::selection {
  background: rgba(124,58,237,0.35);
  color: #fff;
}

/* ============================================================
   16. STAT CARD HOVER
   ============================================================ */
.stat-card {
  transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px -10px rgba(0,0,0,0.5), 0 0 0 1px rgba(139,92,246,0.2);
  border-color: rgba(139,92,246,0.3) !important;
}

/* ============================================================
   17. TABLE ROW HOVER ANIMATION
   ============================================================ */
.data-table tbody tr {
  transition: background 0.15s ease;
}
.data-table tbody tr:hover {
  background: rgba(139,92,246,0.06) !important;
}

/* ============================================================
   18. COURSE CARD SHIMMER BORDER ON HOVER
   ============================================================ */
.course-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, transparent 40%, rgba(139,92,246,0.5) 100%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 0;
}
.course-card:hover::before { opacity: 1; }
.course-card > * { position: relative; z-index: 1; }

/* ============================================================
   19. FLASH MESSAGE DISMISS BUTTON
   ============================================================ */
.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity 0.2s;
}
.flash-close:hover { opacity: 1; }

/* ============================================================
   20. INPUT ICON LEFT PADDING HELPER
   ============================================================ */
.input-icon-wrap {
  position: relative;
}
.input-icon-wrap .form-control { padding-left: 44px; }
.input-icon-wrap .input-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  pointer-events: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}
.input-icon-wrap:focus-within .input-icon { color: #a78bfa; }

/* ============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================ */
@media (max-width: 480px) {
  #ux-toasts { top: 12px; right: 12px; }
  #ux-scroll-top { bottom: 20px; right: 16px; }
  .ux-confirm-box { padding: 28px 20px; }
  .ux-confirm-actions { flex-direction: column; }
  .ux-confirm-actions .btn { width: 100%; justify-content: center; }
}
