/* Custom animations and styles for Bajki z Trzech Słów */

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

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1e6ff;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #9333ea, #ec4899);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #7c3aed, #db2777);
}

/* Floating animation for decorative elements */
@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

/* Pulse animation for CTA buttons */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 10px 30px rgba(147, 112, 219, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 15px 40px rgba(147, 112, 219, 0.3);
    }
}

/* Twinkle animation for stars */
@keyframes twinkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Slide in animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Cloud floating animation */
@keyframes cloudFloat {
    0%, 100% {
        transform: translateX(0) translateY(0);
    }
    25% {
        transform: translateX(20px) translateY(-10px);
    }
    50% {
        transform: translateX(-10px) translateY(5px);
    }
    75% {
        transform: translateX(15px) translateY(-5px);
    }
}

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

/* Classes for animations */
.float-animation {
    animation: float 3s ease-in-out infinite;
}

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

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

.slide-in {
    animation: slideIn 0.6s ease-out;
}

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

.cloud-float {
    animation: cloudFloat 20s ease-in-out infinite;
}

/* Button hover shimmer effect */
.shimmer-button {
    position: relative;
    overflow: hidden;
}

.shimmer-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transition: left 0.5s;
}

.shimmer-button:hover::before {
    left: 100%;
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(147, 112, 219, 0.15);
}

/* Gradient text effect */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #9333ea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

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

/* Success checkmark animation */
.checkmark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: inline-block;
    stroke-width: 2;
    stroke: #4ade80;
    stroke-miterlimit: 10;
    animation: fill 0.4s ease-in-out 0.4s forwards,
               scale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #4ade80;
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

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

@keyframes fill {
    100% {
        box-shadow: inset 0px 0px 0px 30px #4ade80;
    }
}

/* Magical sparkle effect */
.sparkle {
    position: relative;
}

.sparkle::before,
.sparkle::after {
    content: '✨';
    position: absolute;
    font-size: 20px;
    animation: sparkleMove 3s linear infinite;
}

.sparkle::before {
    top: -10px;
    left: -10px;
    animation-delay: 0s;
}

.sparkle::after {
    bottom: -10px;
    right: -10px;
    animation-delay: 1.5s;
}

@keyframes sparkleMove {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(360deg);
    }
}

/* Form input focus effects */
.magic-input {
    transition: all 0.3s ease;
    position: relative;
}

.magic-input:focus {
    box-shadow: 0 0 0 3px rgba(147, 112, 219, 0.1);
    border-color: #9333ea;
    transform: translateY(-2px);
}

/* Tooltip styles */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #6b46c1;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
}

.tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #6b46c1 transparent transparent transparent;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Mobile menu animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-down {
    animation: slideDown 0.3s ease-out;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .float-animation {
        animation: none;
    }

    .cloud-float {
        animation-duration: 30s;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none;
    }

    body {
        background: white;
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #9333ea;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@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;
    }
}
