/* Custom CSS for JMelody Landing Page */

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Particle System Canvas */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

/* Hero Section Animations */
.logo-pulse {
    animation: logo-pulse 2s ease-in-out infinite;
}

@keyframes logo-pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.6));
    }
}

.typewriter-text {
    overflow: hidden;
    border-right: 2px solid #6366f1;
    white-space: nowrap;
    animation: typewriter 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typewriter {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: #6366f1 }
}

.icon-rotate {
    transition: transform 0.3s ease;
}

.icon-rotate:hover {
    transform: rotate(360deg);
}

.waveform-scroll {
    transition: all 0.3s ease;
}

.gradient-shift {
    background: linear-gradient(45deg, #6366f1, #d946ef, #06b6d4, #6366f1);
    background-size: 400% 400%;
    animation: gradient-shift 6s ease infinite;
}

@keyframes gradient-shift {
    0% { background-position: 0% 50% }
    50% { background-position: 100% 50% }
    100% { background-position: 0% 50% }
}

.stagger-animation > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.button-ripple {
    position: relative;
    overflow: hidden;
}

.button-ripple::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, height 0.6s;
}

.button-ripple:active::after {
    width: 300px;
    height: 300px;
}

/* Reduce particle opacity on mobile for better performance */
@media (max-width: 768px) {
    #particles-canvas {
        opacity: 0.4;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #particles-canvas {
        opacity: 0.3;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #particles-canvas {
        display: none;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Ensure all sections stay within viewport */
body > * {
    max-width: 100vw;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #4f46e5;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6366f1;
}

/* Waveform animation */
.waveform-bar {
    width: 2px;
    background: rgba(129, 140, 248, 0.6);
    animation: pulse 1.2s ease-in-out infinite;
    transition: background 0.3s ease;
}

.waveform-bar:hover {
    background: rgba(129, 140, 248, 1);
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Gradient text animation */
@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animate-gradient {
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

/* Card hover effects */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Button ripple effect */
.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::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, height 0.6s;
}

.btn-primary:active::after {
    width: 300px;
    height: 300px;
}

/* Backdrop blur support */
@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    .backdrop-blur {
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

/* Mobile menu animation */
#mobile-menu {
    transition: all 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

#mobile-menu.show {
    max-height: 500px;
}

/* Loading animation for form submit */
.loading {
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '...';
    animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
    0%, 20% {
        content: '';
    }
    40% {
        content: '.';
    }
    60% {
        content: '..';
    }
    80%, 100% {
        content: '...';
    }
}

/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Smooth transitions for interactive elements */
a, button, input, select, textarea {
    transition: all 0.2s ease;
}

/* Enhance play button hover effect */
.play-button-container {
    transition: transform 0.3s ease;
}

.play-button-container:hover {
    transform: scale(1.1);
}

/* Typography improvements */
h1, h2, h3 {
    letter-spacing: -0.025em;
}

/* Custom selection color */
::selection {
    background-color: rgba(99, 102, 241, 0.3);
    color: #f1f5f9;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Background gradient animation */
@keyframes bg-gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Ensure mobile menu is hidden by default */
@media (max-width: 768px) {
    #mobile-menu:not(.show) {
        display: none;
    }
    
    #mobile-menu.show {
        display: block;
    }
}

/* Print styles */
@media print {
    .sticky {
        position: relative;
    }
    
    .backdrop-blur {
        backdrop-filter: none;
    }
}

/* Responsive utilities */
@media (max-width: 640px) {
    .text-4xl {
        font-size: 2rem;
    }
    
    .text-6xl {
        font-size: 2.5rem;
    }
    
    /* Adjust background blobs for mobile to prevent overflow */
    .pointer-events-none > div {
        max-width: 80vw;
        max-height: 80vw;
    }
    
    /* Reduce gaps on mobile */
    .gap-6 {
        gap: 1rem;
    }
    
    /* Ensure hero section items wrap properly */
    .flex.items-center.gap-6 {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
}

/* Music Player Styles */
.music-player-container {
    transition: all 0.3s ease;
}

.music-player-container:hover {
    transform: translateY(-2px);
}

.progress-bar-container {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.progress-bar-container:hover {
    background-color: rgba(148, 163, 184, 0.3);
}

.volume-bar-container {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.volume-bar-container:hover {
    background-color: rgba(148, 163, 184, 0.3);
}

.control-button {
    transition: all 0.2s ease;
    cursor: pointer;
}

.control-button:hover {
    transform: scale(1.1);
    background-color: rgba(255, 255, 255, 0.1);
}

.play-button {
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.play-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.play-button:active {
    transform: scale(0.95);
}

.album-art {
    transition: all 0.3s ease;
}

.album-art:hover {
    transform: scale(1.05);
}

/* Animation for music player loading */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
}

.loading-pulse {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* Responsive music player */
@media (max-width: 640px) {
    .music-player-container {
        padding: 1rem;
    }
    
    .album-art {
        width: 3rem;
        height: 3rem;
    }
    
    .control-button {
        padding: 0.5rem;
    }
    
    .play-button {
        padding: 0.75rem;
    }
}

/* Logo optimization */
.logo-image {
    transition: transform 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.05);
}

/* Ensure logo maintains aspect ratio */
.logo-container img {
    max-width: 100%;
    height: auto;
}

/* Welcome Modal Styles */
#welcome-modal {
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#welcome-modal:not(.hidden) {
    display: flex !important;
}

#welcome-modal.hidden {
    opacity: 0;
    pointer-events: none;
}

#welcome-modal:not(.hidden) {
    opacity: 1;
}

/* Modal backdrop */
#welcome-modal .absolute.inset-0 {
    transition: opacity 0.3s ease;
}

/* Modal content animations */
#welcome-modal .rounded-3xl {
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

#welcome-modal:not(.hidden) .rounded-3xl {
    transform: scale(1);
}

/* Modal button hover effects */
#modal-play-btn {
    position: relative;
    overflow: hidden;
}

#modal-play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#modal-play-btn:active::before {
    width: 300px;
    height: 300px;
}

/* Modal responsive adjustments */
@media (max-width: 640px) {
    #welcome-modal .rounded-3xl {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    #welcome-modal h3 {
        font-size: 1.5rem;
    }
    
    #welcome-modal .flex.h-20.w-20 {
        height: 4rem;
        width: 4rem;
    }
    
    #welcome-modal .h-10.w-10 {
        height: 1.5rem;
        width: 1.5rem;
    }
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}

/* Modal focus management */
#welcome-modal:not(.hidden) {
    display: flex !important;
}

/* Modal accessibility */
#welcome-modal:focus {
    outline: none;
}

#modal-play-btn:focus,
#modal-close-btn:focus {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Optimize for touch devices */
@media (hover: none) {
    .hover\:shadow-lg {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    }
    
    .control-button:hover {
        transform: none;
        background-color: transparent;
    }
    
    .play-button:hover {
        transform: none;
        box-shadow: 0 4px 25px rgba(0, 0, 0, 0.15);
    }
    
    .logo-image:hover {
        transform: none;
    }
}

/* Enhanced form styles */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: #ffffff;
    -webkit-box-shadow: 0 0 0px 1000px #0f172a inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* ===== PHASE 3: ADVANCED SCROLL EFFECTS ===== */

/* Parallax Elements */
.parallax-bg {
    transform: translateZ(-1px) scale(2);
    z-index: -1;
}

.parallax-medium {
    transform: translateZ(-0.5px) scale(1.5);
}

.parallax-slow {
    transform: translateZ(-0.3px) scale(1.3);
}

/* Scroll Reveal Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-reveal-scale.revealed {
    opacity: 1;
    transform: scale(1);
}

/* Staggered Scroll Reveals */
.stagger-scroll > * {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.stagger-scroll.revealed > *:nth-child(1) { transition-delay: 0.1s; }
.stagger-scroll.revealed > *:nth-child(2) { transition-delay: 0.2s; }
.stagger-scroll.revealed > *:nth-child(3) { transition-delay: 0.3s; }
.stagger-scroll.revealed > *:nth-child(4) { transition-delay: 0.4s; }
.stagger-scroll.revealed > *:nth-child(5) { transition-delay: 0.5s; }
.stagger-scroll.revealed > *:nth-child(6) { transition-delay: 0.6s; }

.stagger-scroll.revealed > * {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll Progress Indicator */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #d946ef, #06b6d4);
    z-index: 1000;
    transition: width 0.1s ease;
}

/* Blur on Scroll */
.blur-on-scroll {
    transition: filter 0.3s ease;
}

.blur-on-scroll.blurred {
    filter: blur(4px);
}

/* Gradient Flow Between Sections */
.gradient-flow {
    background: linear-gradient(45deg, 
        rgba(99, 102, 241, 0.1) 0%,
        rgba(217, 70, 239, 0.1) 25%,
        rgba(6, 182, 212, 0.1) 50%,
        rgba(217, 70, 239, 0.1) 75%,
        rgba(99, 102, 241, 0.1) 100%);
    background-size: 400% 400%;
    animation: gradient-flow 8s ease infinite;
}

@keyframes gradient-flow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Card Expand on Scroll */
.card-expand {
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: center;
}

.card-expand.expanded {
    transform: scale(1.05);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

/* Section Background Transitions */
.section-bg-transition {
    background: linear-gradient(180deg, 
        transparent 0%,
        rgba(99, 102, 241, 0.05) 20%,
        rgba(217, 70, 239, 0.05) 40%,
        rgba(6, 182, 212, 0.05) 60%,
        transparent 100%);
    transition: background-position 0.5s ease;
}

/* Scroll-triggered Typography */
.scroll-typography {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.scroll-typography.revealed {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Performance Optimizations for Scroll Effects */
.scroll-optimized {
    will-change: transform, opacity;
}

/* Reduced Motion Support for Scroll Effects */
@media (prefers-reduced-motion: reduce) {
    .scroll-reveal,
    .scroll-reveal-left,
    .scroll-reveal-right,
    .scroll-reveal-scale,
    .stagger-scroll > *,
    .scroll-typography {
        transition: none;
        opacity: 1;
        transform: none;
    }
    
    .card-expand {
        transition: none;
    }
    
    .gradient-flow {
        animation: none;
    }
}

/* ===== PHASE 4: ELABORATED INTERACTIONS ===== */

/* Enhanced Ripple Effect */
.ripple-effect {
    position: relative;
    overflow: hidden;
    transform: translate3d(0, 0, 0);
}

.ripple-effect::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

.ripple-effect:active::before {
    width: 300px;
    height: 300px;
}

/* Enhanced Card Hover Effects */
.card-glow {
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.card-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: linear-gradient(45deg, 
        rgba(99, 102, 241, 0.1) 0%,
        rgba(217, 70, 239, 0.05) 50%,
        rgba(6, 182, 212, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.card-glow:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(99, 102, 241, 0.2),
        0 0 30px rgba(99, 102, 241, 0.1);
}

.card-glow:hover::before {
    opacity: 1;
}

/* Form Field Enhancements */
.form-field {
    position: relative;
    transition: all 0.3s ease;
}

.form-field:focus-within {
    transform: translateY(-2px);
}

.form-field input,
.form-field select,
.form-field textarea {
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: rgba(15, 23, 42, 0.8);
}

/* Floating Label Effect */
.floating-label {
    position: relative;
}

.floating-label label {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
    pointer-events: none;
    background: linear-gradient(transparent 50%, #0f172a 50%);
    padding: 0 4px;
}

.floating-label input:focus + label,
.floating-label input:not(:placeholder-shown) + label,
.floating-label select:focus + label,
.floating-label select:not([value=""]) + label,
.floating-label textarea:focus + label,
.floating-label textarea:not(:placeholder-shown) + label {
    top: 0;
    transform: translateY(-50%) scale(0.85);
    color: #6366f1;
}

/* Icon Morph Animations */
.icon-morph {
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.icon-morph:hover {
    transform: scale(1.2) rotate(15deg);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.4));
}

/* 3D Elevation Effects */
.elevation-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
}

.elevation-3d:hover {
    transform: translateY(-4px) rotateX(5deg) rotateY(5deg);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Skeleton Loading Animation */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.06) 25%, 
        rgba(255, 255, 255, 0.15) 50%, 
        rgba(255, 255, 255, 0.06) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 2s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Enhanced Button Hover Effects */
.btn-enhanced {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: linear-gradient(45deg, #6366f1, #d946ef);
    background-size: 200% 200%;
}

.btn-enhanced:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 
        0 10px 25px rgba(99, 102, 241, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    background-position: 100% 100%;
}

.btn-enhanced:active {
    transform: translateY(0) scale(0.98);
}

/* Magnetic Button Effect */
.magnetic-btn {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
}

.magnetic-btn:hover {
    transform: scale(1.05);
}

/* Text Glow Effect */
.text-glow {
    text-shadow: 0 0 20px rgba(99, 102, 241, 0.5);
    transition: text-shadow 0.3s ease;
}

.text-glow:hover {
    text-shadow: 0 0 30px rgba(99, 102, 241, 0.8);
}

/* Border Animation */
.border-animate {
    position: relative;
    border: 1px solid transparent;
    background: linear-gradient(45deg, #6366f1, #d946ef, #06b6d4) border-box;
    -webkit-mask: 
        linear-gradient(#fff 0 0) padding-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.border-animate::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #6366f1, #d946ef, #06b6d4, #6366f1);
    background-size: 400% 400%;
    border-radius: inherit;
    animation: border-shift 3s ease infinite;
    z-index: -1;
}

@keyframes border-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Reduced Motion Support for Interactions */
@media (prefers-reduced-motion: reduce) {
    .ripple-effect::before,
    .card-glow,
    .form-field,
    .icon-morph,
    .elevation-3d,
    .btn-enhanced,
    .magnetic-btn,
    .border-animate::before {
        transition: none;
        animation: none;
    }
    
    .card-glow:hover,
    .elevation-3d:hover,
    .btn-enhanced:hover,
    .magnetic-btn:hover {
        transform: none;
    }
    
    .skeleton {
        animation: none;
        background: rgba(255, 255, 255, 0.06);
    }
}
