/* Base styles */
:root {
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-hover-bg: rgba(255, 255, 255, 0.05);
    --text-primary: rgba(255, 255, 255, 0.9);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent-gradient: linear-gradient(45deg, #FF79C6, #BD93F9, #8BE9FD);
}

.font-space-grotesk {
    font-family: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.dark {
    --card-bg: rgba(0, 0, 0, 0.2);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-hover-bg: rgba(0, 0, 0, 0.3);
}

/* Utility used in index.html */
.animate-gradient {
    background-size: 400% 400%;
    animation: gradientShift 6s ease infinite;
}

/* Base background setup */
.gradient-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    transform-style: preserve-3d;
    perspective: 1000px;
}

/* Primary Deep Space Background */
.gradient-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        215deg,
        #0a0f1f 0%,
        #1a1844 25%,
        #251660 50%,
        #1a1844 75%,
        #0a0f1f 100%
    );
    background-size: 400% 400%;
    animation: gradientFloat 30s ease infinite;
    opacity: 0.9;
}

/* Ambient Orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0;
    transition: all 1s ease;
}

.orb-1 {
    width: 800px;
    height: 800px;
    background: radial-gradient(circle at center, rgba(147, 51, 234, 0.15), transparent 70%);
    top: -20%;
    left: -10%;
    animation: orbFloat1 25s ease infinite;
}

.orb-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle at center, rgba(79, 70, 229, 0.15), transparent 70%);
    bottom: -10%;
    right: -5%;
    animation: orbFloat2 30s ease infinite;
}

.orb-3 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle at center, rgba(236, 72, 153, 0.15), transparent 70%);
    top: 40%;
    left: 60%;
    animation: orbFloat3 35s ease infinite;
}

/* Active States for Orbs */
.sound-playing .orb {
    opacity: 0.5;
    filter: blur(80px);
}

.multiple-sounds .orb {
    opacity: 0.7;
    filter: blur(70px);
}

.many-sounds .orb {
    opacity: 0.9;
    filter: blur(60px);
}

/* Subtle Noise Texture */
.noise {
    position: fixed;
    inset: 0;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyBAMAAADsEZWCAAAAElBMVEUAAAD8/vz08vT09PT8+vz///+Yqd4YAAAABXRSTlMoKCh/f39BJt3UAAAAQklEQVQ4y2NgQAX8DKiAH58EkoS2OJIEuz6ShKA+koS4PpIEv76SxKo+koS8PpKEtj6ShIA+koSQPpKEiD6SxGAFAKPtMxv1IqM5AAAAAElFTkSuQmCC');
    opacity: 0.02;
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 2;
}

/* Animations */
@keyframes gradientFloat {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes orbFloat1 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(100px, 50px) scale(1.1); }
    66% { transform: translate(-50px, 100px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes orbFloat2 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-100px, -50px) scale(1.1); }
    66% { transform: translate(50px, -100px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

@keyframes orbFloat3 {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -100px) scale(1.1); }
    66% { transform: translate(-100px, 50px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Dark Mode Adjustments */
.dark .gradient-bg::before {
    opacity: 1;
}

.dark .orb {
    filter: blur(120px);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .orb {
        filter: blur(80px);
    }
    
    .orb-1 { width: 400px; height: 400px; }
    .orb-2 { width: 300px; height: 300px; }
    .orb-3 { width: 250px; height: 250px; }
}

/* Glitch Text Effect */
.glitch-wrapper {
    position: relative;
    display: inline-block;
}

.glitch-text {
    position: relative;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shine 3s ease-in-out infinite;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9, 2px 2px #ff00c1;
    animation: glitch-anim2 1s infinite linear alternate-reverse;
}

/* Sound Cards */
.sound-card {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.sound-card:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.55), 0 8px 32px 0 rgba(31, 38, 135, 0.5);
}

.sound-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.5);
}

.sound-card.active {
    background: rgba(255, 121, 198, 0.15);
    border-color: rgba(255, 121, 198, 0.3);
    box-shadow: 0 8px 32px 0 rgba(255, 121, 198, 0.37);
}

.card-content {
    position: relative;
    padding: 2rem;
    z-index: 2;
    background: transparent;
    transition: transform 0.3s ease;
}

.sound-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sound-card:hover .sound-icon-wrapper {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.sound-card.active .sound-icon-wrapper {
    background: var(--accent-gradient);
    border-color: rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
}

/* Optional: Add a subtle inner glow to active cards */
.sound-card.active::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at center,
        rgba(255, 121, 198, 0.2),
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sound-card.active:hover::before {
    opacity: 1;
}

/* Volume Slider */
.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.05);
    backdrop-filter: blur(5px);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

/* Track styling */
.volume-slider::-webkit-slider-runnable-track {
    height: 12px;
    border-radius: 20px;
    background: linear-gradient(
        90deg,
        rgb(255, 73, 167) 0%,
        rgb(255, 140, 85) var(--value, 50%),
        rgba(255,255,255,0.1) var(--value, 50%)
    );
}

/* Thumb styling */
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    box-shadow: 
        0 0 20px rgba(255,73,167,0.5),
        0 0 0 4px rgba(255,255,255,0.1);
    transition: transform 0.2s ease;
    margin-top: -6px; /* Center the thumb */
}

/* Hover effects */
.volume-slider:hover {
    height: 14px;
    transform: translateY(-1px);
}

.volume-slider:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

/* Active state */
.volume-slider:active::-webkit-slider-thumb {
    transform: scale(0.95);
    box-shadow: 
        0 0 30px rgba(255,73,167,0.7),
        0 0 0 6px rgba(255,255,255,0.2);
}

/* Firefox specific styles */
.volume-slider::-moz-range-track {
    height: 12px;
    border-radius: 20px;
    background: linear-gradient(
        90deg,
        rgb(255, 73, 167) 0%,
        rgb(255, 140, 85) var(--value, 50%),
        rgba(255,255,255,0.1) var(--value, 50%)
    );
}

.volume-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: white;
    box-shadow: 
        0 0 20px rgba(255,73,167,0.5),
        0 0 0 4px rgba(255,255,255,0.1);
    transition: transform 0.2s ease;
}

/* Play Button */
.play-button {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    font-size: 1.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.button-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.button-glow {
    position: absolute;
    inset: -5px;
    background: var(--accent-gradient);
    filter: blur(15px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.play-button:hover .button-glow {
    opacity: 0.5;
}

.play-button:hover .button-content {
    transform: scale(0.95);
}

/* Animations */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shine {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes glitch-anim {
    0% { clip: rect(44px, 450px, 56px, 0); }
    20% { clip: rect(4px, 450px, 96px, 0); }
    40% { clip: rect(64px, 450px, 36px, 0); }
    60% { clip: rect(24px, 450px, 76px, 0); }
    80% { clip: rect(84px, 450px, 16px, 0); }
    100% { clip: rect(14px, 450px, 86px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(24px, 450px, 76px, 0); }
    20% { clip: rect(84px, 450px, 16px, 0); }
    40% { clip: rect(44px, 450px, 56px, 0); }
    60% { clip: rect(4px, 450px, 96px, 0); }
    80% { clip: rect(64px, 450px, 36px, 0); }
    100% { clip: rect(14px, 450px, 86px, 0); }
}

/* Media Queries */
@media (max-width: 640px) {
    .glitch-text {
        font-size: 3rem;
    }
    
    .sound-card {
        margin: 0 1rem;
    }
    
    .play-button {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }
}

.wave-text {
  background: linear-gradient(
    45deg,
    #6366f1,
    #8b5cf6,
    #ec4899,
    #6366f1
  );
  background-size: 300%;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  animation: wave-animation 8s ease-in-out infinite;
}

@keyframes wave-animation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.preset-card {
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.preset-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.preset-card button {
    transition: all 0.2s ease;
}

.preset-card button:hover {
    transform: scale(1.1);
}

.preset-card .delete-preset:hover {
    color: #ff4444;
}

.preset-card .play-preset:hover {
    color: #4eff4e;
}

/* Modal Animation */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#save-mix-modal[data-visible="true"] {
    display: flex;
    animation: modalFadeIn 0.2s ease-out;
}

#save-mix-modal > div {
    background-color: #1a1b26;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* Form Input Styles */
#mix-name {
    background-color: #2a2b36;
    color: white;
}

#mix-name::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Form Input Autofill Style */
#mix-name:-webkit-autofill {
    -webkit-text-fill-color: white !important;
    -webkit-box-shadow: 0 0 0px 1000px #2a2b36 inset !important;
    caret-color: white;
}

/* Alert Modal Animation */
#alert-modal[data-visible="true"] {
    display: flex;
    animation: modalFadeIn 0.2s ease-out;
}

#alert-modal > div {
    background-color: #1a1b26;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* Credits Modal Animation */
#credits-modal[data-visible="true"] {
    display: flex;
    animation: modalFadeIn 0.2s ease-out;
}

#credits-modal > div {
    background-color: #1a1b26;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* Shortcuts Modal Animation */
#shortcuts-modal[data-visible="true"] {
    display: flex;
    animation: modalFadeIn 0.2s ease-out;
}

#shortcuts-modal > div {
    background-color: #1a1b26;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

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

    .noise {
        display: none;
    }
}
