/* ===================================
   UX IMPROVEMENTS & MICRO-INTERACTIONS
   Enhanced user experience features
   =================================== */

/* ===== ACTIVE NAVIGATION STATES ===== */
/* Highlight current page in navigation */
.nav-link.active,
.nav-link[aria-current="page"] {
    color: var(--cosmic-gold) !important;
    position: relative;
}

.nav-link.active::after,
.nav-link[aria-current="page"]::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: linear-gradient(90deg, var(--cosmic-violet), var(--cosmic-gold));
    border-radius: 2px;
    animation: slide-in 0.3s ease-out;
}

@keyframes slide-in {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 30px;
        opacity: 1;
    }
}

/* ===== SMOOTH DROPDOWN ANIMATIONS ===== */
.dropdown-content {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.dropdown:hover .dropdown-content,
.dropdown.active .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Stagger animation for dropdown items */
.dropdown-content a {
    opacity: 0;
    animation: fade-in-up 0.3s ease forwards;
}

.dropdown:hover .dropdown-content a:nth-child(1) { animation-delay: 0.05s; }
.dropdown:hover .dropdown-content a:nth-child(2) { animation-delay: 0.1s; }
.dropdown:hover .dropdown-content a:nth-child(3) { animation-delay: 0.15s; }
.dropdown:hover .dropdown-content a:nth-child(4) { animation-delay: 0.2s; }
.dropdown:hover .dropdown-content a:nth-child(5) { animation-delay: 0.25s; }
.dropdown:hover .dropdown-content a:nth-child(6) { animation-delay: 0.3s; }

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== ENHANCED BUTTON INTERACTIONS ===== */
.btn,
.button,
[class*="btn-"] {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn:active::before,
.button:active::before {
    width: 300px;
    height: 300px;
}

/* Hover glow effect */
.btn:hover,
.button:hover {
    box-shadow:
        0 6px 20px rgba(108, 99, 255, 0.3),
        0 0 20px rgba(108, 99, 255, 0.2);
}

/* ===== CARD SLIDE-IN ANIMATIONS ===== */
.zodiac-card,
.horoscope-card,
.calculator-card,
.bento-tile {
    opacity: 0;
    transform: translateY(20px);
    animation: slide-in-card 0.6s ease forwards;
}

/* Stagger card animations */
.zodiac-card:nth-child(1),
.bento-tile:nth-child(1) { animation-delay: 0.1s; }
.zodiac-card:nth-child(2),
.bento-tile:nth-child(2) { animation-delay: 0.2s; }
.zodiac-card:nth-child(3),
.bento-tile:nth-child(3) { animation-delay: 0.3s; }
.zodiac-card:nth-child(4),
.bento-tile:nth-child(4) { animation-delay: 0.4s; }
.zodiac-card:nth-child(5),
.bento-tile:nth-child(5) { animation-delay: 0.5s; }
.zodiac-card:nth-child(6),
.bento-tile:nth-child(6) { animation-delay: 0.6s; }
.zodiac-card:nth-child(7),
.bento-tile:nth-child(7) { animation-delay: 0.7s; }
.zodiac-card:nth-child(8),
.bento-tile:nth-child(8) { animation-delay: 0.8s; }

@keyframes slide-in-card {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced card hover effects */
.zodiac-card,
.horoscope-card,
.calculator-card,
.bento-tile {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.zodiac-card:hover,
.horoscope-card:hover,
.calculator-card:hover,
.bento-tile:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.15),
        0 0 20px rgba(108, 99, 255, 0.1);
}

/* ===== FLOATING LABEL INPUTS ===== */
.form-field {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 1.2rem 1rem 0.6rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-field label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.3s ease;
    background: var(--card-bg);
    padding: 0 0.25rem;
}

/* Float label when focused or filled */
.form-field input:focus ~ label,
.form-field input:not(:placeholder-shown) ~ label,
.form-field textarea:focus ~ label,
.form-field textarea:not(:placeholder-shown) ~ label,
.form-field select:focus ~ label,
.form-field select:not([value=""]) ~ label {
    top: 0;
    font-size: 0.75rem;
    color: var(--cosmic-violet);
    transform: translateY(-50%);
}

.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    border-color: var(--cosmic-violet);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
    outline: none;
}

/* ===== ICON ANIMATIONS ===== */
.fa-spin-hover:hover {
    animation: spin 2s linear infinite;
}

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

/* Bounce on hover */
.icon-bounce:hover {
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-10px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-5px); }
}

/* ===== SUBTLE COSMIC PARTICLES ===== */
.cosmic-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
}

.cosmic-particles::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 10% 20%, rgba(139, 92, 246, 0.4), transparent),
        radial-gradient(1px 1px at 20% 40%, rgba(236, 72, 153, 0.4), transparent),
        radial-gradient(1px 1px at 30% 70%, rgba(59, 130, 246, 0.4), transparent),
        radial-gradient(2px 2px at 50% 30%, rgba(139, 92, 246, 0.4), transparent),
        radial-gradient(1px 1px at 70% 60%, rgba(236, 72, 153, 0.4), transparent),
        radial-gradient(1px 1px at 85% 25%, rgba(59, 130, 246, 0.4), transparent),
        radial-gradient(2px 2px at 90% 80%, rgba(139, 92, 246, 0.4), transparent);
    background-size: 200% 200%;
    animation: particle-float 30s ease-in-out infinite;
}

@keyframes particle-float {
    0%, 100% {
        background-position: 0% 0%;
    }
    50% {
        background-position: 100% 100%;
    }
}

/* ===== SECTION DIVIDER ANIMATIONS ===== */
.section-divider {
    overflow: hidden;
}

.section-divider svg {
    transition: transform 1s ease;
}

.section-divider:hover svg {
    transform: scale(1.05);
}

/* ===== PROGRESS INDICATORS ===== */
.progress-bar-wrapper {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--cosmic-violet), var(--cosmic-gold));
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===== TOOLTIP ENHANCEMENTS ===== */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.875rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
/* Keyboard focus styles */
*:focus-visible {
    outline: 3px solid var(--cosmic-violet);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--cosmic-violet);
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-to-main:focus {
    top: 0;
}

/* ===== LOADING STATES ===== */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--cosmic-violet);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

    .cosmic-particles {
        display: none;
    }
}

/* ===== VISUAL FEEDBACK FOR INTERACTIONS ===== */
.clickable {
    cursor: pointer;
    user-select: none;
}

.clickable:active {
    transform: scale(0.98);
}

/* Success feedback */
.success-pulse {
    animation: success-pulse 0.6s ease;
}

@keyframes success-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(16, 185, 129, 0);
    }
}

/* Error shake */
.error-shake {
    animation: error-shake 0.5s ease;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}
