:root {
    --ibm-gray-100: #161616;
    --ibm-gray-90: #262626;
    --ibm-gray-80: #393939;
    --ibm-gray-10: #f4f4f4;
    --ibm-blue-60: #0f62fe;
    --ibm-blue-70: #0043ce;
    --ibm-text-primary: #f4f4f4;
    --ibm-text-secondary: #c6c6c6;
    --ibm-font-family: 'Inter', sans-serif;
    /* Using Inter since it's already there */
}

body {
    background-color: var(--ibm-gray-100) !important;
    color: var(--ibm-text-primary) !important;
    overflow: hidden;
    /* Keep existing behavior */
    display: flex;
    /* Turn body into flex container for sidebar layout */
}

/* Sidebar */
.ibm-sidebar {
    width: 250px;
    height: 100vh;
    background-color: var(--ibm-gray-90);
    border-right: 1px solid var(--ibm-gray-80);
    display: flex;
    flex-direction: column;
    padding-top: 48px;
    /* Space for optional top header if needed, or just top spacing */
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.ibm-sidebar-header {
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--ibm-text-primary);
    border-bottom: 1px solid var(--ibm-gray-80);
    margin-bottom: 1rem;
}

.ibm-nav-item {
    display: block;
    padding: 1rem;
    color: var(--ibm-text-secondary);
    text-decoration: none;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.ibm-nav-item:hover {
    background-color: var(--ibm-gray-80);
    color: var(--ibm-text-primary);
}

.ibm-nav-item.active {
    border-left-color: var(--ibm-blue-60);
    background-color: var(--ibm-gray-80);
    color: var(--ibm-text-primary);
    font-weight: 600;
}

/* Main Content Area */
.ibm-main {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem;
    background-color: var(--ibm-gray-100);
}

.ibm-content-header {
    margin-bottom: 2rem;
}

.ibm-page-title {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
}

.ibm-page-description {
    font-size: 1rem;
    color: var(--ibm-text-secondary);
    max-width: 800px;
}

/* Grid System */
.ibm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Cards / Tiles */
.ibm-tile {
    background-color: var(--ibm-gray-90);
    padding: 1rem;
    min-height: 150px;
    border: 1px solid transparent;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ibm-tile:hover {
    background-color: var(--ibm-gray-80);
    border-color: var(--ibm-text-secondary);
}

.ibm-tile-title {
    font-size: 1.25rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.ibm-tile-content {
    font-size: 0.875rem;
    color: var(--ibm-text-secondary);
    flex-grow: 1;
}

.ibm-tile-footer {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

/* Buttons */
.ibm-btn {
    background-color: var(--ibm-blue-60);
    color: white;
    padding: 0.75rem 1rem;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.ibm-btn:hover {
    background-color: var(--ibm-blue-70);
}

.ibm-btn-ghost {
    background-color: transparent;
    color: var(--ibm-blue-60);
}

.ibm-btn-ghost:hover {
    background-color: var(--ibm-gray-80);
}

/* Overrides for existing elements */
.page {
    display: flex;
    width: 100%;
    height: 100%;
}

.page .content {
    width: 100%;
}

/* Hide old menu stuff */
.menu,
.menu-overlay,
.navbar .menu-holder {
    display: none !important;
}

/* Animation for page load */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ibm-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Sub-panels Overrides */
.sub-link,
.sub-instance {
    background-color: var(--ibm-gray-100) !important;
    color: var(--ibm-text-primary) !important;
    z-index: 1000;
    /* Ensure on top */
}

.sub-link-nav,
.sub-instance-nav {
    border-bottom: 1px solid var(--ibm-gray-80);
    margin-bottom: 1rem;
    padding: 1rem 0 !important;
    width: 100% !important;
    padding-left: 2rem !important;
    /* Align with content */
}

.sub-link-nav .menu,
.sub-instance-nav .menu {
    display: none !important;
    /* Hide old menu toggle */
}

.sub-link-nav button,
.sub-instance-nav button {
    background-color: var(--ibm-blue-60) !important;
    color: white !important;
    border: none !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.875rem !important;
    margin: 0 !important;
    margin-right: 1rem !important;
    cursor: pointer;
}

.sub-link-body hr,
.sub-instance-body hr {
    border: none !important;
    border-top: 1px solid var(--ibm-gray-80) !important;
}

/* Inputs in sub-panels */
.sub-link-body input[type=text],
.sub-instance-body input[type=text] {
    background-color: var(--ibm-gray-80) !important;
    color: var(--ibm-text-primary) !important;
    border: 1px solid transparent !important;
    padding: 0.5rem !important;
}


/* Fixes and Polish */
/* #background-canvas { display: none !important; } */

body,
html {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.page {
    position: absolute;
    /* Force it to overlay everything */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    display: flex;
}

.ibm-sidebar {
    height: 100vh;
    border-radius: 0 !important;
    /* Ensure no rounded corners on the panel itself */
}

/* Mobile Responsiveness */

/* Mobile Header (Hidden on Desktop) */
.ibm-mobile-header {
    display: none;
    padding: 1rem;
    background-color: var(--ibm-gray-90);
    border-bottom: 1px solid var(--ibm-gray-80);
    align-items: center;
    justify-content: space-between;
    margin: -2rem -2rem 2rem -2rem;
    /* Negate main padding */
}

.ibm-mobile-app-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.ibm-mobile-menu-toggle {
    font-size: 1.2rem;
    padding: 0.5rem;
}

/* Mobile Overlay */
.ibm-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    /* Below sidebar, above content */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ibm-mobile-overlay.visible {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .ibm-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        z-index: 999;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    }

    .ibm-sidebar.open {
        transform: translateX(0);
    }

    .ibm-main {
        padding: 1rem;
        /* Reduce padding on mobile */
        width: 100%;
        margin-left: 0;
    }

    .ibm-mobile-header {
        display: flex;
        margin: -1rem -1rem 1rem -1rem;
        /* Adjust for reduced padding */
    }

    .ibm-grid {
        grid-template-columns: 1fr;
        /* Stack cards on mobile */
    }

    .ibm-page-title {
        font-size: 2rem;
    }

    /* Adjust sub-panels for mobile */
    .sub-link,
    .sub-instance {
        width: 100%;
        left: 0;
        top: 0;
    }

    .sub-link-nav,
    .sub-instance-nav {
        padding-left: 1rem !important;
    }
}