:root {
    /* These will be overridden by theme_managment.js */
    --theme-background: aquamarine;
    --theme-primary: #479dda;
    --theme-secondary: #80b5db;
    --theme-text: black;
    --theme-border: #ccc;
    --theme-accent: cyan;
    --theme-menuBackground: rgba(5, 134, 227, 0.75);
    --theme-cardBackground: white;
    --theme-buttonBackground: #afdeff;
    --theme-inputBackground: white;
    --theme-shadowColor: rgba(0, 0, 0, 0.3);
    --theme-glowColor: rgba(0, 238, 255, 0.4);
    --theme-overlayBackground: rgba(255, 255, 255, 0.8);
    --theme-scrollbarTrack: lightseagreen;
    --theme-scrollbarThumb: darkcyan;
    --theme-footerBackground: rgba(0, 120, 139, 0.5);
    --theme-tooltipBackground: rgba(0, 65, 156, 0.8);
}

* {
    color: var(--theme-text);
    border-color: var(--theme-border);
}

@keyframes elementFold {
    0% { transform: scale(0.1) scaleX(0.5) translateY(-50px) translateX(-5000px); opacity: 0; }
    60% { transform: scale(1.1) scaleX(1.2) translateY(10px) translateX(100px); opacity: 0.8; }
    75%, 85% { transform: scale(0.9) scaleX(0.8) translateY(-5px) translateX(50px); opacity: 0.9; }
    80% { transform: scale(0.9) scaleX(0.8) translateY(-5px) translateX(75px); opacity: 0.9; }
    100% { transform: scale(1) scaleX(1) translateY(0) translateX(0); opacity: 1; }
}

@keyframes elementFoldUp {
    0% { transform: scale(1) scaleX(1) translateY(0); opacity: 1; }
    40% { transform: scale(1.1) scaleX(1.2) translateY(10px); opacity: 0.8; }
    100% { transform: scale(0.1) scaleX(0.5) translateY(-50px); opacity: 0; }
}

@keyframes elementFoldReverse {
    0% { transform: scale(1) scaleX(1) translateY(0) translateX(0); opacity: 1; }
    40% { transform: scale(0.9) scaleX(0.8) translateY(-5px) translateX(50px); opacity: 0.9; }
    60% { transform: scale(1.1) scaleX(1.2) translateY(10px) translateX(100px); opacity: 0.8; }
    100% { transform: scale(0.1) scaleX(0.5) translateY(-50px) translateX(-5000px); opacity: 0; }
}

@keyframes spaceDrift {
    0% { 
        transform: scale(1) rotate(0deg); 
        opacity: 1;
        filter: blur(0);
    }
    100% { 
        transform: scale(0.5) rotate(var(--drift-angle, 45deg)) translate(var(--drift-distance, 300px));
        opacity: 0;
        filter: blur(10px);
    }
}

.page-element {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    will-change: transform, opacity;
}

.page-element.initial-state {
    opacity: 0;
    transform: scale(0.1);
    transition: none;
}

.page-element.fade-transition {
    opacity: 0;
    transform: scale(0.9);
}

.page-element.pre-animation {
    opacity: 0;
    transform: scale(0.9);
}

.page-element.visible {
    opacity: 1;
    transform: scale(1);
}

.is-reloading .page-element {
    animation-delay: var(--animation-delay, 0ms);
}

.animate-in {
    animation: elementFold 0.8s ease-out forwards !important;
    animation-delay: var(--animation-delay, 0s);
}

.fresh-load .animate-in {
    animation-delay: 0s; /* No delay for fresh loads */
}

.animate-out {
    animation: spaceDrift 1.2s ease-in-out forwards;
    animation-delay: var(--animation-delay, 0ms);
    pointer-events: none;
}

.page-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--theme-background);
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s ease-in-out;
    z-index: 99999;
    backdrop-filter: blur(0px);
}

.page-overlay.fade-in {
    opacity: 0.95;
    backdrop-filter: blur(8px);
}

#rootPageSection {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;
    align-items: top;
    position: relative !important;
    margin-top: 100px !important;
    margin-inline: 10px;
    margin-bottom: 10px;
    gap: 8px;
}

.main-content-section {
    display: flex;
    flex-direction: column;
    position: relative !important;
    border: 3px solid #ccc;
    border-radius: 15px;
    background: #479dda;
    padding: 10px;
    padding-bottom: 10px !important;
    height: auto;
    min-height: 100px !important;
    max-height: 450px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    margin-inline-end: 28.5vw;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.375), inset 0 0 10px rgba(0, 0, 0, 0.45);
    gap: 8px;
}

.featuredTagBackdrop {
    position: relative;
    border: 3px solid #ccc;
    border-radius: 15px;
    background: white;
    height: fit-content;
    width: fit-content;
    padding-inline: 10px;
    box-sizing: border-box;
    box-shadow: inset 0 0 9.5px rgba(0, 0, 0, 0.45);
    margin-right: 0;
    user-select: none !important;
}

.featuredTag {
    position: relative;
    font-weight: bold;
    border: 3px solid #ccc;
    border-radius: 1cm;
    background: #80b5db;
    width: fit-content;
    padding: 8.5px;
    text-align: center;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.375), inset 0 0 10px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: all 0.3s;
}

.featuredTag:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.375), inset 0 0 15px rgba(0, 0, 0, 0.45), 0 0 10px rgba(0, 0, 0, 0.45);
    background: rgb(0, 210, 210);
}

#featuredContentSection {
    position: relative;
    border: 3px solid #ccc;
    border-radius: 15px;
    background: #479dda;
    padding: 20px;
    max-height: 600px !important;
    min-height: 200px !important;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.375), inset 0 0 10px rgba(0, 0, 0, 0.45);
    overflow-y: auto !important;
    overflow-x: auto !important;
    transition: all 0.3s;
}

#verticalShowcase {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: start;
    position: relative;
    border: 3px solid #ccc;
    border-radius: 15px;
    background: #80b5db;
    box-sizing: border-box;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.65);
    padding: 10px;
    overflow: auto;
    gap: 12px;
}

#verticalShowcase::-webkit-scrollbar {
    width: 5px;
    scroll-padding-right: 5px;
    position: absolute !important;
}

#verticalShowcase::-webkit-scrollbar-track {
    background: darkcyan;
    border-radius: 1cm;
    box-sizing: border-box;
}

#verticalShowcase::-webkit-scrollbar-thumb {
    cursor: pointer !important;
    background: cyan;
    border-radius: 1cm;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 1), inset 0 0 18.5px rgba(0, 0, 0, 0.25);
}

#verticalShowcase::-webkit-scrollbar-thumb:hover {
    background: rgb(0, 210, 210);
}

#v-showcase {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    height: fit-content;
    min-height: 400px;
    max-height: 450px;
    width: fit-content;
    min-width: 200px;
    max-width: 400px;
    border: 2px solid #ccc;
    border-radius: 15px;
    background: white;
    padding: 8.5px;
}

.showcasePreviewImage {
    position: relative;
    border: 2px solid #ccc;
    border-radius: 15px;
    background: #80b5db;
    padding: 10px;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.375), inset 0 0 10px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: all 0.3s;
    overflow: hidden;
    max-height: 240px;
    max-width: 240px;
}

.featured-description {
    position: relative;
    border: 2px solid #ccc;
    border-radius: 15px;
    background: #80b5db;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-inline: 2.5px;
    text-align: center;
}

.dividerShowcase {
    width: 100%;
    margin-top: -10px;
}

.furthermoreDescription {
    text-align: bottom center;
    font-weight: bold;
    margin-top: -20px;
}

#tryButtonShowcase {
    cursor: pointer;
    background: rgb(82, 234, 82);
    border: 2px solid #ccc;
    border-radius: 1cm;
    margin-top: -20px;
}

counter-increment {
    --counter: var(--counter)
}

#footerContainer {
    display: flex;
    flex-direction: row !important;
    justify-content: start !important;
    align-items: center;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: auto;
    margin: 0;
    padding: 4.5px 15px;
    background: repeating-linear-gradient(rgba(0, 120, 139, 0.5), rgba(5, 134, 227, 0.5));
    border: 3px solid #ccc;
    border-bottom: none;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    gap: 8px;
    z-index: 14000 !important;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    /* Modify animation behavior */
    transform-origin: bottom left;
    will-change: transform, opacity;
}

@media (max-width: 762px) {
    #rootPageSection {
        margin-top: 80px !important;
        padding-inline: 20px !important;
    }

    .main-content-section {
        width: 500px !important;
        transform: scale(0.8) !important;
        transform-origin: top left !important;
        gap: 4px !important;
    }

    #featuredContentSection {
        transform: scale(0.8) !important;
        transform-origin: top left !important;
        top: -100px !important;
    }

    .showcasePreviewImage {
        max-height: 200px !important;
        max-width: 200px !important;
    }

    #footerContainer {
        transform: scale(0.8);
        transform-origin: bottom left;
    }

    .featuredTagBackdrop {
        top: -95px !important;
    }
}

.main-content-section::-webkit-scrollbar {
    width: 5px;
    scroll-padding-right: 5px;
    position: absolute !important;
}

.main-content-section::-webkit-scrollbar-track {
    background: darkcyan;
    border-radius: 1cqmax;
    box-sizing: border-box;
}

.main-content-section::-webkit-scrollbar-thumb {
    cursor: pointer !important;
    background: cyan;
    border-radius: 1cqmax;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 1), inset 0 0 18.5px rgba(0, 0, 0, 0.25);
}

.main-content-section::-webkit-scrollbar-thumb:hover {
    background: rgb(0, 210, 210);
}
