/* How does this whole shit work?
 *
 * If JS is not enabled, the toggle for the sidebar is a checkbox
 *
 * If JS is enabled then the checkbox is not visible, we use buttons instead
 */

/* Hide the  toggle-btn when JS is OFF */
.no-js .toggle-btn {
    display: none;
}

.sidebar-toggle-label {
    display: none;
}

.no-js .sidebar-toggle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1.8;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transition: background 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
    user-select: none;
}

.no-js .sidebar-toggle-label:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Toggle Checkbox */
#sidebar-toggle {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Sidebar handling without JS */
.no-js #sidebar-toggle:checked ~ .app-container .sidebar,
.no-js #sidebar-toggle:checked ~ .app-container #sidebar {
    width: 70px;
}

.no-js #sidebar-toggle:checked ~ .app-container .sidebar .sidebar-title,
.no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-section-title,
.no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-text,
.no-js #sidebar-toggle:checked ~ .app-container .sidebar .lang-label,
.no-js #sidebar-toggle:checked ~ .app-container .sidebar .lang-divider {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-section-title,
.no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-external{
    display: none;
}

.no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-link {
    justify-content: center;
    padding: 12px 0;
}

.no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-icon {
    margin-left: 25%;
}

.no-js #sidebar-toggle:checked ~ .app-container .sidebar .lang-switcher {
    flex-direction: column;
    gap: 6px;
    padding: 12px 0;
}

.no-js #sidebar-toggle:checked ~ .app-container .sidebar .lang-btn {
    padding: 7px;
    justify-content: center;
}

.no-js #sidebar-toggle:checked ~ .app-container .main-content {
    margin-left: 70px;
}

/* Make everything that has some opening animation through JS visible from the start*/
.no-js .cv-eyebrow,
.no-js .cv-name,
.no-js .cv-tagline,
.no-js .cv-contact-chips {
    opacity: 1 !important;
    transform: none !important;
}

.no-js .cv-skill-bar-fill {
    width: var(--pct, 0%) !important;
    transition: none !important;
}

.no-js .cv-timeline-entry,
.no-js .cv-sidebar-panel,
.no-js .cv-skill-row,
.no-js .cv-interest-item,
.no-js .cv-lang-row {
    opacity: 1 !important;
    transform: none !important;
}

/* Hide JS-only UI controls */
.no-js .mobile-menu-btn {
    display: none;
}

/* Mobile: sidebar open/close via checkbox */
.mobile-toggle-label {
    display: none; /* hidden when JS is on */
}

.sidebar-close-label {
    display: none;
}

@media (max-width: 768px) {
    .no-js .mobile-toggle-label {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 50%;
        color: white;
        font-size: 1.5rem;
        cursor: pointer;
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
        z-index: 99;
        user-select: none;
    }

    .no-js #sidebar-toggle:checked ~ .mobile-toggle-label {
        display: none;
    }

    /* Slide sidebar in when checked */
    .no-js #sidebar-toggle:checked ~ .app-container .sidebar {
        transform: translateX(0);
        width: 340px !important;
    }

    /* Restore all text/nav items hidden by the desktop collapsed rules */
    .no-js #sidebar-toggle:checked ~ .app-container .sidebar .sidebar-title,
    .no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-section-title,
    .no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-text,
    .no-js #sidebar-toggle:checked ~ .app-container .sidebar .lang-label,
    .no-js #sidebar-toggle:checked ~ .app-container .sidebar .lang-divider {
        opacity: 1;
        width: auto;
        overflow: visible;
        height: auto;
    }

    .no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-link {
        justify-content: flex-start;
        padding: 12px 20px;
    }

    .no-js #sidebar-toggle:checked ~ .app-container .sidebar .nav-icon {
        margin-left: 0;
    }

    .no-js #sidebar-toggle:checked ~ .app-container .main-content {
        margin-left: 0;
    }

    .no-js #sidebar-toggle:checked ~ .app-container::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 99;
    }

    /* Close button inside the sidebar header for mobile, no-JS */
    .no-js .sidebar-close-label {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 35px;
        height: 35px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 1.2rem;
        background: rgba(255, 255, 255, 0.2);
        color: white;
        flex-shrink: 0;
        user-select: none;
    }

    /* Hide normal buttons */
    .no-js .toggle-btn,
    .no-js .sidebar-toggle-label {
        display: none;
    }
}

/* Hide the hint banner (needs JS) */
.no-js .cv-hint-banner {
    display: none !important;
}

/* Modals are no longer clickable */
.no-js .cv-modal-trigger {
    cursor: default;
}

.no-js .cv-modal-trigger::after {
    display: none;
}

/* Hide Modal overlay (needs JS) */
.no-js .cv-modal-overlay {
    display: none !important;
}

/* Error page: hide JS-only buttons */
.no-js .error-actions .btn-home[onclick],
.no-js .error-actions .btn-back[onclick] {
    display: none;
}
