:root {
    --primary-bg: #0e0e0e;
    --primary-body-bg: #0a0a0a;
    --color-premium: 262 83% 58%;
    --color-success: 160 84% 40%;
    --color-warning: 45 93% 47%;
    --color-surface: 0 0% 6%;
    --color-on-surface: 0 0% 98%;
    --primary-text: #eee;
}

html,
body {
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.glass {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0);
    backdrop-filter: blur(10px);
    border-radius: 16px;
}

.badge {
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}

.nav-btn {
    border-radius: 12px;
}

.nav-btn.bg-white\/10 {
    position: relative;
}

#content {
    width: 100%;
}


.needs-scrolling {
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --radius: 0.75rem;
    overflow-y: auto !important;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.needs-scrolling::-webkit-scrollbar {
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --radius: 0.75rem;
    width: 6px;
}

.needs-scrolling::-webkit-scrollbar-track {
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --radius: 0.75rem;
    background: transparent;
    border-radius: 3px;
}

.needs-scrolling::-webkit-scrollbar-thumb {
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --radius: 0.75rem;
    background: hsl(var(--muted-foreground) / 0.2);
    border-radius: 3px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    background-clip: content-box;
}

.needs-scrolling:hover::-webkit-scrollbar-thumb {
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --radius: 0.75rem;
    background: hsl(var(--muted-foreground) / 0.4);
    border-radius: 3px;
}

.needs-scrolling::-webkit-scrollbar-thumb:hover {
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --radius: 0.75rem;
    background: hsl(var(--muted-foreground) / 0.6);
    border-radius: 3px;
}

.needs-scrolling::-webkit-scrollbar-thumb:active {
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --radius: 0.75rem;
    background: hsl(var(--muted-foreground) / 0.8);
    border-radius: 3px;
}

.needs-scrolling {
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --radius: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--muted-foreground) / 0.2) transparent;
}

.needs-shadow {
    box-shadow: 0 -25px 50px -12px rgb(104 104 104 / 40%), 0 -8px 25px -8px rgb(105 105 105 / 30%), 0 -4px 15px -4px rgb(0 0 0), 0 -2px 8px -2px rgb(172 172 172 / 36%), 0 0 18px 2px rgb(31 21 119 / 35%), inset 0 1px 0 rgb(255 255 255 / 34%), inset 0 -1px 0 rgb(201 201 201 / 39%) !important;
}

.needs-shadow-2 {
    box-shadow: 0 -25px 50px -12px rgb(17 17 17 / 34%), 0 -8px 25px -8px rgb(71 71 71 / 30%), 0 -4px 15px -4px rgb(0 0 0), 0 -2px 8px -2px rgb(34 34 34 / 36%), 0 0 18px 2px rgb(10 6 45 / 35%), inset 0 1px 0 rgb(19 19 19 / 34%), inset 0 -1px 0 rgb(47 47 47 / 39%) !important;
}

/* Card hover/elevation for launcher items */
[data-app-id] {
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
    border-radius: 16px;
}

[data-app-id]:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    background: rgba(255, 255, 255, 0.06);
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Status accents */
.is-success {
    color: hsl(var(--color-success));
}

.is-warning {
    color: hsl(var(--color-warning));
}

.is-premium {
    background: linear-gradient(135deg, hsl(262 83% 58%), hsl(270 70% 58%));
    color: white;
    border: none;
}

/* Iframe overlay polish */
.overlay-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, .6);
    backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.overlay-panel {
    width: 100%;
    max-width: 1000px;
    border-radius: 16px;
    overflow: hidden;
}

/* Container spacing */
.page-container {
    max-width: 80rem;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 768px) {
    .page-container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

.border-border-300 {
    border-color: hsl(48deg 2.7% 35.9% / 25%) !important;
}

.border-none-1 {
    border-color: transparent;
}

.jw-text-base {
    color: hsl(48 33.3% 97.1% / 1) !important;
}


nav {
    button {
        border-radius: 12px !important;
        border: 1px solid hsl(var(--color-primary) / 0.3);
        background: hsl(var(--color-primary) / 0.1);
        color: #787878;
        margin-bottom: 0.2rem;
        width: 100%;
        position: relative;
        overflow: hidden;
    }



    button.bg-white\/10 {
        font-weight: 500;
        color: #eee;
    }
}

.sidebar-toggle {
    position: absolute;
    opacity: 0;
    scale: 0.8;
    right: 13px;
    top: 30px;
    background: #131313;
    border: 2px solid #282828;
    border-radius: 11px;
    width: 26px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle:hover {
    background: #121212;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:active {
    transform: scale(0.95);
}

aside:hover .sidebar-toggle {
    opacity: 1;
}



/* Skeleton loader */
.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    animation: shimmer 1.2s infinite;
}

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

/* Sidebar hide/show animations */
body.sidebar-hidden aside {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
}

aside {
    transition: transform .35s cubic-bezier(.22, .61, .36, 1), opacity .35s ease;
}

/* Shift main content when sidebar hidden for a natural feel */
body.sidebar-hidden main header {
    padding-left: 1.25rem;
    transition: padding .35s cubic-bezier(.22, .61, .36, 1);
}

/* Smooth content area adjustments */
#content {
    transition: padding .3s ease, margin .3s ease;
}

/* Sidebar width animation so main expands smoothly */
aside {
    max-width: 16rem;
    width: 16rem;
    flex: 0 0 16rem;
    overflow: hidden;
    transition: max-width .35s cubic-bezier(.22, .61, .36, 1), width .35s cubic-bezier(.22, .61, .36, 1), padding .3s ease, border-color .3s ease, opacity .3s ease;
}

body.sidebar-hidden aside {
    max-width: 0 !important;
    width: 0 !important;
    flex-basis: 0 !important;
    transform: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-color: transparent !important;
    opacity: 0;
}


body.sidebar-hidden header {
    margin: 0rem !important;
    transition: all 0.3s ease;
    border: none !important;
    box-shadow: none !important;

}

/* Loading state for sidebar nav */
body.is-loading nav .nav-btn {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

body.is-loading nav .nav-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    animation: shimmer 1.2s infinite;
}

#page-controls .search-wrap {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);

    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all .3s cubic-bezier(.22, .61, .36, 1);
}

#page-controls .search-wrap:focus-within {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateZ(0) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

#page-controls input[type="search"] {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 0.85rem;
    width: 16rem;
}

#page-controls .chip {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.badge.method {
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}

.badge.method-get {
    background: rgba(16, 185, 129, .12);
    border-color: rgba(16, 185, 129, .35);
    color: #86efac;
}

.badge.method-post {
    background: rgba(59, 130, 246, .12);
    border-color: rgba(59, 130, 246, .35);
    color: #93c5fd;
}

.badge.method-put {
    background: rgba(234, 179, 8, .12);
    border-color: rgba(234, 179, 8, .35);
    color: #fde68a;
}

.badge.method-delete {
    background: rgba(239, 68, 68, .12);
    border-color: rgba(239, 68, 68, .35);
    color: #fca5a5;
}

.code-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
}

.needs-shadow-dark {
    backdrop-filter: blur(8px) brightness(0.8);
    box-shadow: -1px -9px 24px 20px rgb(0 0 0 / 47%), inset 10px -10px 24px 20px rgb(0 0 0 / 47%), 20px -19px 20px 20px rgb(0 0 0 / 44%);
    transition: all cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}

.needs-shadow-dark:hover,
.needs-shadow-dark:focus {
    transform: translateY(-1px) scale(1.05);
    box-shadow: -1px -9px 24px 20px rgba(0, 0, 0, 0.151), inset 10px -10px 24px 20px rgb(0 0 0 / 47%), 20px -19px 20px 20px rgb(0 0 0 / 44%);
}

/* Themes */
body.theme-dark {
    background: var(--primary-body-bg) !important;
    color: #ffffff;
}

body.theme-blue {
    background: linear-gradient(135deg, #030712 0%, #0f172a 100%) fixed !important;
    color: #e5e7eb;
}

body.theme-blue .needs-shadow-dark {
    backdrop-filter: blur(18px) brightness(0.8);
    box-shadow: -1px -9px 24px 20px rgba(0, 0, 0, 0.105), inset 10px -10px 24px 20px rgba(0, 0, 0, 0.123), 20px -19px 20px 20px rgba(0, 0, 0, 0.037);
    transition: all cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}

body.theme-light {
    background: #ffffff !important;
    color: #0b0b0b;
}

/* Light theme readability overrides */
body.theme-light .glass {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.10);
}

body.theme-light .badge {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.12);
    color: #0b0b0b;
}

body.theme-light nav .nav-btn {
    background: rgba(0, 0, 0, 0);
    border-color: rgba(0, 0, 0, 0);
    color: #111827;
}

body.theme-light .jw-text-base {
    color: #0b0b0b !important;
}

body.theme-light nav .nav-btn:hover {
    background: rgba(0, 0, 0, 0.144);
}

/* Override common Tailwind white utilities when in light theme */
body.theme-light [class*="text-white"] {
    color: #0b0b0b !important;
}

body.theme-light [class*="text-white/"] {
    color: #334155 !important;
}

body.theme-light [class*="border-white"] {
    border-color: rgba(0, 0, 0, 0.15) !important;
}

body.theme-light [class*="bg-white/"],
body.theme-light .bg-white\/5 {
    background-color: rgba(0, 0, 0, 0.05) !important;
}

body.theme-light .bg-white\/10 {
    background-color: rgba(0, 0, 0, 0.08) !important;
}

body.theme-light .bg-white\/20 {
    background-color: rgba(0, 0, 0, 0.12) !important;
}

/* Header controls tweaks per theme */
body.theme-light #page-controls .search-wrap {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
}

body.theme-light #page-controls .search-wrap:focus-within {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

body.theme-light .needs-shadow-dark {
    backdrop-filter: blur(18px) brightness(0.8);
    box-shadow: -1px -9px 24px 20px rgba(0, 0, 0, 0.105), inset 10px -10px 24px 20px rgba(0, 0, 0, 0.123), 20px -19px 20px 20px rgba(0, 0, 0, 0.037);
    transition: all cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
}

body.theme-light code {
    color: #0b0b0b;
}

body.theme-light .code-text {
    color: #0b0b0b;
}


.image-container {
    position: relative;
    overflow: hidden;
}

.image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

body.theme-dark .image-container::before {
    background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

body.theme-blue .image-container::before {
    background: linear-gradient(90deg, #1e3a8a 25%, #1d4ed8 50%, #1e3a8a 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

.image-container img {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.image-container img.loaded {
    opacity: 100;
}

.image-container[image="async-loaded"]::before {
    display: none;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Accessibility & layout preferences */
body.reduce-motion * {
    transition: none !important;
    animation: none !important;
}

body.compact-layout .page-container {
    max-width: 72rem;
}

body.fs-small {
    font-size: 14px;
}

body.fs-large {
    font-size: 18px;
}

body.launcher-dense [data-app-id] {
    padding: 1rem !important;
}

/* Switch component */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: .2s;
    border-radius: 9999px;
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border-radius: 9999px;
    transition: .2s;
}

.switch input:checked+.slider {
    background: hsl(var(--accent, 217 91% 60%)/.35);
    border-color: hsl(var(--accent, 217 91% 60%)/.6);
}

.switch input:checked+.slider:before {
    transform: translate(20px, -50%);
}

/* Accent colors */
body {
    --accent: 217 91% 60%;
}

body.accent-blue {
    --accent: 217 91% 60%;
}

body.accent-purple {
    --accent: 262 83% 58%;
}

body.accent-emerald {
    --accent: 160 84% 40%;
}

body.accent-rose {
    --accent: 345 89% 60%;
}

/* Radius */
body.radius-soft .glass,
body.radius-soft .image-container,
body.radius-soft .rounded-3xl {
    border-radius: 12px !important;
}

/* Animation mood */
body.anim-calm * {
    transition-duration: .2s !important;
}

body.anim-expressive * {
    transition-duration: .5s !important;
}

/* Header and nav */
body.header-sticky header {
    position: sticky;
    top: 0;
}

body.nav-translucent header {
    background: rgba(255, 255, 255, 0.04) !important;
    backdrop-filter: blur(12px) saturate(160%) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px;
}

/* Breadcrumbs visibility */
body.hide-crumb #crumb {
    display: none !important;
}