/* ==========================================================
   Premium Polish — WOW Phase 3 Final
   Global micro-refinements for 9/10 premium feel.
   Scrollbars, focus rings, sidebar animations, smooth scroll.
   ========================================================== */

/* ---- 1. Custom Scrollbar (Webkit + Firefox) ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

/* Light mode scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb,
html.theme-light ::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  border: 2px solid transparent;
  background-clip: padding-box;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover,
html.theme-light ::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.4);
  border: 2px solid transparent;
  background-clip: padding-box;
}

[data-theme="light"] *,
html.theme-light * {
  scrollbar-color: rgba(100, 116, 139, 0.25) transparent;
}

/* ---- 2. Premium Focus Ring (Gold) ---- */
:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.6);
  outline-offset: 2px;
  border-radius: 4px;
  transition: outline-offset 0.15s ease;
}

/* Button focus ring */
.btn:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.7);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

/* Input focus ring */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.5);
  outline-offset: 0;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

/* Link focus ring */
a:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.5);
  outline-offset: 2px;
  text-decoration-color: rgba(212, 175, 55, 0.6);
}

/* ---- 3. Smooth Scroll Behavior ---- */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---- 4. Sidebar Nav Item Micro-Animations ---- */
.tenant-sidebar .nav-link {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.tenant-sidebar .nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) scaleY(0);
  width: 3px;
  height: 60%;
  background: linear-gradient(180deg, #d4af37, #f0d060);
  border-radius: 0 3px 3px 0;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tenant-sidebar .nav-link:hover::before,
.tenant-sidebar .nav-link.active::before {
  transform: translateY(-50%) scaleY(1);
}

.tenant-sidebar .nav-link:hover {
  padding-left: calc(var(--sidebar-link-pl, 1rem) + 4px);
  color: #d4af37;
}

.tenant-sidebar .nav-link:hover i {
  transform: scale(1.15);
  transition: transform 0.2s ease;
}

.tenant-sidebar .nav-link.active {
  color: #d4af37;
  font-weight: 600;
}

/* ---- 5. Premium Table Row Hover ---- */
.premium-table tbody tr {
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.premium-table tbody tr:hover {
  background-color: rgba(212, 175, 55, 0.04);
  transform: scale(1.002);
}

[data-theme="light"] .premium-table tbody tr:hover,
html.theme-light .premium-table tbody tr:hover {
  background-color: rgba(212, 175, 55, 0.06);
}

/* ---- 6. Card Glass Shine on Hover ---- */
.card {
  position: relative;
  overflow: hidden;
}

.card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(255, 255, 255, 0.03) 45%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0.03) 55%,
    transparent 60%
  );
  transform: translateX(-100%) translateY(-100%);
  transition: none;
  pointer-events: none;
  z-index: 1;
}

.card:hover::after {
  animation: card-shine 0.6s ease forwards;
}

@keyframes card-shine {
  to {
    transform: translateX(50%) translateY(50%);
  }
}

[data-theme="light"] .card::after,
html.theme-light .card::after {
  background: linear-gradient(
    45deg,
    transparent 40%,
    rgba(212, 175, 55, 0.02) 45%,
    rgba(212, 175, 55, 0.04) 50%,
    rgba(212, 175, 55, 0.02) 55%,
    transparent 60%
  );
}

/* ---- 7. Badge Pulse (notification badges) ---- */
.badge-pulse {
  position: relative;
}

.badge-pulse::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: inherit;
  opacity: 0;
  z-index: -1;
  animation: badge-pulse-anim 2s ease-in-out infinite;
}

@keyframes badge-pulse-anim {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.4); }
}

/* ---- 8. Image Hover Zoom (gallery, avatars) ---- */
.img-hover-zoom {
  overflow: hidden;
  border-radius: inherit;
}

.img-hover-zoom img {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.img-hover-zoom:hover img {
  transform: scale(1.08);
}

/* ---- 9. Selection Color (brand-aligned) ---- */
::selection {
  background-color: rgba(212, 175, 55, 0.25);
  color: inherit;
}

::-moz-selection {
  background-color: rgba(212, 175, 55, 0.25);
  color: inherit;
}

/* ---- Reduced Motion: Disable everything ---- */
@media (prefers-reduced-motion: reduce) {
  .tenant-sidebar .nav-link::before,
  .card::after,
  .badge-pulse::after {
    animation: none !important;
    transition: none !important;
  }
  .premium-table tbody tr,
  .img-hover-zoom img {
    transition: none !important;
    transform: none !important;
  }
}
