/* ==========================================================================
   PIYSCHOOL ULTRA-DELIGHT MICRO-INTERACTIONS ENGINE
   Hardware-Accelerated Tactile Springs, 3D Hover Lifts, & Interactive Physics
   ========================================================================== */

/* 1. Universal Tactile Click (Scale Press) */
button:not(:disabled),
.btn:not(:disabled),
a[role="button"],
input[type="submit"]:not(:disabled),
input[type="button"]:not(:disabled),
.interactive-click,
.clickable-item {
    transition: transform 0.16s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
                background-color 0.2s ease, 
                border-color 0.2s ease !important;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

button:not(:disabled):active,
.btn:not(:disabled):active,
a[role="button"]:active,
input[type="submit"]:not(:disabled):active,
input[type="button"]:not(:disabled):active,
.interactive-click:active,
.clickable-item:active {
    transform: scale(0.96) !important;
}

/* Micro Hover Lift for Buttons */
button:not(:disabled):hover:not(:active),
.btn:not(:disabled):hover:not(:active),
a[role="button"]:hover:not(:active) {
    transform: translateY(-1px);
}

/* 2. Universal Click Ripple Effect */
.piy-ripple-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
    border-radius: inherit;
    z-index: 10;
}

.piy-ripple-wave {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: piyRippleAnim 0.6s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.1) 70%, transparent 100%);
    pointer-events: none;
}

/* Darker ripple on light buttons */
.btn-light .piy-ripple-wave,
button.bg-white .piy-ripple-wave,
button.bg-slate-50 .piy-ripple-wave,
button.bg-slate-100 .piy-ripple-wave,
a.bg-white .piy-ripple-wave,
a.bg-slate-50 .piy-ripple-wave {
    background: radial-gradient(circle, rgba(30, 58, 138, 0.25) 0%, rgba(30, 58, 138, 0.05) 70%, transparent 100%);
}

@keyframes piyRippleAnim {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }
    100% {
        transform: scale(3.5);
        opacity: 0;
    }
}

/* 3. Card & Stat Widget Hover Lift */
.hover-lift,
.card,
.stat-card,
.dashboard-widget,
.interactive-card {
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.25s ease !important;
    will-change: transform, box-shadow;
}

.hover-lift:hover,
.card:hover,
.stat-card:hover,
.dashboard-widget:hover,
.interactive-card:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 14px 30px -8px rgba(15, 23, 42, 0.12), 0 8px 16px -6px rgba(15, 23, 42, 0.08) !important;
}

html.dark .hover-lift:hover,
html.dark .card:hover,
html.dark .stat-card:hover,
html.dark .dashboard-widget:hover,
html.dark .interactive-card:hover {
    box-shadow: 0 14px 30px -8px rgba(0, 0, 0, 0.55), 0 8px 16px -6px rgba(0, 0, 0, 0.4) !important;
}

/* 4. Subtle Sheen Sweep effect on hover */
.sheen-card {
    position: relative;
    overflow: hidden;
}
.sheen-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        60deg,
        transparent 35%,
        rgba(255, 255, 255, 0.06) 45%,
        rgba(255, 255, 255, 0.18) 50%,
        rgba(255, 255, 255, 0.06) 55%,
        transparent 65%
    );
    transform: translateX(-100%) rotate(25deg);
    transition: transform 0.85s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 5;
}
.sheen-card:hover::after {
    transform: translateX(100%) rotate(25deg);
}

/* 5. Inputs & Forms Micro-Interactions */
input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="color"]),
select,
textarea {
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="color"]):focus,
select:focus,
textarea:focus {
    transform: translateY(-1px);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 0 3px 8px -2px rgba(59, 130, 246, 0.12) !important;
}

/* Checkbox & Radio spring animation */
input[type="checkbox"],
input[type="radio"] {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease !important;
    cursor: pointer;
}
input[type="checkbox"]:active,
input[type="radio"]:active {
    transform: scale(0.85);
}
input[type="checkbox"]:checked,
input[type="radio"]:checked {
    animation: checkboxPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes checkboxPop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

/* 6. Table Row Micro-Highlight & Subtle Left Stripe */
table tbody tr {
    transition: background-color 0.15s ease, transform 0.15s ease !important;
    position: relative;
}
table tbody tr:hover {
    background-color: rgba(241, 245, 249, 0.75) !important;
}
html.dark table tbody tr:hover {
    background-color: rgba(30, 41, 59, 0.6) !important;
}

/* 7. Subtle Pulse Badge */
@keyframes subtlePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.05); }
}
.animate-pulse-subtle {
    animation: subtlePulse 2.8s infinite ease-in-out;
}

/* 8. Micro-Wiggle for Action Icons */
.group:hover .group-hover-wiggle,
.group:hover svg.group-hover-wiggle {
    animation: iconWiggle 0.5s ease-in-out;
}
@keyframes iconWiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-8deg); }
    75% { transform: rotate(8deg); }
}

/* 9. Interactive Float / Magnetic Micro-Hover */
.interactive-hover-float {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease !important;
}
.interactive-hover-float:hover {
    transform: translateY(-2px) scale(1.01) !important;
}

/* 10. Sidebar Link Micro-Interactions */
#sidebar-nav a {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}
#sidebar-nav a:hover svg {
    transform: scale(1.12);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 11. Floating Scroll-to-Top Button */
#piy-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1e3a8a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px) scale(0.85);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#piy-back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
#piy-back-to-top:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 8px 24px rgba(30, 58, 138, 0.45);
    background: #1d4ed8;
}
#piy-back-to-top:active {
    transform: scale(0.92);
}

/* 12. Reading/Scroll Progress Bar */
#piy-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #6366f1, #8b5cf6, #ec4899);
    width: 0%;
    z-index: 100000;
    pointer-events: none;
    transition: width 0.1s linear;
}

/* 13. Dropdown Menu Spring Reveal */
[x-show].dropdown-spring {
    transform-origin: top right;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

/* 14. Badge Micro Bounce */
.badge-pill,
[class*="rounded-full"][class*="text-xs"] {
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
.badge-pill:hover,
[class*="rounded-full"][class*="text-xs"]:hover {
    transform: scale(1.08);
}

