/* 
* Theme Toggle Styles
*/

/* Toggle container */
.theme-toggle {
    position: relative;
    width: 46px;
    height: 24px;
    margin-right: 20px;
}

/* Hide default checkbox */
.toggle-input {
    position: absolute;
    opacity: 0;
    height: 0;
    width: 0;
}

/* The slider */
.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e0e0e0;
    transition: .4s;
    border-radius: 24px;
}

/* The toggle circle */
.toggle-label:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

/* Move the toggle when checked */
input:checked + .toggle-label:before {
    transform: translateX(22px);
    background-color: #151515;
}

/* Change background when checked */
input:checked + .toggle-label {
    background-color: #333;
}

/* Moon icon */
.toggle-label:after {
    content: '\f186'; /* moon icon Unicode */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    left: 7px;
    top: 6px;
    font-size: 12px;
    transition: .4s;
    z-index: 5;
}

/* Light mode animation for the moon icon */
body:not(.dark) .toggle-label:after {
    background: linear-gradient(120deg, #3f51b5, #8e24aa, #5c6bc0, #9c27b0);
    background-size: 300% 300%;
    animation: gradientMove 8s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

/* Sun icon when checked */
input:checked + .toggle-label:after {
    content: '\f185'; /* sun icon Unicode */
    left: 28px;
}

/* Dark mode animation for the sun icon */
body.dark .toggle-label:after {
    background: linear-gradient(270deg, #35a79c, #209cb3, #1e4a69, #35a79c);
    background-size: 800% 800%;
    animation: cosmic-gradient 8s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    display: inline-block;
    text-shadow: none;
}

/* Toggle icon for improved animation */
.toggle-icon {
    position: absolute;
    z-index: 3;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

/* Moon icon in the toggle when in dark mode (appears when hovering) */
body.dark .toggle-label:before {
    z-index: 3;
}

/* Note: Animation styles are now in this file */

/* Add keyframes for animations to ensure they work in this file */
@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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