/**
 * Micro-interactions and Hover Effects
 * Delightful UI details that enhance user experience
 */

/* === Interactive Cards === */
.interactive-card {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.interactive-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.2);
}

.interactive-card:active {
    transform: translateY(-2px) scale(0.99);
}

/* === Button Ripple Effect === */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
}

.btn-ripple:active::after {
    animation: ripple 0.6s ease-out;
}

/* === Underline Hover Effect === */
.link-underline {
    position: relative;
    text-decoration: none;
}

.link-underline::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: currentColor;
    transition: width 0.3s ease;
}

.link-underline:hover::before {
    width: 100%;
}

/* === Badge Pulse Effect === */
.badge-pulse {
    position: relative;
}

.badge-pulse::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: inherit;
    opacity: 0.5;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.95);
        opacity: 0.7;
    }
    50% {
        opacity: 0;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* === Icon Spin on Hover === */
.icon-spin-hover:hover {
    animation: spin 0.6s ease-in-out;
}

/* === Smooth Number Counter === */
.counter {
    display: inline-block;
    transition: all 0.3s ease;
}

.counter.updating {
    animation: countPulse 0.3s ease;
}

@keyframes countPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* === Tag Chip Hover === */
.tag-chip {
    transition: all 0.2s ease;
    cursor: pointer;
}

.tag-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.tag-chip:active {
    transform: translateY(0);
}

/* === Avatar Glow Effect === */
.avatar-glow {
    position: relative;
    border-radius: 50%;
}

.avatar-glow::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.avatar-glow:hover::before {
    opacity: 0.7;
}

/* === Progress Bar Animation === */
.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

/* === Input Focus Glow === */
.input-glow:focus {
    box-shadow: 0 0 0 4px var(--input-focus-shadow),
                0 0 20px var(--primary-color);
}

/* === Card Flip Effect === */
.card-flip {
    perspective: 1000px;
}

.card-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-flip:hover .card-flip-inner {
    transform: rotateY(180deg);
}

.card-flip-front,
.card-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.card-flip-back {
    transform: rotateY(180deg);
}

/* === Tooltip Arrow === */
[data-tooltip-position="top"]::after {
    bottom: 100%;
    margin-bottom: 8px;
}

[data-tooltip-position="bottom"]::after {
    top: 100%;
    margin-top: 8px;
}

[data-tooltip-position="left"]::after {
    right: 100%;
    margin-right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

[data-tooltip-position="right"]::after {
    left: 100%;
    margin-left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

/* === Skeleton Shimmer === */
.skeleton-shimmer {
    position: relative;
    overflow: hidden;
}

.skeleton-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

/* === Stagger List Items === */
.stagger-list > * {
    opacity: 0;
    animation: slideInUp 0.4s ease-out forwards;
}

.stagger-list > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-list > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-list > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-list > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-list > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-list > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-list > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-list > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-list > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-list > *:nth-child(10) { animation-delay: 0.5s; }

/* === Floating Action Button === */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.fab:active {
    transform: scale(0.95) rotate(90deg);
}

/* === Notification Dot === */
.notification-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background: var(--danger-color);
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    animation: pulse 2s ease-in-out infinite;
}

/* === Loading Dots === */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: loadingDot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* === Checkbox Custom === */
.checkbox-custom {
    position: relative;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-custom input {
    opacity: 0;
    position: absolute;
}

.checkbox-custom-checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.checkbox-custom input:checked ~ .checkbox-custom-checkmark {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-custom-checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-custom input:checked ~ .checkbox-custom-checkmark::after {
    display: block;
    animation: checkmarkSlide 0.3s ease-out;
}

@keyframes checkmarkSlide {
    0% {
        transform: rotate(45deg) scale(0);
    }
    50% {
        transform: rotate(45deg) scale(1.2);
    }
    100% {
        transform: rotate(45deg) scale(1);
    }
}

/* === Toggle Switch === */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-tertiary);
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider::before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--success-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* === Select Dropdown Custom === */
.select-custom {
    position: relative;
}

.select-custom::after {
    content: '▼';
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.select-custom:focus-within::after {
    transform: translateY(-50%) rotate(180deg);
}

/* === Breadcrumb Separator === */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.breadcrumb-separator {
    color: var(--text-tertiary);
}

.breadcrumb a {
    transition: all 0.2s ease;
}

.breadcrumb a:hover {
    transform: translateX(2px);
}

/* === Accordion Smooth === */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.accordion-content.open {
    max-height: 1000px;
}

/* === Scroll to Top Button === */
.scroll-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 99;
}

.scroll-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* === Gradient Text === */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* === Image Zoom on Hover === */
.image-zoom {
    overflow: hidden;
}

.image-zoom img {
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

/* === Glassmorphism Effect === */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    .interactive-card,
    .btn-ripple,
    .link-underline,
    .tag-chip,
    .card-flip-inner,
    .toggle-slider::before,
    .scroll-to-top,
    .image-zoom img {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
