/* Load defaults from `<userDir>/node_modules/node-red-contrib-uibuilder/front-end/uib-brand.min.css`
 * This version auto-adjusts for light/dark browser settings.
 */
@import url("../uibuilder/uib-brand.min.css");

/* CSS variables to make it easier to control */
:root {
    /* The layout container */
    --container-max-width: 1000px;
    --container-col-gap: 1rem;
    --container-row-gap: 1rem;

    /* The main content container */
    --main-cols: repeat(12, 1fr);
    --main-rows: auto;
    /* auto OR repeat(12, 1fr); ... */
    --main-col-gap: var(--container-col-gap);
    --main-row-gap: var(--container-row-gap);

    /* The articles */
    --article-width: 3;
    /* number of columns or auto */
    --article-height: auto;
    /* auto or number of rows */

    /* The Sidebar container */
    --sidebar-max-width: 1fr;
    --sidebar-min-width: 0.1fr;
}

/* The outer container div */
.container {
    width: 100%;
    max-width: var(--container-max-width);
    margin: 0 auto;
    /* Center the container horizontally */
    display: grid;
    gap: var(--container-row-gap) var(--container-col-gap);

    /* 2 cols x 3 rows layout. Middle row & right column are larger. Left col is constrained min/max */
    grid-template-columns: minmax(var(--sidebar-min-width), var(--sidebar-max-width)) var(--main-width);
    grid-template-rows: 0fr 1fr 0fr;
    grid-template-areas:
        "header header"
        "sidebar main"
        "sidebar footer";
    justify-items: stretch;
}

/* The main content container */
main {
    /* Where you put your content */
    grid-area: main;

    display: grid;
    gap: var(--main-row-gap) var(--main-col-gap);
    grid-template-columns: var(--main-cols, 12);
    /* fallback to 12 cols */
    grid-template-rows: var(--main-rows, auto);
    /* fallback to auto */
}

/* Any article within the main container.
   You can use a div instead of an article, useful for no-code uibuilder elements. */
main>article,
main>div {
    /* Width of an article in number of columns */
    grid-column: span var(--article-width);
    /* Height of an article in number of rows */
    grid-row: span var(--article-height);
    margin: 0;
}

/* Set a child div to have same format as an article */
main>div {
    border: 1px solid var(--text3);
    border-radius: var(--border-radius);
    padding: var(--border-pad);
    margin: 0;
    background-color: var(--surface3);
}

main>div>h2,
main>div>h3,
main>div>h4 {
    margin-block-start: 0;
    border-bottom: 1px solid var(--text3);
    padding-block-end: var(--border-pad);
}

header2 {
    text-align: center;
    padding: 5px;
   
}

footer2 {
    text-align: center;
    padding: 5px;
   
}

header {
    /* Headings, nav, etc */
    grid-area: header;
    text-align: center;
    padding: 5px;
    background-color: #abbaba;
        color: black;
}

footer {
    /* at the bottom, (c), dates, etc */
    grid-area: footer;
    margin-top: 0;
    padding: 5px;
    text-align: center;
    background-color: #abbaba;
        color: black;
}

/* We might want other sidebars so be more explicit for this */
aside.sidebar {
    /* stuff to one side of the main content */
    grid-area: sidebar;
}

/*#region Simple horizontal navigation main menu (in the header) */
.nav-main {
    background-color: var(--surface3);
}

.nav-main ul {
    /* Remove bullet points */
    list-style-type: none;
    /* Remove default padding */
    padding: 0;
    /* Remove default margin */
    margin: 0;
    /* Use Flexbox to align items horizontally */
    display: flex;
}

/* Add space between menu items */
.nav-main li {
    margin-right: 1rem;
}

/* Remove margin on the last item */
.nav-main li:last-child {
    margin-right: 0;
}

.nav-main a {
    /* Remove underline from links */
    text-decoration: none;
    /* Add padding for better click area */
    padding: var(--border-pad);
    /* Ensure the entire area is clickable */
    display: block;
}

/* Highlight on hover */
.nav-main a:hover {
    background-color: var(--surface5);
    /* Optional: Add rounded corners */
    border-radius: var(--border-radius);
}

/*#endregion */

/*#region simple vertical navigation menu */
.nav-side {
    background-color: var(--surface3);
}

.nav-side ul {
    /* Remove bullet points */
    list-style-type: none;
    /* Remove default padding */
    padding: 0;
    /* Remove default margin */
    margin: 0;
}

.nav-side a {
    /* Remove underline from links */
    text-decoration: none;
    /* Add padding for better click area */
    padding: 0.5rem 1rem;
    /* Ensure the entire area is clickable */
    display: block;
}

/* Highlight on hover */
.nav-side a:hover {
    background-color: var(--surface5);
}

/*#endregion */

/* Adapt for narrow screens */
@media only screen and (max-width: 512px) {
    :root {
        /* --article-width: 12; */
    }

    /* Very simple adaption example, a single column, 4 rows */
    .container {
        gap: 0.5rem;

        /* 1 cols x 4 rows layout. 2nd row is larger */
        grid-template-columns: 1fr;
        grid-template-rows: 0.1fr 1fr 0.1fr 0.1fr;
        grid-template-areas:
            "header"
            "main"
            "sidebar"
            "footer";
    }

    /* We want the articles in a single col now so just display as block */
    main {
        display: block;
    }

    /* And add a bit of a top margin to articles for clarity */
    main>article,
    main>div {
        margin-top: 0.5em;
    }
}