/**
 * Visual Polish CSS
 * Enhanced hover states, transitions, animations, and visual feedback
 *
 * Focus Areas:
 * - Smooth 60fps animations
 * - Enhanced hover states with visual feedback
 * - Loading states and skeletons
 * - Micro-interactions
 * - Visual consistency
 */

/* ============================================
   SMOOTH TRANSITIONS (GPU-accelerated)
   ============================================ */

/* Use transform and opacity for smooth 60fps animations */
.smooth-transition {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Optimize card hover animations */
.card,
.deity-card,
.mythology-card,
.universal-grid-card,
.feature-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease;
    will-change: transform;
}

.card:hover,
.deity-card:hover,
.mythology-card:hover,
.universal-grid-card:hover,
.feature-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(var(--color-primary-rgb, 139, 127, 255), 0.3),
        0 0 32px rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
}

/* Enhanced button hover states */
.btn,
.btn-primary,
.btn-secondary,
button:not(.icon-btn) {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple effect on click */
.btn::after,
.btn-primary::after,
.btn-secondary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after,
.btn-primary:active::after,
.btn-secondary:active::after {
    width: 300px;
    height: 300px;
}

/* Button hover glow */
.btn-primary:hover {
    box-shadow:
        0 8px 24px rgba(var(--color-primary-rgb, 139, 127, 255), 0.5),
        0 0 40px rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
    transform: translateY(-2px) scale(1.02);
}

.btn-secondary:hover {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
    border-color: var(--color-primary);
    transform: translateY(-2px) scale(1.02);
}

/* ============================================
   ENHANCED LOADING STATES
   ============================================ */

/* Shimmer effect for loading cards */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton,
.skeleton-card,
.loading-skeleton {
    background: linear-gradient(
        90deg,
        rgba(var(--color-border-primary-rgb, 42, 47, 74), 0.3) 0%,
        rgba(var(--color-border-primary-rgb, 42, 47, 74), 0.6) 50%,
        rgba(var(--color-border-primary-rgb, 42, 47, 74), 0.3) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

/* Pulse animation for loading states */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Spinner with gradient */
.loading-spinner,
.spinner-ring {
    border: 3px solid rgba(var(--color-primary-rgb, 139, 127, 255), 0.2);
    border-top: 3px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Multi-ring spinner */
.spinner-container {
    position: relative;
    width: 60px;
    height: 60px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-width: 3px;
}

.spinner-ring:nth-child(1) {
    animation-duration: 1s;
    border-top-color: var(--color-primary);
}

.spinner-ring:nth-child(2) {
    animation-duration: 1.2s;
    border-top-color: var(--color-secondary);
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
}

.spinner-ring:nth-child(3) {
    animation-duration: 1.5s;
    border-top-color: var(--color-accent);
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
}

/* ============================================
   MICRO-INTERACTIONS
   ============================================ */

/* Icon button pulse on hover */
.icon-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
    transform: translateY(-2px) rotate(5deg);
    box-shadow: 0 6px 20px rgba(var(--color-primary-rgb, 139, 127, 255), 0.4);
}

.icon-btn:active {
    transform: translateY(0) rotate(0deg) scale(0.95);
}

/* Link underline animation */
a:not(.btn):not(.nav-link):not(.card) {
    position: relative;
    text-decoration: none;
    background-image: linear-gradient(
        to right,
        var(--color-primary) 0%,
        var(--color-primary) 100%
    );
    background-size: 0 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

a:not(.btn):not(.nav-link):not(.card):hover {
    background-size: 100% 2px;
}

/* Tag hover effects */
.tag,
.badge,
.entity-type-badge,
.mythology-badge {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.tag:hover,
.badge:hover,
.entity-type-badge:hover,
.mythology-badge:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
}

/* Input focus glow */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow:
        0 0 0 3px rgba(var(--color-primary-rgb, 139, 127, 255), 0.2),
        0 4px 12px rgba(var(--color-primary-rgb, 139, 127, 255), 0.3);
    transform: translateY(-1px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   PAGE TRANSITIONS
   ============================================ */

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Slide in animations */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-left {
    animation: slideInFromLeft 0.5s ease-out;
}

.slide-in-right {
    animation: slideInFromRight 0.5s ease-out;
}

.slide-in-bottom {
    animation: slideInFromBottom 0.5s ease-out;
}

/* Staggered animation for grid items */
.grid > *,
.mythology-grid > *,
.universal-grid > * {
    animation: fadeIn 0.5s ease-out backwards;
}

.grid > *:nth-child(1),
.mythology-grid > *:nth-child(1),
.universal-grid > *:nth-child(1) { animation-delay: 0.05s; }

.grid > *:nth-child(2),
.mythology-grid > *:nth-child(2),
.universal-grid > *:nth-child(2) { animation-delay: 0.1s; }

.grid > *:nth-child(3),
.mythology-grid > *:nth-child(3),
.universal-grid > *:nth-child(3) { animation-delay: 0.15s; }

.grid > *:nth-child(4),
.mythology-grid > *:nth-child(4),
.universal-grid > *:nth-child(4) { animation-delay: 0.2s; }

.grid > *:nth-child(5),
.mythology-grid > *:nth-child(5),
.universal-grid > *:nth-child(5) { animation-delay: 0.25s; }

.grid > *:nth-child(n+6),
.mythology-grid > *:nth-child(n+6),
.universal-grid > *:nth-child(n+6) { animation-delay: 0.3s; }

/* ============================================
   ENHANCED FOCUS INDICATORS
   ============================================ */

/* High visibility focus ring */
*:focus-visible {
    outline: 3px solid var(--color-accent, #ffd93d);
    outline-offset: 3px;
    box-shadow:
        0 0 0 6px rgba(var(--color-accent-rgb, 255, 217, 61), 0.2),
        0 0 20px rgba(var(--color-accent-rgb, 255, 217, 61), 0.3);
    transition: all 0.2s ease;
}

/* Button focus states */
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible {
    outline: 3px solid var(--color-accent, #ffd93d);
    outline-offset: 4px;
    box-shadow:
        0 0 0 6px rgba(var(--color-accent-rgb, 255, 217, 61), 0.3),
        0 8px 24px rgba(var(--color-primary-rgb, 139, 127, 255), 0.5);
}

/* Card focus states */
.card:focus-visible,
.mythology-card:focus-visible {
    outline: 3px solid var(--color-accent, #ffd93d);
    outline-offset: 2px;
    box-shadow:
        0 0 0 6px rgba(var(--color-accent-rgb, 255, 217, 61), 0.2),
        0 16px 48px rgba(0, 0, 0, 0.4);
}

/* ============================================
   SCROLL ANIMATIONS
   ============================================ */

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Scroll progress indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--color-primary) 0%,
        var(--color-secondary) 50%,
        var(--color-accent) 100%
    );
    z-index: 10000;
    transition: width 0.1s linear;
}

/* Back to top button enhancement */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(var(--color-primary-rgb, 139, 127, 255), 0.4);
    z-index: 1000;
}

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

.back-to-top:hover {
    transform: translateY(-4px) scale(1.1);
    box-shadow: 0 12px 32px rgba(var(--color-primary-rgb, 139, 127, 255), 0.6);
}

.back-to-top:active {
    transform: translateY(-2px) scale(1.05);
}

/* ============================================
   TOOLTIP ENHANCEMENTS
   ============================================ */

.tooltip {
    position: absolute;
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1000;
}

.tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Tooltip arrow */
.tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--color-border);
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--color-bg-card);
}

/* ============================================
   MODAL ANIMATIONS
   ============================================ */

.modal {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.open .modal-content {
    transform: scale(1) translateY(0);
}

.modal-backdrop {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.open .modal-backdrop {
    opacity: 1;
}

/* ============================================
   NOTIFICATION ANIMATIONS
   ============================================ */

@keyframes notification-enter {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes notification-exit {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(100%) scale(0.95);
    }
}

.notification-enter {
    animation: notification-enter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.notification-exit {
    animation: notification-exit 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   RESPONSIVE POLISH
   ============================================ */

@media (max-width: 768px) {
    /* Reduce animation complexity on mobile */
    .card:hover,
    .mythology-card:hover {
        transform: translateY(-4px);
    }

    /* Simpler shadows */
    .btn-primary:hover {
        box-shadow: 0 4px 16px rgba(var(--color-primary-rgb, 139, 127, 255), 0.4);
    }

    /* Disable staggered animations on mobile */
    .grid > *,
    .mythology-grid > *,
    .universal-grid > * {
        animation-delay: 0s !important;
    }
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    /* Disable all transforms */
    .card:hover,
    .btn:hover,
    .icon-btn:hover {
        transform: none !important;
    }

    /* Keep basic hover effects */
    .card:hover {
        border-color: var(--color-primary);
    }

    .btn:hover {
        background-color: var(--color-primary-hover);
    }
}

/* ============================================
   PRINT OPTIMIZATIONS
   ============================================ */

@media print {
    /* Remove all animations and transitions */
    * {
        animation: none !important;
        transition: none !important;
        transform: none !important;
        box-shadow: none !important;
    }

    /* Hide interactive elements */
    .btn,
    .icon-btn,
    .back-to-top,
    .tooltip,
    .modal {
        display: none !important;
    }
}

/* ============================================
   FINAL UX POLISH - Agent 12 Additions
   ============================================ */

/* Enhanced Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Account for sticky header */
}

/* Smooth scroll for specific containers */
.view-container,
.main-content,
#main-content {
    scroll-behavior: smooth;
}

/* Enhanced Focus States for all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
[role="link"]:focus-visible {
    outline: 3px solid var(--color-accent, #ffd93d);
    outline-offset: 3px;
    box-shadow:
        0 0 0 6px rgba(255, 217, 61, 0.25),
        0 0 20px rgba(255, 217, 61, 0.15);
    transition: outline-offset 0.2s ease, box-shadow 0.2s ease;
}

/* Navigation link focus enhancement */
.nav-link:focus-visible {
    outline: 3px solid var(--color-accent, #ffd93d);
    outline-offset: 4px;
    border-radius: 8px;
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.15);
}

/* Card focus indicators */
.landing-category-card:focus-visible,
.mythology-card:focus-visible,
.universal-grid-card:focus-visible,
.feature-card:focus-visible {
    outline: 3px solid var(--color-accent, #ffd93d);
    outline-offset: 4px;
    transform: translateY(-6px) scale(1.01);
    border-color: var(--color-accent, #ffd93d);
}

/* Missing ARIA Labels - Loading States */
.loading-container[role="status"] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Live region for screen readers */
.sr-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Color Contrast Improvements for Text */
.landing-category-description,
.landing-hero-description,
.landing-section-subtitle,
.feature-card p {
    color: var(--color-text-secondary, #b0b5c3);
}

/* High contrast text for important content */
.landing-hero-title,
.landing-hero-subtitle,
.landing-section-header,
.landing-category-name {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Enhanced Error States with better contrast */
.error-page,
.error-message {
    color: #ff8a8a;
    background: rgba(255, 100, 100, 0.1);
    border: 2px solid rgba(255, 100, 100, 0.3);
    border-radius: 12px;
    padding: 2rem;
}

.error-page h1,
.error-page h2 {
    color: #ffa0a0;
}

/* User-Friendly Error Handling Styling */
.error-page {
    text-align: center;
    max-width: 600px;
    margin: 4rem auto;
    animation: fadeIn 0.5s ease-out;
}

.error-page .btn-primary {
    margin-top: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Consistent Loading State Styling */
.loading-container {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1.5rem;
}

.loading-message {
    color: var(--color-text-secondary, #adb5bd);
    font-size: 1.1rem;
    font-weight: 500;
}

.loading-submessage {
    color: var(--color-text-muted, #6c757d);
    font-size: 0.9rem;
    margin-top: -0.5rem;
}

/* Transition Animations for View Changes */
.view-transition-enter {
    opacity: 0;
    transform: translateY(20px);
}

.view-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.view-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.view-transition-exit-active {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease-in, transform 0.2s ease-in;
}

/* Footer Link Accessibility */
.footer-links a {
    color: var(--color-text-secondary, #adb5bd);
    text-decoration: underline;
    text-underline-offset: 3px;
    padding: 0.5rem;
    margin: -0.5rem;
    border-radius: 4px;
    transition: color 0.3s ease, background-color 0.3s ease;
}

.footer-links a:hover,
.footer-links a:focus {
    color: var(--color-primary, #8b7fff);
    background-color: rgba(var(--color-primary-rgb, 139, 127, 255), 0.1);
    text-decoration-thickness: 2px;
}

.footer-links a:focus-visible {
    outline: 2px solid var(--color-accent, #ffd93d);
    outline-offset: 2px;
}

/* Site Footer Enhancement */
.site-footer {
    margin-top: auto;
    background: rgba(var(--color-bg-secondary-rgb, 21, 26, 53), 0.8);
    border-top: 1px solid rgba(var(--color-border-primary-rgb, 42, 47, 74), 0.6);
    padding: 2rem;
    text-align: center;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Enhanced Transitions for Interactive Elements */
.interactive-element,
[role="button"],
[role="link"],
a,
button {
    transition:
        color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Better Visual Feedback for Active States */
a:active,
button:active,
[role="button"]:active {
    transform: scale(0.98);
    transition-duration: 0.1s;
}

/* Search Input Enhancements */
input[type="search"],
input[type="text"],
.search-input,
.search-input-large {
    transition:
        border-color 0.3s ease,
        box-shadow 0.3s ease,
        background-color 0.3s ease;
}

input[type="search"]:focus,
input[type="text"]:focus,
.search-input:focus,
.search-input-large:focus {
    border-color: var(--color-primary, #8b7fff);
    box-shadow:
        0 0 0 4px rgba(var(--color-primary-rgb, 139, 127, 255), 0.2),
        0 4px 16px rgba(var(--color-primary-rgb, 139, 127, 255), 0.15);
    outline: none;
}

/* Keyboard Navigation Visibility */
body.keyboard-navigation *:focus {
    outline: 3px solid var(--color-accent, #ffd93d) !important;
    outline-offset: 3px !important;
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-link,
    .footer-links a,
    .btn,
    button {
        min-height: 48px;
        min-width: 48px;
        padding: 12px 16px;
    }

    /* Remove hover animations on touch */
    .card:hover,
    .mythology-card:hover,
    .landing-category-card:hover {
        transform: none;
    }

    /* Active state for touch */
    .card:active,
    .mythology-card:active,
    .landing-category-card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* High Contrast Mode Enhancements */
@media (prefers-contrast: high) {
    .landing-category-card,
    .feature-card,
    .mythology-card {
        border-width: 3px;
    }

    a, button {
        text-decoration: underline;
        text-decoration-thickness: 2px;
    }

    .error-page {
        border-width: 3px;
    }

    /* Ensure focus is very visible */
    *:focus-visible {
        outline-width: 4px !important;
        outline-offset: 4px !important;
    }
}

/* Dark Mode Color Consistency */
@media (prefers-color-scheme: dark) {
    :root {
        --focus-ring-color: #ffd93d;
        --error-color: #ff8a8a;
        --success-color: #6ee7b7;
    }
}

/* Notification Toast Improvements */
.toast-notification,
.notification {
    animation: slideInFromRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Consistent Border Radius System */
:root {
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;
}

/* Ensure all cards use consistent radius */
.card,
.mythology-card,
.landing-category-card,
.feature-card,
.universal-grid-card {
    border-radius: var(--radius-xl, 16px);
}

.btn,
.btn-primary,
.btn-secondary {
    border-radius: var(--radius-lg, 12px);
}

/* Empty State Styling */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--color-text-secondary, #adb5bd);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-primary, #f8f9fa);
}

.empty-state-description {
    max-width: 400px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

/* Selection Styling */
::selection {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.4);
    color: var(--color-text-primary, #ffffff);
}

/* Scrollbar Styling (Webkit) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(var(--color-bg-secondary-rgb, 21, 26, 53), 0.5);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.4);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-primary-rgb, 139, 127, 255), 0.6);
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 127, 255, 0.4) rgba(21, 26, 53, 0.5);
}

/* ============================================
   CONSOLIDATED LOADING STATE TRANSITIONS
   Ensures smooth spinner-to-content transitions
   ============================================ */

/* Container with skeleton state */
.has-skeleton {
    min-height: 400px;
    position: relative;
}

/* Universal fade-out class for all loading elements */
.fade-out {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease-out !important;
}

/* Content appearing after loading */
.content-loaded {
    animation: smoothFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes smoothFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading container fade-out transition */
.loading-container {
    transition: opacity 0.3s ease-out;
}

.loading-container.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Skeleton loading elements fade-out */
.skeleton-loading.fade-out,
.skeleton-card.fade-out {
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

/* Main content transition states */
#main-content {
    transition: opacity 0.2s ease-out;
}

#main-content.transitioning {
    opacity: 0.5;
}

/* Spinner wrapper transitions */
.loading-spinner-wrapper {
    transition: opacity 0.3s ease-out;
}

.loading-spinner-wrapper.fade-out {
    opacity: 0;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .fade-out,
    .content-loaded,
    .loading-container,
    .skeleton-loading.fade-out,
    .loading-spinner-wrapper,
    #main-content {
        animation: none !important;
        transition: none !important;
    }

    .content-loaded {
        opacity: 1 !important;
        transform: none !important;
    }
}
