/* Theme variables: hacker / futuristic palette */
:root {
    --primary-color: #0ea5e9;
    /* neon blue */
    --primary-dark: #034078;
    /* navy */
    --secondary-color: #6d28d9;
    /* violet accent */
    --background: #02040a;
    /* near black / midnight */
    --surface: #071029;
    /* deep navy surface */
    --surface-light: #122033;
    /* lighter navy */
    --text-primary: #cfe8ff;
    /* silver-ish light text */
    --text-secondary: #8aa7c7;
    /* muted silver-blue */
    --success: #10b981;
    --warning: #f59e0b;
    --accent: #00e5ff;
    /* electric cyan */
    --neon-1: #00e5ff;
    --neon-2: #0ea5e9;
    --silver: #c0c6cc;
    --gradient-1: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(109, 40, 217, 0.12));
    --gradient-2: linear-gradient(135deg, rgba(0, 229, 255, 0.1), rgba(245, 158, 11, 0.06));
    --shadow: 0 8px 30px rgba(2, 4, 10, 0.6);
    --shadow-hover: 0 18px 50px rgba(2, 4, 10, 0.7);
    --glass: rgba(255, 255, 255, 0.03);
    --glass-strong: rgba(255, 255, 255, 0.05);
    --border-glow: 0 0 18px rgba(14, 165, 233, 0.06);
}

/* Smooth theme transition */
body,
.container,
.repo-card,
.stat-card,
.header {
    transition: background-color 280ms ease, color 280ms ease, border-color 280ms ease, box-shadow 280ms ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Orbitron', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Animated Background Particles */
/* keep container but replace circle-particle styles with a canvas for Matrix effect */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

/* matrix canvas */
#matrixCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: -1;
    mix-blend-mode: screen;
    /* neon blending */
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.12));
}

/* Header: professional cyberpunk style */
.header {
    background: linear-gradient(120deg, rgba(2, 4, 10, 0.92) 60%, rgba(0, 255, 231, 0.10) 100%);
    padding: 56px 20px 32px 20px;
    border-radius: 12px;
    box-shadow: 0 12px 48px 24px rgba(0, 229, 255, 0.10), 0 6px 32px rgba(2, 4, 10, 0.18);
    position: relative;
    overflow: visible;
    animation: none;
}

/* Remove neon rim and flicker */
.header::before {
    display: none;
}

/* Header ornaments: keep but reduce blur for subtlety */
.header-ornaments {
    z-index: 2;
}

.holo-bar {
    filter: blur(3px);
    opacity: 0.7;
}

.scanline {
    opacity: 0.03;
}

/* Stats container inside header: cleaner look */
.header .stats-container.cyber-stats {
    margin-bottom: 0;
    margin-top: 24px;
    box-shadow: 0 2px 12px #00ffe7, 0 0 4px #ff00cc inset;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(15, 32, 39, 0.85) 0%, rgba(44, 83, 100, 0.85) 100%);
    border: 1.5px solid #ff00cc;
    position: relative;
    z-index: 3;
}

/* Header title: reduce flicker and shadow for clarity */
.header .title-main,
.header .title-sub {
    animation: none;
    text-shadow:
        0 0 6px #00ffe7,
        0 1px 4px #0ea5e9;
}

/* Main Content */
.main {
    padding: 40px 20px;
    min-height: calc(100vh - 300px);
}

/* Controls */
.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 250px;
    /* holographic glass effect */
    background: linear-gradient(120deg, rgba(0, 229, 255, 0.10) 0%, rgba(109, 40, 217, 0.08) 100%);
    border-radius: 28px;
    box-shadow: 0 0 18px #00ffe7, 0 0 8px #6d28d9 inset, 0 0 32px #0ff;
    padding: 2px;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 18px;
    background: rgba(20, 20, 40, 0.72);
    border: 2px solid rgba(0, 229, 255, 0.18);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 1rem;
    box-shadow: 0 0 8px #00ffe7 inset;
    transition: all 0.3s cubic-bezier(.77, .2, .05, 1);
    outline: none;
    backdrop-filter: blur(2px);
}

/* Search input placeholder font style */
.search-input::placeholder {
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    font-weight: 500;
    opacity: 0.8;
}

.search-input:focus {
    border-color: #00ffe7;
    box-shadow: 0 0 0 3px #00ffe7, 0 0 12px #6d28d9 inset;
    background: linear-gradient(120deg, rgba(0, 229, 255, 0.18) 0%, rgba(109, 40, 217, 0.10) 100%);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.filter-buttons {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 10px 24px;
    background: linear-gradient(120deg, rgba(0, 229, 255, 0.13) 0%, rgba(109, 40, 217, 0.10) 100%);
    border: 2px solid rgba(0, 229, 255, 0.18);
    border-radius: 22px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: 0 0 12px #00ffe7, 0 0 6px #6d28d9 inset;
    transition: all 0.3s cubic-bezier(.77, .2, .05, 1);
    backdrop-filter: blur(2px);
    position: relative;
}

.filter-btn:hover,
.filter-btn:focus {
    background: linear-gradient(120deg, rgba(0, 229, 255, 0.22) 0%, rgba(109, 40, 217, 0.18) 100%);
    border-color: #00ffe7;
    box-shadow: 0 0 24px #00ffe7, 0 0 12px #6d28d9 inset;
    color: #00ffe7;
    outline: none;
}

.filter-btn.active {
    background: linear-gradient(120deg, rgba(0, 229, 255, 0.28) 0%, rgba(109, 40, 217, 0.22) 100%);
    border-color: #6d28d9;
    color: #cfe8ff;
    box-shadow: 0 0 32px #6d28d9, 0 0 16px #00ffe7 inset;
}

/* Filter button icon style to match text */
.filter-btn svg,
.filter-btn .icon {
    font-weight: 700;
    vertical-align: middle;
    height: 1.2em;
    width: 1.2em;
    margin-right: 7px;
    /* If using icon fonts, ensure color matches text */
    color: inherit;
    fill: currentColor;
}

/* Cyber controls styling */
.cyber-controls {
    background: linear-gradient(90deg, rgba(15, 32, 39, 0.6) 0%, rgba(44, 83, 100, 0.6) 100%);
    border: 2px solid #00ffe7;
    border-radius: 14px;
    box-shadow: 0 0 18px #00ffe7, 0 0 6px #0ff inset;
    padding: 18px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 32px;
    position: relative;
    overflow: hidden;
}

/* Cyber controls before pseudo-element */
.cyber-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    border-radius: 14px;
    border: 1px solid #00ffe7;
    opacity: 0.15;
    box-shadow: 0 0 32px #00ffe7 inset;
}

/* Responsive adjustments for filter buttons & search (moved from index.html) */
.cyber-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.cyber-controls .search-box {
    flex: 1 1 220px;
    min-width: 0;
}

/* allow search to shrink */
.cyber-controls .filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: flex-start;
    overflow-x: auto;
    /* fallback: allow horizontal scroll if needed */
    -webkit-overflow-scrolling: touch;
}

.cyber-controls .filter-btn {
    flex: 0 1 auto;
    min-width: 96px;
    padding: 10px 14px;
    box-sizing: border-box;
    white-space: nowrap;
}

/* Tighter sizing on narrow viewports */
@media (max-width: 420px) {
    .cyber-controls {
        gap: 0.5rem;
    }

    .cyber-controls .search-box {
        flex: 1 1 100%;
        order: 1;
    }

    .cyber-controls .filter-buttons {
        width: 100%;
        order: 2;
    }

    .cyber-controls .filter-btn {
        flex: 1 1 30%;
        min-width: 0;
        padding: 8px 10px;
        font-size: 14px;
    }
}

@media (max-width: 360px) {
    .cyber-controls .filter-btn {
        font-size: 13px;
        padding: 6px 8px;
    }
}

/* Cyber stats container styling */
.cyber-stats {
    background: linear-gradient(90deg, rgba(35, 37, 38, 0.5) 0%, rgba(65, 67, 69, 0.5) 100%);
    border: 2px solid #ff00cc;
    border-radius: 14px;
    box-shadow: 0 0 18px #ff00cc, 0 0 6px #f0f inset;
    padding: 12px 24px;
    margin-bottom: 24px;
    display: flex;
    gap: 24px;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    /* stronger glass surface for contrast and readability */
    background: linear-gradient(135deg, rgba(20, 20, 40, 0.7) 60%, rgba(0, 255, 231, 0.10) 100%);
    border: 2px solid #00ffe7;
    border-radius: 12px;
    box-shadow: 0 0 10px #00ffe7, 0 0 3px #0ff inset;
    min-width: 120px;
    min-height: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 8px;
    transition: box-shadow 0.2s, border-color 0.2s;
    backdrop-filter: blur(2px);
}

/* subtle scanlines inside each card for cyber texture */
.repo-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px);
    background-size: 100% 6px;
    mix-blend-mode: overlay;
    pointer-events: none;
    opacity: 0.035;
}

/* neon top rim that animates on hover */
.repo-card::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--neon-1), var(--neon-2), transparent);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 320ms ease;
    filter: blur(6px);
    pointer-events: none;
}

/* Repo grid layout */
.repo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 28px;
    margin-top: 32px;
}

/* Repo card styling */
.repo-card {
    background: linear-gradient(120deg, rgba(15, 32, 39, 0.82) 60%, rgba(0, 255, 231, 0.10) 100%);
    border: 2px solid #00ffe7;
    border-radius: 14px;
    box-shadow: 0 0 18px #00ffe7, 0 0 6px #0ff inset;
    position: relative;
    padding: 22px 20px 18px 20px;
    transition: box-shadow 0.2s, border-color 0.2s;
    overflow: hidden;
    backdrop-filter: blur(2px);
    z-index: 1;
}

/* Make folder icon smaller inside repo cards */
.repo-card .folder-icon,
.folder-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    vertical-align: middle;
}

/* Glitch border effect */
.repo-card::before,
.repo-card::after {
    content: '';
    position: absolute;
    pointer-events: none;
    border-radius: 14px;
    z-index: 2;
}

.repo-card::before {
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid #ff00cc;
    opacity: 0.18;
    filter: blur(1px);
    animation: repoGlitchBorder 1.2s infinite linear alternate;
}

.repo-card::after {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed #00ffe7;
    opacity: 0.12;
    animation: repoGlitchBorder2 1.5s infinite linear alternate;
}

/* Glitchy overlay lines */
.repo-card .glitch-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 3;
    mix-blend-mode: lighten;
}

.repo-card .glitch-lines span {
    display: block;
    position: absolute;
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, #00ffe7 0%, #ff00cc 100%);
    opacity: 0.18;
    animation: glitchLineMove 0.8s infinite alternate;
}

.repo-card .glitch-lines span:nth-child(1) {
    top: 18%;
    left: 0;
    animation-delay: 0s;
}

.repo-card .glitch-lines span:nth-child(2) {
    top: 52%;
    left: 0;
    animation-delay: 0.3s;
}

.repo-card .glitch-lines span:nth-child(3) {
    top: 78%;
    left: 0;
    animation-delay: 0.6s;
}

/* Glitchy hover effect */
.repo-card:hover {
    box-shadow: 0 0 32px #ff00cc, 0 0 16px #00ffe7 inset;
    border-color: #ff00cc;
    background: linear-gradient(120deg, rgba(255, 0, 204, 0.18) 0%, rgba(15, 32, 39, 0.82) 100%);
}

.repo-card:hover::before {
    opacity: 0.32;
    filter: blur(2px);
}

.repo-card:hover::after {
    opacity: 0.22;
}

/* Glitch keyframes */
@keyframes repoGlitchBorder {
    0% {
        transform: translate(0, 0);
    }

    20% {
        transform: translate(-2px, 2px);
    }

    40% {
        transform: translate(2px, -2px);
    }

    60% {
        transform: translate(-1px, 1px);
    }

    80% {
        transform: translate(1px, -1px);
    }

    100% {
        transform: translate(0, 0);
    }
}

@keyframes repoGlitchBorder2 {
    0% {
        opacity: 0.12;
    }

    50% {
        opacity: 0.22;
    }

    100% {
        opacity: 0.12;
    }
}

@keyframes glitchLineMove {
    0% {
        left: 0;
    }

    100% {
        left: 10px;
    }
}

/* compact layout adjustments for small screens */
@media (max-width: 768px) {
    .repo-icon {
        width: 48px;
        height: 48px;
        min-width: 48px;
    }

    .repo-name {
        font-size: 1.05rem;
    }

    .repo-description {
        -webkit-line-clamp: 4;
        font-size: 0.95rem;
    }

    .repo-grid {
        grid-template-columns: 1fr;
    }
}

/* Glitch effect for elements with .glitch and data-text */
.glitch {
    position: relative;
    display: inline-block;
    /* ensure layering for pseudo elements */
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    clip: rect(0, 9999px, 0, 0);
}

.glitch::before {
    color: var(--neon-1);
    z-index: 1;
    opacity: 0.85;
    transform: translate3d(-1.5px, -0.8px, 0);
    text-shadow: -2px 0 var(--neon-2);
    animation: glitchTop 2.5s infinite linear alternate-reverse;
    mix-blend-mode: screen;
}

.glitch::after {
    color: var(--neon-2);
    z-index: 0;
    opacity: 0.7;
    transform: translate3d(1.8px, 0.6px, 0);
    text-shadow: 2px 0 var(--neon-1);
    animation: glitchBot 3.1s infinite linear alternate-reverse;
    mix-blend-mode: screen;
}

/* small jitter and clip animations */
@keyframes glitchTop {
    0% {
        clip: rect(2px, 9999px, 10px, 0);
        transform: translate3d(-1px, -0.6px, 0);
        opacity: 0.9;
    }

    20% {
        clip: rect(12px, 9999px, 18px, 0);
        transform: translate3d(-3px, -1.2px, 0);
        opacity: 0.7;
    }

    40% {
        clip: rect(0px, 9999px, 6px, 0);
        transform: translate3d(-0.5px, -0.2px, 0);
        opacity: 0.95;
    }

    60% {
        clip: rect(18px, 9999px, 28px, 0);
        transform: translate3d(-2.2px, -1px, 0);
        opacity: 0.8;
    }

    80% {
        clip: rect(6px, 9999px, 14px, 0);
        transform: translate3d(-1.1px, -0.5px, 0);
        opacity: 0.88;
    }

    100% {
        clip: rect(2px, 9999px, 10px, 0);
        transform: translate3d(-1px, -0.6px, 0);
        opacity: 0.9;
    }
}

@keyframes glitchBot {
    0% {
        clip: rect(22px, 9999px, 30px, 0);
        transform: translate3d(1px, 0.6px, 0);
        opacity: 0.85;
    }

    20% {
        clip: rect(8px, 9999px, 16px, 0);
        transform: translate3d(3px, 1.2px, 0);
        opacity: 0.7;
    }

    40% {
        clip: rect(12px, 9999px, 20px, 0);
        transform: translate3d(0.8px, 0.3px, 0);
        opacity: 0.95;
    }

    60% {
        clip: rect(0px, 9999px, 8px, 0);
        transform: translate3d(2px, 0.8px, 0);
        opacity: 0.8;
    }

    80% {
        clip: rect(18px, 9999px, 26px, 0);
        transform: translate3d(1.1px, 0.5px, 0);
        opacity: 0.9;
    }

    100% {
        clip: rect(22px, 9999px, 30px, 0);
        transform: translate3d(1px, 0.6px, 0);
        opacity: 0.85;
    }
}

/* subtle base flicker to enhance cyber feel on .glitch elements */
.glitch {
    animation: baseFlicker 4.5s infinite steps(3, end);
}

@keyframes baseFlicker {
    0% {
        opacity: 1;
        filter: none;
    }

    50% {
        opacity: 0.96;
        filter: blur(0.1px);
    }

    100% {
        opacity: 1;
        filter: none;
    }
}

/* Apply glitch styling to repo names (anchor) */
.repo-name.glitch {
    display: inline-block;
    position: relative;
}

/* thin bottom border (fixed) replacing footer */
.bottom-border {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1000;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(0, 229, 255, 0.0), rgba(0, 229, 255, 0.65), rgba(109, 40, 217, 0.25));
    filter: blur(6px);
    opacity: 0.9;
}

/* keep bottom-border subtle on small screens */
@media (max-width: 768px) {
    .bottom-border {
        height: 1.5px;
        filter: blur(4px);
        opacity: 0.7;
    }
}

/* Sidebar header styles */
.sidebar-header {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 340px;
    min-width: 240px;
    max-width: 90vw;
    background: transparent;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(.77, .2, .05, 1), box-shadow 0.3s;
    box-shadow: 0 0 32px 0 rgba(0, 229, 255, 0.08);
}

.sidebar-header.hide {
    transform: translateX(-110%);
    box-shadow: none;
}

.sidebar-header .header {
    height: 100%;
    min-height: 0;
    box-shadow: none;
    border-radius: 0 16px 16px 0;
    padding: 40px 24px 32px 24px;
    margin: 0;
}

/* Sidebar toggle button */
.sidebar-toggle {
    position: fixed;
    top: 32px;
    left: 358px;
    z-index: 101;
    width: 44px;
    height: 44px;
    background: linear-gradient(120deg, #071029 60%, #00ffe7 100%);
    border: 2.5px solid #00ffe7;
    border-radius: 50%;
    box-shadow: 0 0 24px #00ffe7, 0 0 8px #ff00cc inset, 0 0 32px #0ff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left 0.3s cubic-bezier(.77, .2, .05, 1), box-shadow 0.2s, transform 0.18s;
    outline: none;
}

.sidebar-toggle:hover {
    box-shadow: 0 0 48px #ff00cc, 0 0 24px #00ffe7 inset, 0 0 64px #0ff;
    transform: scale(1.08);
    border-color: #ff00cc;
    background: linear-gradient(120deg, #071029 40%, #ff00cc 100%);
}

.sidebar-toggle-icon {
    display: block;
    width: 26px;
    height: 26px;
    position: relative;
    filter: drop-shadow(0 0 8px #00ffe7) drop-shadow(0 0 4px #ff00cc);
    transition: filter 0.2s, transform 0.18s;
}

.sidebar-toggle:hover .sidebar-toggle-icon {
    filter: drop-shadow(0 0 16px #ff00cc) drop-shadow(0 0 8px #00ffe7);
    transform: scale(1.12);
}

/* Theme toggle button - fixed under sidebar toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(120deg, rgba(14, 165, 233, 0.13) 0%, rgba(0, 229, 255, 0.18) 100%);
    border: 2.5px solid var(--neon-1);
    box-shadow:
        0 0 18px var(--neon-1),
        0 0 8px #ff00cc inset,
        0 0 24px #0ff;
    cursor: pointer;
    transition: box-shadow 0.22s, border-color 0.22s, transform 0.18s, background 0.22s;
    outline: none;
    position: fixed;
    /* fixed to follow sidebar toggle */
    left: 358px;
    /* align with sidebar-toggle by default */
    top: 86px;
    /* place below the sidebar-toggle (32px + 44px + spacing) */
    z-index: 102;
    margin: 0;
    backdrop-filter: blur(2px);
}

.theme-toggle:hover {
    box-shadow: 0 0 32px #ff00cc, 0 0 16px #00ffe7 inset, 0 0 40px #0ff;
    border-color: #ff00cc;
    background: linear-gradient(120deg, rgba(255, 0, 204, 0.18) 0%, rgba(14, 165, 233, 0.13) 100%);
    transform: scale(1.09);
}

/* keep icon style unchanged */
.theme-toggle #themeIcon,
.theme-toggle svg {
    width: 28px;
    height: 28px;
    display: block;
    fill: var(--neon-1);
    filter: drop-shadow(0 0 8px var(--neon-1)) drop-shadow(0 0 3px #ff00cc);
    transition: filter 0.22s, transform 0.18s;
    background: none;
}

/* New: grouped toggles wrapper so sidebar-toggle and theme-toggle are aligned */
.toggles-wrapper {
    position: fixed;
    top: 32px;
    left: 18px;
    /* default inset on small screens */
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 201;
    transition: left 0.3s cubic-bezier(.77, .2, .05, 1), transform 0.18s, box-shadow 0.2s;
    pointer-events: auto;
}

/* When sidebar is open on wide screens, place wrapper beside the sidebar (original desktop offset) */
@media (min-width: 901px) {
    body.sidebar-open .toggles-wrapper {
        left: calc(340px + 18px);
        /* match previous left: 358px logic (sidebar width + spacing) */
    }
}

/* When sidebar is open on narrower screens where sidebar becomes 80vw, mirror previous calc */
@media (max-width: 900px) {
    body.sidebar-open .toggles-wrapper {
        left: calc(80vw + 18px);
    }
}

/* Buttons inside wrapper should not be fixed — they should flow inside the wrapper */
.toggles-wrapper .sidebar-toggle,
.toggles-wrapper .theme-toggle {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    /* keep visual styles but avoid per-button fixed positioning */
}

/* New: toggles placed inside controls instead of floating wrapper */
.toggle-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
    /* ensure they don't overflow the controls area */
    flex: 0 0 auto;
}

/* When toggles are inside .toggle-buttons they should not be fixed-positioned */
.toggle-buttons .sidebar-toggle,
.toggle-buttons .theme-toggle,
.toggle-buttons .lang-toggle {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    margin: 0;
    /* preserve existing visual styling from global rules, only neutralize placement */
}

/* Slightly smaller layout for very small screens */
@media (max-width: 600px) {
    .toggle-buttons {
        gap: 8px;
    }

    .toggle-buttons .sidebar-toggle,
    .toggle-buttons .theme-toggle,
    .toggle-buttons .lang-toggle {
        width: 38px;
        height: 38px;
    }
}

/* ensure existing rules that set .sidebar-toggle and .theme-toggle positions don't conflict when inside the wrapper */
/* (other global selectors in this file will remain; the wrapper-scoped rules above take precedence) */
#langLabel {
    color: white;
}

/* Prevent user selection globally while allowing inputs and editable regions to remain usable */
html,
body,
.container,
.repo-card,
.stat-card,
.header,
.main,
.repo-grid,
.repo-name,
.repo-description {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Allow selection & copy inside interactive controls and explicitly editable areas */
input,
textarea,
select,
button,
.search-input,
[contenteditable],
[contenteditable="true"] {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* Reduce visible ::selection so highlighting is less useful (extra measure) */
::selection {
    background: transparent;
    color: inherit;
}