/*
 * LOLASMM Premium UI Polish
 * Version: 1.0.0 — 2026-06-13
 *
 * Subtle animations, hover effects, and modern SaaS visual polish.
 * Loaded AFTER lolasmm-responsive.css.
 * Performance-safe: uses GPU-accelerated properties only (transform, opacity).
 * Respects prefers-reduced-motion (inherited from responsive.css).
 */

/* ============================================================
   1. DESIGN TOKENS — PREMIUM PALETTE
   ============================================================ */
:root {
  /* Premium accent colors */
  --premium-primary: #4f46e5;
  --premium-primary-hover: #4338ca;
  --premium-primary-light: rgba(79, 70, 229, 0.08);
  --premium-primary-glow: rgba(79, 70, 229, 0.25);

  /* Surfaces */
  --premium-surface: #ffffff;
  --premium-surface-hover: #f8fafc;
  --premium-surface-border: rgba(0, 0, 0, 0.06);

  /* Shadows (elevation system) */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);

  /* Timing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark mode tokens */
body.dark {
  --premium-surface: #1a1d2e;
  --premium-surface-hover: #1f2337;
  --premium-surface-border: rgba(255, 255, 255, 0.06);
  --premium-primary-light: rgba(79, 70, 229, 0.15);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* ============================================================
   2. BUTTONS — PREMIUM HOVER & ACTIVE STATES
   ============================================================ */

.btn {
  position: relative;
  transition: all 0.2s var(--ease-out-expo);
  overflow: hidden;
}

/* Lift effect on hover */
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0px) scale(0.98);
  box-shadow: var(--shadow-xs);
  transition-duration: 0.1s;
}

/* Primary button glow */
.btn-primary,
.btn-info {
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.btn-info:hover {
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

/* Ripple effect */
.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
  opacity: 0;
  pointer-events: none;
}

.btn:active::after {
  width: 200px;
  height: 200px;
  opacity: 0;
}

/* Ghost/outline buttons */
.btn-default:hover,
.btn-outline-primary:hover,
.btn-outline-secondary:hover {
  background-color: var(--premium-primary-light);
}

/* ============================================================
   3. CARDS — ELEVATION & HOVER
   ============================================================ */

.d-card,
.card,
.panel {
  transition: box-shadow 0.25s var(--ease-out-expo), transform 0.25s var(--ease-out-expo);
  border: 1px solid var(--premium-surface-border);
  box-shadow: var(--shadow-sm);
  /* Do NOT add overflow:hidden here — it breaks position:sticky on inner table headers */
}

.d-card:hover,
.card:hover {
  box-shadow: var(--shadow-md);
}

/* Cards that explicitly need clipping (e.g. rounded image overflow) should add this class */
.card--clip { overflow: hidden; }

/* Dashboard stat cards — interactive lift */
.dhs-item {
  transition: transform 0.25s var(--ease-out-expo), box-shadow 0.25s var(--ease-out-expo);
  cursor: default;
}

.dhs-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* Card header subtle accent */
.d-card-head {
  border-bottom: 1px solid var(--premium-surface-border);
  position: relative;
}

.d-card-head::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--premium-primary);
  border-radius: 1px;
  transition: width 0.3s var(--ease-out-expo);
}

.d-card:hover .d-card-head::after {
  width: 60px;
}

/* ============================================================
   4. SIDEBAR — SMOOTH MENU INTERACTIONS
   ============================================================ */

.sidebar-menu li a.menu-link {
  transition: all 0.2s var(--ease-out-expo);
  position: relative;
  border-radius: var(--radius-sm);
  margin: 2px 8px;
}

.sidebar-menu li a.menu-link:hover {
  background: var(--premium-primary-light);
  transform: translateX(3px);
}

.sidebar-menu li a.menu-link.active {
  background: var(--premium-primary-light);
  color: var(--premium-primary);
}

/* Active indicator bar */
.sidebar-menu li a.menu-link.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--premium-primary);
  border-radius: 0 3px 3px 0;
}

/* Menu icon subtle animation */
.sidebar-menu li a.menu-link .menu-icon {
  transition: transform 0.2s var(--ease-spring);
}

.sidebar-menu li a.menu-link:hover .menu-icon {
  transform: scale(1.1);
}

/* ============================================================
   5. TABLES — ROW HOVER & POLISH
   ============================================================ */

.table > tbody > tr {
  transition: background-color 0.15s ease;
}

.table > tbody > tr:hover {
  background-color: var(--premium-primary-light) !important;
}

.table > thead > tr > th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  color: #64748b;
  border-bottom-width: 2px;
}

body.dark .table > thead > tr > th {
  color: #94a3b8;
}

/* ============================================================
   6. FORM INPUTS — FOCUS GLOW
   ============================================================ */

.form-control {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--premium-surface-border);
}

.form-control:focus {
  border-color: var(--premium-primary) !important;
  box-shadow: 0 0 0 3px var(--premium-primary-glow) !important;
  outline: none !important;
}

/* Select dropdowns */
select.form-control:hover,
.form-select:hover {
  border-color: #94a3b8;
}

/* Textarea auto-resize visual hint */
textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* ============================================================
   7. ALERTS & NOTIFICATIONS — ENTRANCE ANIMATION
   ============================================================ */

.alert {
  animation: alertSlideIn 0.3s var(--ease-out-expo);
  border: none;
  border-left: 4px solid;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

@keyframes alertSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-success { border-left-color: #10b981; }
.alert-danger  { border-left-color: #ef4444; }
.alert-warning { border-left-color: #f59e0b; }
.alert-info    { border-left-color: #3b82f6; }

/* ============================================================
   8. MODALS — SMOOTH ENTRANCE
   ============================================================ */

.modal.fade .modal-dialog {
  transition: transform 0.3s var(--ease-out-expo), opacity 0.3s ease;
  transform: translateY(-20px) scale(0.97);
}

.modal.fade.in .modal-dialog,
.modal.fade.show .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-content {
  border: none;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid var(--premium-surface-border);
}

.modal-footer {
  border-top: 1px solid var(--premium-surface-border);
}

/* ============================================================
   9. BADGES & LABELS — SUBTLE POLISH
   ============================================================ */

.badge,
.label {
  font-weight: 500;
  letter-spacing: 0.3px;
  padding: 4px 8px;
  border-radius: 20px;
  transition: transform 0.15s ease;
}

.badge:hover,
.label:hover {
  transform: scale(1.05);
}

/* Status badges — softer colors */
.badge-success, .label-success { background: #dcfce7 !important; color: #166534 !important; }
.badge-danger,  .label-danger  { background: #fee2e2 !important; color: #991b1b !important; }
.badge-warning, .label-warning { background: #fef3c7 !important; color: #92400e !important; }
.badge-info,    .label-info    { background: #dbeafe !important; color: #1e40af !important; }
.badge-default, .label-default { background: #f1f5f9 !important; color: #475569 !important; }

body.dark .badge-success, body.dark .label-success { background: rgba(16, 185, 129, 0.15) !important; color: #6ee7b7 !important; }
body.dark .badge-danger,  body.dark .label-danger  { background: rgba(239, 68, 68, 0.15) !important; color: #fca5a5 !important; }
body.dark .badge-warning, body.dark .label-warning { background: rgba(245, 158, 11, 0.15) !important; color: #fcd34d !important; }
body.dark .badge-info,    body.dark .label-info    { background: rgba(59, 130, 246, 0.15) !important; color: #93c5fd !important; }
body.dark .badge-default, body.dark .label-default { background: rgba(100, 116, 139, 0.15) !important; color: #cbd5e1 !important; }

/* ============================================================
   10. LINKS & NAVIGATION — UNDERLINE ANIMATION
   ============================================================ */

/* Animated underline for nav links */
.sidebar-menu li a.menu-link::after {
  content: none; /* Sidebar uses left bar instead */
}

/* Header nav links */
.app-header .navbar-nav > li > a {
  position: relative;
  transition: color 0.2s ease;
}

/* ============================================================
   11. DROPDOWN MENUS — SMOOTH OPEN
   ============================================================ */

.dropdown-menu {
  animation: dropdownFadeIn 0.2s var(--ease-out-expo);
  border: 1px solid var(--premium-surface-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-menu > li > a {
  border-radius: 4px;
  padding: 8px 12px;
  transition: background-color 0.15s ease;
}

.dropdown-menu > li > a:hover {
  background-color: var(--premium-primary-light);
}

/* ============================================================
   12. TOOLTIPS — SMOOTH
   ============================================================ */

.tooltip {
  animation: tooltipFadeIn 0.15s ease;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* ============================================================
   13. PROGRESS BARS — ANIMATED FILL
   ============================================================ */

.progress-bar {
  position: relative; /* Required for ::after shimmer to position correctly */
  transition: width 0.6s var(--ease-out-expo);
  background: linear-gradient(90deg, var(--premium-primary), var(--premium-primary-hover));
  overflow: hidden; /* Clip shimmer to bar bounds */
}

/* Subtle shimmer on progress */
.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );
  animation: progressShimmer 2s infinite;
}

@keyframes progressShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================================
   14. SCROLLBAR — PREMIUM THIN STYLE
   ============================================================ */

/* Webkit scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

body.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

body.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

body.dark * {
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* ============================================================
   15. LOGIN PAGE — CENTERED & POLISHED
   ============================================================ */

/* Center login forms */
.login-page,
.signup-page,
.forgot-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-page .login-box,
.login-page .card,
.login-page .panel {
  animation: loginFadeIn 0.5s var(--ease-out-expo);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
  max-width: 420px;
  width: 100%;
}

@keyframes loginFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ============================================================
   16. PAGINATION — MODERN STYLE
   ============================================================ */

.pagination > li > a,
.pagination > li > span {
  border-radius: var(--radius-sm) !important;
  margin: 0 2px;
  border: 1px solid var(--premium-surface-border);
  transition: all 0.15s ease;
}

.pagination > li > a:hover {
  background: var(--premium-primary-light);
  border-color: var(--premium-primary);
  color: var(--premium-primary);
  transform: translateY(-1px);
}

.pagination > .active > a,
.pagination > .active > span {
  background: var(--premium-primary) !important;
  border-color: var(--premium-primary) !important;
}

/* ============================================================
   17. LOADING SPINNER — PREMIUM
   ============================================================ */

.loading-spinner,
.fa-spinner,
.fa-spin {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   18. SMOOTH TRANSITIONS — GLOBAL
   ============================================================ */

/* Smooth color transitions on interactive elements */
a,
.nav-link,
.list-group-item {
  transition: color 0.15s ease, background-color 0.15s ease;
}

/* Image hover zoom (for service icons, avatars) */
.img-thumbnail:hover,
.avatar:hover {
  transform: scale(1.05);
  transition: transform 0.2s var(--ease-spring);
}

/* ============================================================
   19. TEXT READABILITY FIXES
   ============================================================ */

/* Ensure text is always readable */
.text-muted {
  opacity: 0.7;
}

/* Fix invisible text on dark backgrounds */
body.dark .text-muted {
  color: #94a3b8 !important;
}

body.dark .form-control {
  background: #1e2235;
  border-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

body.dark .form-control::placeholder {
  color: #64748b;
}

/* ============================================================
   20. REDUCED MOTION — OVERRIDE ALL ANIMATIONS
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  /* Disable all transforms on interactive elements */
  .btn:hover,
  .dhs-item:hover,
  .badge:hover,
  .label:hover,
  .pagination > li > a:hover,
  .img-thumbnail:hover,
  .avatar:hover,
  .sidebar-menu li a.menu-link:hover,
  .sidebar-menu li a.menu-link .menu-icon,
  .d-card:hover,
  .card:hover {
    transform: none !important;
  }

  /* Disable all entrance/keyframe animations */
  .alert,
  .modal.fade .modal-dialog,
  .dropdown-menu,
  .tooltip,
  .login-page .login-box,
  .login-page .card,
  .login-page .panel,
  .progress-bar::after,
  .skeleton {
    animation: none !important;
  }

  /* Disable transitions on decorative elements */
  .d-card-head::after,
  .d-card,
  .card,
  .panel,
  .form-control,
  .btn {
    transition: none !important;
  }
}
