/**
 * Advanced Visual Features - Katalog AI
 * Professional enhancements by world-class webmaster
 *
 * @package Katalog_AI_Child
 */

/* ========================================
   ADVANCED ANIMATIONS & MICROINTERACTIONS
   ======================================== */

/* Smooth Page Load Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-main > * {
    animation: fadeInUp 0.6s ease-out;
}

.tool-card {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

.tool-card:nth-child(1) { animation-delay: 0.1s; }
.tool-card:nth-child(2) { animation-delay: 0.2s; }
.tool-card:nth-child(3) { animation-delay: 0.3s; }
.tool-card:nth-child(4) { animation-delay: 0.4s; }
.tool-card:nth-child(5) { animation-delay: 0.5s; }
.tool-card:nth-child(6) { animation-delay: 0.6s; }

/* Advanced Hover Effects */
.tool-card {
    position: relative;
    overflow: hidden;
}

.tool-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.tool-card:hover::after {
    left: 100%;
}

/* Glowing Border on Hover */
.tool-card:hover {
    box-shadow: 
        0 0 20px rgba(99, 102, 241, 0.3),
        0 0 40px rgba(99, 102, 241, 0.2),
        0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Floating Animation for CTA Buttons */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.btn-hero.primary {
    animation: float 3s ease-in-out infinite;
}

/* Pulse Animation for New Badges */
@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 20px rgba(236, 72, 153, 0.8);
        transform: scale(1.05);
    }
}

.tool-badge {
    animation: pulse-glow 2s infinite;
}

/* ========================================
   LOADING STATES & SKELETONS
   ======================================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.tool-card.loading .tool-card-image {
    height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

/* Loading Spinner */
.loader {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #6366F1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   TOOLTIP SYSTEM
   ======================================== */

[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: 8px 12px;
    background: #1F2937;
    color: white;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
    z-index: 1000;
}

[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1F2937;
    opacity: 0;
    transition: all 0.3s;
}

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

/* ========================================
   SCROLL PROGRESS BAR
   ======================================== */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366F1, #EC4899);
    transform-origin: left;
    transform: scaleX(0);
    z-index: 9999;
    transition: transform 0.1s;
}

/* ========================================
   RATING STARS ENHANCEMENTS
   ======================================== */

.tool-rating .stars {
    display: inline-block;
    position: relative;
}

.tool-rating .stars::before {
    content: attr(data-rating);
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.tool-rating:hover .stars::before {
    opacity: 1;
}

/* ========================================
   COMPARISON BAR (Sticky)
   ======================================== */

#comparison-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #6366F1, #EC4899);
    padding: 15px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    animation: slideInUp 0.3s;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

#comparison-bar.active {
    display: block;
}

.comparison-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.comparison-count {
    font-size: 1.125rem;
    font-weight: 700;
}

.btn-compare-now {
    padding: 10px 24px;
    background: white;
    color: #6366F1;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-compare-now:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.3);
}

.btn-compare-now:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   SCROLL TO TOP BUTTON
   ======================================== */

#scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #6366F1, #EC4899);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    z-index: 999;
    display: none;
}

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

#scroll-to-top:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

/* ========================================
   DARK MODE TOGGLE
   ======================================== */

.dark-mode-toggle {
    position: fixed;
    top: 100px;
    right: 20px;
    width: 60px;
    height: 30px;
    background: #D1D5DB;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s;
    z-index: 998;
}

.dark-mode-toggle::after {
    content: '🌙';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.3s;
}

.dark-mode-toggle.active {
    background: #6366F1;
}

.dark-mode-toggle.active::after {
    content: '☀️';
    left: 33px;
}

/* Dark Mode Styles */
body.dark-mode {
    background: #0F172A;
    color: #F1F5F9;
}

body.dark-mode .tool-card {
    background: #1E293B;
    border-color: #334155;
}

body.dark-mode .site-footer {
    background: #0F172A;
}

/* ========================================
   NOTIFICATION TOAST
   ======================================== */

.toast-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: white;
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    animation: slideInRight 0.3s;
    max-width: 350px;
}

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

.toast-notification.success {
    border-left: 4px solid #10B981;
}

.toast-notification.error {
    border-left: 4px solid #EF4444;
}

.toast-notification.info {
    border-left: 4px solid #6366F1;
}

/* ========================================
   SEARCH AUTOCOMPLETE
   ======================================== */

.search-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-autocomplete.active {
    display: block;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.autocomplete-item:hover {
    background: #F3F4F6;
}

.autocomplete-item img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

/* ========================================
   SOCIAL PROOF BADGES
   ======================================== */

.social-proof {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #92400E;
    animation: subtle-bounce 2s infinite;
}

@keyframes subtle-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.social-proof::before {
    content: '🔥';
    font-size: 1.125rem;
}

/* ========================================
   PRICING COMPARISON TABLE
   ======================================== */

.pricing-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin: 40px 0;
}

.pricing-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
    position: relative;
}

.pricing-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.pricing-card.featured {
    background: linear-gradient(135deg, #6366F1, #EC4899);
    color: white;
    transform: scale(1.05);
}

.pricing-card.featured::before {
    content: 'NAJPOPULARNIEJSZY';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #F59E0B;
    color: white;
    padding: 4px 16px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* ========================================
   INTERACTIVE CHARTS (for rankings)
   ======================================== */

.benchmark-chart {
    position: relative;
    height: 200px;
    background: linear-gradient(to top, #F3F4F6, transparent);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.chart-bar {
    position: absolute;
    bottom: 20px;
    width: 40px;
    background: linear-gradient(to top, #6366F1, #EC4899);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s;
    animation: growUp 0.8s ease-out;
}

@keyframes growUp {
    from {
        height: 0;
    }
}

.chart-bar:hover {
    filter: brightness(1.2);
    transform: translateY(-5px);
}

/* ========================================
   RESPONSIVE ENHANCEMENTS
   ======================================== */

@media (max-width: 768px) {
    #comparison-bar {
        padding: 12px;
    }
    
    .comparison-content {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    #scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    .dark-mode-toggle {
        top: 80px;
        right: 15px;
    }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #6366F1;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 10000;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tool-card {
        border: 2px solid currentColor;
    }
    
    .btn-primary {
        border: 2px solid currentColor;
    }
}

/* 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;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .site-header,
    .site-footer,
    #comparison-bar,
    #scroll-to-top,
    .dark-mode-toggle,
    .filters-section {
        display: none !important;
    }
    
    .tool-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}