/* ==========================================================
   VUDEV PREMIUM EFFECTS — Global Animation & UX System
   Tối ưu trải nghiệm mượt mà toàn bộ website
   ========================================================== */

/* ===== 1. SCROLL REVEAL SYSTEM ===== */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays for grid items */
.stagger-1 { transition-delay: 0.05s; }
.stagger-2 { transition-delay: 0.1s; }
.stagger-3 { transition-delay: 0.15s; }
.stagger-4 { transition-delay: 0.2s; }
.stagger-5 { transition-delay: 0.25s; }
.stagger-6 { transition-delay: 0.3s; }
.stagger-7 { transition-delay: 0.35s; }
.stagger-8 { transition-delay: 0.4s; }

/* Slide variants */
.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-scale {
    opacity: 0;
    transform: scale(0.92);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal-left.revealed,
.reveal-right.revealed,
.reveal-scale.revealed {
    opacity: 1;
    transform: translateX(0) scale(1);
}

/* ===== 2. PREMIUM HOVER EFFECTS ===== */

/* Glow on hover for cards */
.hover-glow {
    position: relative;
    overflow: hidden;
}
.hover-glow::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
    background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(79, 70, 229, 0.06), transparent 40%);
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
}
.hover-glow:hover::after {
    opacity: 1;
}

[data-theme="dark"] .hover-glow::after {
    background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(129, 140, 248, 0.08), transparent 40%);
}

/* Shine sweep effect */
.hover-shine {
    position: relative;
    overflow: hidden;
}
.hover-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
    transition: none;
    z-index: 1;
    pointer-events: none;
}
.hover-shine:hover::before {
    animation: shineSwipe 0.6s ease forwards;
}
@keyframes shineSwipe {
    0% { left: -100%; }
    100% { left: 150%; }
}

/* Button press effect */
.btn-press {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-press:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}
.btn-press:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ===== 3. GRADIENT ANIMATIONS ===== */

/* Animated gradient text */
.gradient-text-animated {
    background: linear-gradient(135deg, #4f46e5, #ec4899, #0ea5e9, #4f46e5);
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientShift 4s ease infinite;
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Animated gradient border */
.gradient-border {
    position: relative;
}
.gradient-border::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4f46e5, #ec4899, #0ea5e9, #10b981);
    background-size: 300% 100%;
    animation: borderFlow 3s linear infinite;
    border-radius: 20px 20px 0 0;
    opacity: 0;
    transition: opacity 0.3s;
}
.gradient-border:hover::before {
    opacity: 1;
}
@keyframes borderFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 300% 0%; }
}

/* ===== 4. FLOATING & PULSE EFFECTS ===== */

.float-gentle {
    animation: floatGentle 3s ease-in-out infinite;
}
@keyframes floatGentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.pulse-glow {
    animation: pulseGlowEffect 2s ease-in-out infinite;
}
@keyframes pulseGlowEffect {
    0%, 100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.3); }
    50% { box-shadow: 0 0 20px 4px rgba(79, 70, 229, 0.15); }
}

/* ===== 5. COUNTER / NUMBER ANIMATION ===== */
.count-up {
    display: inline-block;
    transition: all 0.3s ease;
}

/* ===== 6. TABLE & LIST HOVER ===== */
.table-hover-row tr {
    transition: all 0.2s ease;
}
.table-hover-row tr:hover {
    background: rgba(79, 70, 229, 0.03) !important;
    transform: scale(1.005);
}
[data-theme="dark"] .table-hover-row tr:hover {
    background: rgba(129, 140, 248, 0.05) !important;
}

/* ===== 7. SMOOTH SCROLL ===== */
html {
    scroll-behavior: smooth;
}

/* ===== 8. SELECTION COLOR ===== */
::selection {
    background: rgba(79, 70, 229, 0.2);
    color: #1e293b;
}
[data-theme="dark"] ::selection {
    background: rgba(129, 140, 248, 0.3);
    color: #f8fafc;
}

/* ===== 9. FOCUS RING ===== */
input:focus,
select:focus,
textarea:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
    outline: none;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: #818cf8 !important;
    box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15) !important;
}

/* ===== 10. LINK UNDERLINE ANIMATION ===== */
.link-animate {
    position: relative;
    text-decoration: none;
}
.link-animate::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #4f46e5, #ec4899);
    transition: width 0.3s ease;
    border-radius: 1px;
}
.link-animate:hover::after {
    width: 100%;
}

/* ===== 11. SKELETON LOADING ===== */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}
[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== 12. IMAGE LAZY LOAD FADE ===== */
img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.4s ease;
}
img[loading="lazy"].loaded,
img[loading="lazy"][src] {
    opacity: 1;
}

/* ===== 13. CARD GRID ENTRANCE ===== */
.product-grid .premium-card,
.product-slider-container .slider-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 14. SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #334155;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ===== 15. RIPPLE EFFECT FOR BUTTONS ===== */
.ripple {
    position: relative;
    overflow: hidden;
}
.ripple-wave {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out forwards;
    pointer-events: none;
}
@keyframes rippleAnim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===== 16. TOOLTIP ===== */
[data-tooltip] {
    position: relative;
    cursor: help;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #0f172a;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 100;
}
[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== 17. BETTER TRANSITIONS FOR COMMON ELEMENTS ===== */
a, button, input, select, textarea {
    transition: all 0.2s ease;
}

/* ===== 18. PAGE HEADER ANIMATION ===== */
.page-header {
    animation: headerFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.page-title {
    animation: titleSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}
.page-desc {
    animation: titleSlideUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

@keyframes headerFadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}
@keyframes titleSlideUp {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ===== 19. SECTION DIVIDERS ===== */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--glass-border, #e2e8f0), transparent);
    margin: 3rem 0;
}

/* ===== 20. PRODUCT CARD STAGGER ENTRANCE ===== */
@keyframes cardEntrance {
    0% { opacity: 0; transform: translateY(20px) scale(0.97); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.product-grid > .premium-card:nth-child(1) { animation: cardEntrance 0.5s ease 0.05s both; }
.product-grid > .premium-card:nth-child(2) { animation: cardEntrance 0.5s ease 0.1s both; }
.product-grid > .premium-card:nth-child(3) { animation: cardEntrance 0.5s ease 0.15s both; }
.product-grid > .premium-card:nth-child(4) { animation: cardEntrance 0.5s ease 0.2s both; }
.product-grid > .premium-card:nth-child(5) { animation: cardEntrance 0.5s ease 0.25s both; }
.product-grid > .premium-card:nth-child(6) { animation: cardEntrance 0.5s ease 0.3s both; }
.product-grid > .premium-card:nth-child(7) { animation: cardEntrance 0.5s ease 0.35s both; }
.product-grid > .premium-card:nth-child(8) { animation: cardEntrance 0.5s ease 0.4s both; }
.product-grid > .premium-card:nth-child(9) { animation: cardEntrance 0.5s ease 0.45s both; }
.product-grid > .premium-card:nth-child(10) { animation: cardEntrance 0.5s ease 0.5s both; }
.product-grid > .premium-card:nth-child(n+11) { animation: cardEntrance 0.5s ease 0.55s both; }

/* ===== REDUCE MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
