:root {
    --transition-speed: 0.3s;
}

/* Smooth Theme Transition */
::view-transition-old(root),
::view-transition-new(root) {
    animation-duration: 0.5s;
}

html,
body {
    transition: background-color var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed);
}

header,
main,
footer,
#audioPlayerContainer,
#mobileMenu,
.dropdown-menu,
.category-tab {
    transition: background-color var(--transition-speed), border-color var(--transition-speed), color var(--transition-speed), transform var(--transition-speed);
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Skeleton Loader */
.skeleton {
    background: #f1f5f9;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: shimmer 1.5s infinite;
}

.dark .skeleton {
    background: #1e1e1e;
}

.dark .skeleton::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

.search-match {
    font-weight: 800;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
    transition: background 0.3s;
}

#mainContent.is-scrolling::-webkit-scrollbar-thumb,
#mainContent:hover::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

.dark #mainContent.is-scrolling::-webkit-scrollbar-thumb,
.dark #mainContent:hover::-webkit-scrollbar-thumb {
    background: #333;
}

::selection {
    background: #000;
    color: #fff;
}

*:focus-visible {
    outline: 2px solid #000;
    outline-offset: 2px;
}

.dark *:focus-visible {
    outline: 2px solid #fff;
}

/* Modern Accordion */
details summary::-webkit-details-marker {
    display: none;
}

details[open] summary i.ph-caret-down {
    transform: rotate(180deg);
}

/* Marquee Support */
.marquee-container {
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    overflow: hidden;
}

@media (min-width: 768px) {
    .marquee-container {
        mask-image: none !important;
        -webkit-mask-image: none !important;
    }
}

#playerTitle {
    display: inline-block;
    white-space: nowrap;
}

#playerTitle.marquee-active {
    animation: marquee-scroll var(--marquee-duration, 10s) ease-in-out infinite alternate;
}

@keyframes marquee-scroll {
    0% {
        transform: translateX(0);
    }

    10% {
        transform: translateX(0);
    }

    90% {
        transform: translateX(var(--scroll-x, -50%));
    }

    100% {
        transform: translateX(var(--scroll-x, -50%));
    }
}

/* Waveform Styles */
#waveform {
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.wave-bar {
    width: 2px;
    background: #e2e8f0;
    border-radius: 1px;
    transition: background 0.1s, height 0.3s;
}

.dark .wave-bar {
    background: rgba(255, 255, 255, 0.1);
}

.wave-bar.active {
    background: #000;
}

.dark .wave-bar.active {
    background: #fff;
}

/* Equalizer Animation */
.equalizer .bar {
    animation: eq-play 1s infinite alternate ease-in-out;
}

.equalizer .bar-1 {
    animation-delay: -0.1s;
    animation-duration: 0.6s;
}

.equalizer .bar-2 {
    animation-delay: -0.3s;
    animation-duration: 0.5s;
}

.equalizer .bar-3 {
    animation-delay: -0.0s;
    animation-duration: 0.7s;
}

.equalizer .bar-4 {
    animation-delay: -0.2s;
    animation-duration: 0.4s;
}

.equalizer .bar-5 {
    animation-delay: -0.4s;
    animation-duration: 0.8s;
}

@keyframes eq-play {
    0% {
        height: 15%;
    }

    100% {
        height: 100%;
    }
}

/* --- Blog & Sidebar Features --- */

.blog-card {
    background: rgba(255, 255, 255, 0.5);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

.dark .blog-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.blog-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.blog-card .author-name {
    font-size: 14px;
}

.blog-card .post-date {
    font-size: 12px;
    letter-spacing: normal;
    text-transform: none;
}

.blog-content {
    font-size: 14px;
}

.dark .blog-content {
    color: #c8ccd4;
}

#blogSidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#blogSidebar.open {
    transform: translateX(0);
}

#sidebarOverlay.active {
    display: block;
    opacity: 1;
}

.sidebar-pill {
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
}

.dark .sidebar-pill {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-pill:hover {
    background: rgba(0, 0, 0, 0.1);
}

.dark .sidebar-pill:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-album-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 12px;
    transition: background 0.2s;
}

.sidebar-album-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dark .sidebar-album-item:hover {
    background: rgba(255, 255, 255, 0.05);
}



/* Category List Style */
.sidebar-list-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    font-size: 14px;
    color: #64748b;
    transition: all 0.2s;
    text-align: left;
}

.dark .sidebar-list-item {
    color: #a1a1aa;
}

.sidebar-list-item:hover {
    color: #0f172a;
}

.dark .sidebar-list-item:hover {
    color: #ffffff;
}

.sidebar-list-item.active {
    color: #0f172a;
    font-weight: 700;
}

.dark .sidebar-list-item.active {
    color: #ffffff;
}

.sidebar-list-dots {
    flex: 1;
    border-bottom: 1px dotted rgba(0,0,0,0.15);
    height: 12px;
}

.dark .sidebar-list-dots {
    border-bottom: 1px dotted rgba(255,255,255,0.15);
}

.sidebar-list-count {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    background: rgba(0,0,0,0.03);
    padding: 2px 8px;
    border-radius: 6px;
}

.dark .sidebar-list-count {
    color: #71717a;
    background: rgba(255,255,255,0.03);
}

/* Mobile Floating Sidebar Button */
.sidebar-float-btn {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 56px;
    background: #0f172a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50px 0 0 50px;
    z-index: 35;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
    font-size: 18px;
}

.dark .sidebar-float-btn {
    background: #ffffff;
    color: #0f172a;
}

/* Like Button on Blog Cards */
.blog-card-like-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 99px;
    background: rgba(0,0,0,0.03);
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.2s;
}

.dark .blog-card-like-btn {
    background: rgba(255,255,255,0.03);
    color: #a1a1aa;
}

.blog-card-like-btn:hover {
    background: rgba(0,0,0,0.06);
    color: #0f172a;
}

.dark .blog-card-like-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #ffffff;
}

.blog-card-like-btn.liked {
    background-color: #5d4037 !important;
    background: #5d4037 !important;
    color: #ffffff !important;
}

.blog-card-like-btn.liked i {
    color: #ffffff !important;
}

.blog-card-like-btn.liked:hover {
    background-color: #4e362f !important;
}


/* Handle Mobile Sidebar as Full Screen */
@media (max-width: 767px) {
    #blogSidebar {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        background: white;
        z-index: 60;
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        display: none; /* Controlled by JS initially */
        flex-direction: column;
    }

    .dark #blogSidebar {
        background: #0D0D0D;
    }

    #blogSidebar.open {
        display: flex;
        transform: translateX(0);
    }

    .sidebar-content-wrapper {
        padding: 24px;
        overflow-y: auto;
        flex: 1;
        scrollbar-width: none;
    }

    .sidebar-content-wrapper::-webkit-scrollbar {
        display: none;
    }

    .mobile-sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 24px;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    .dark .mobile-sidebar-header {
        border-color: rgba(255,255,255,0.05);
    }
}

@media (min-width: 768px) {
    .sidebar-float-btn, .mobile-sidebar-header {
        display: none !important;
    }
    #blogSidebar {
        display: block !important;
        transform: none !important;
    }
}