/*
 * Copyright (c) 2025.  SimplyMetadata LLC
 *
 */

/* ====================================
   Main Layout
   ==================================== */

body > header {
    padding: 0;

    nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        z-index: 1000;
        background-color: var(--bg);
        color: var(--text);
        padding-left: 10px;
        padding-right: 8px;

        @media (min-width: 768px) {
            /* on desktop, bring in the right padding */
            padding-right: 24px;
        }

        li {
            padding: 8px;
        }
    }
}

body > main {
    padding-top: 56px;
}

.page-header {
    padding: 10px 0;

    .page-info {
        float: right;
        /*padding-right: 15px;*/
        font-size: 14px;
    }
}

.flash-messages {

    .alert {
        padding: 10px;
        width: 100%;

        button {
            float: right;
        }
    }

    .alert-success {
        background-color: var(--success-bg);
    }

    .alert-error {
        background-color: var(--error-bg);
    }
}

.float-right {
    float: right;

    input {
        direction: ltr;
        text-align: right;
    }
}

.float-right-m {
    float: right;
    margin-left: 10px;
}

.float-left {
    float: left
}

.float-left-m {
    float: left;
    margin-right: 10px;
}

.top-pad-5 {
    padding-top: 5px;
}

.clearfix {
    clear: both;
}


/* ====================================
   utility hiding classes
   ==================================== */

.hide-on-mobile {
    @media (max-width: 420px) {
        display: none;
    }
}

.hide-on-desktop {
    @media (min-width: 421px) {
        display: none;
    }
}

/* ====================================
   icons
   ==================================== */

i {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;

    transition: font-variation-settings 0.2s ease;
    /* Makes the transition smooth */
    cursor: pointer;
    vertical-align: middle;
    margin-bottom: 3px;
}

/* State change: When you hover or a class is active */
i:hover,
i.active {
    font-variation-settings: 'FILL' 1,
        /* Fills the icon in */ 'wght' 700,
        /* Makes the lines thicker */ 'GRAD' 200,
        /* Adds emphasis */ 'opsz' 48;
    /* Adjusts optical size for detail */

    /*color: #e91e65; !* Change to pink/red *!*/
}

/* ====================================
   bars
   ==================================== */

/* specifically for pages that have a form-bar or list bar */
.bstr-spacer {
    height: 58px;
}

.bstr-page-bar {
    nav {
        position: fixed;
        top: 56px;
        left: 0;
        width: 100%;
        z-index: 1000;
        padding-left: 10px;
        background-color: var(--bg);
        padding-right: 12px;
        border-bottom: 1px solid var(--border);
        border-top: 1px solid var(--border);
        /* offset-x | offset-y | blur-radius | spread-radius | color */
        /*box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);*/
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.06);
        @media (min-width: 768px) {
            /* on desktop, line up with container fluid */
            padding: 0 24px;
        }

        ul {
            display: flex;
            flex-wrap: wrap;
            justify-content: start;
            list-style: none;
            padding: 0;
        }


        li {
            padding: 8px;

            a,
            button {
                background-color: var(--button-bar-bg);
                padding: 4px 8px;
                border-radius: 50px;
                border: none;
                font-size: 18px;
                margin: -5px;
                outline: 1px solid var(--button-bar-border);
            }

            button {
                width: auto;
                color: var(--accent);
            }

            a:hover,
            button:hover {
                background-color: var(--button-bar-border);
            }

            a[disabled],
            button[disabled] {
                opacity: var(--pico-form-element-disabled-opacity);
            }

            input {
                padding: 4px;
            }

            input[type=search] {
                margin: 0 4px 0 4px;

                @media (max-width: 768px) {
                    width: 100px;
                    padding-inline-start: 10px;
                    background: none;
                }
            }

            &.search-box {
                margin: 0 8px 0 0;
                padding: 0;
            }

            &.labeled-input {
                label {
                    display: inline-block;
                    margin-right: 8px;
                    text-align: right;
                }

                white-space: nowrap;

                select {
                    width: auto;
                }

            }

        }
    }
}

/* ====================================
   cards
   ==================================== */

.bstr-grid-500 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    padding: 10px;

    @media (max-width: 768px) {
        display: block;
        gap: 0;
        padding: 0;
    }
}

.bstr-grid-1000 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(1000px, 1fr));
    gap: 20px;
    padding: 10px;

    @media (max-width: 768px) {
        display: block;
        gap: 0;
        padding: 0;
    }
}

.bstr-grid-300 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px;
}

.bstr-grid-150 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    padding: 10px;
    align-items: start;
}

.bstr-grid-200 {
    display: grid;
    /* making this 190 to allow for margins on phones */
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
    vertical-align: top;
    align-items: start;

    @media (min-width: 768px) {
        grid-template-columns: repeat(auto-fit, 200px);
    }
}

/* ====================================
   cards
   ==================================== */

.bstr-card-container {
    margin: 10px;
    h2 {
        margin-top: 20px;
        margin-bottom: 10px;
        margin-left: 5px;
    }
}

.bstr-link-card {
    /*grid-row: auto;*/
    border: 1px solid #c5c4c4;
    /*box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);*/
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05),
    0 2px 2px rgba(0, 0, 0, 0.05),
    0 4px 4px rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    display: grid;
    /*grid-template-rows: subgrid;*/
    margin: 0;
    padding: 16px 16px 0 16px;

    .title {
        float: left;
        margin-top: -12px;

        img {
            width: 40px;
            padding: 8px 8px 16px 8px;

        }
    }

    .content {
        display: inline-block;
        padding-bottom: 16px;
    }

    a {
        text-decoration: none;
    }
}

/* ====================================
   ha style dashboard
   ==================================== */

.bstr-dark-mode {
   color-scheme: dark;
}

.bstr-dash-card {
    /*grid-row: auto;*/
    border: 1px solid rgba(225, 225, 225, 0.12);
    /*box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);*/
    /*box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05),*/
    /*0 2px 2px rgba(0, 0, 0, 0.05),*/
    /*0 4px 4px rgba(0, 0, 0, 0.05);*/
    border-radius: 12px;
    display: grid;
    /*grid-template-rows: subgrid;*/
    margin: 16px;
    padding: 16px 16px 0 16px;
    background-color: #1C1C1C;

    .main-title {
        text-align: center;
        display: inline-block;
        font-size: 40px;
        padding-bottom: 16px;

        .subtitle {
            color: #76797e;
            font-size: 28px;
        }
    }

    .title {
        text-align: center;
        display: inline-block;
        font-size: 32px;
        color: #76797e;

        .subtitle {
            font-size: 28px;
        }
    }

    .content {
        font-size: 40px;
        text-align: center;
        display: inline-block;
    }
    .dash-foot {
        text-align: center;
        display: inline-block;
        font-size: 14px;
        color: #76797e;
    }

    a {
        text-decoration: none;
    }
}


/* ====================================
   Boxes
   ==================================== */

.bstr-box {
    &.outlined {
        border: 1px solid var(--button-bar-border);
    }

    margin-top: 10px;

    @media (max-width: 768px) {
        border: none;

    }

    .bstr-box-header {
        padding: 10px;
        border-bottom: 1px solid var(--button-bar-border);
        background-color: var(--pod-header-color);

        &.top-border {
            border-top: 1px solid var(--button-bar-border);
        }

        .box-actions {

            a {
                float: right;
                padding-right: 10px;

                &:focus-visible {
                    box-shadow: none;
                }
            }

        }

        .page-info {
            float: right;
            font-size: 14px;
        }
    }

    .bstr-box-content {
        padding: 10px;
    }
}


/* ====================================
   Forms Styling
   ==================================== */

.bstr-form {

    dl {
        margin: 0 0 16px;
        /*padding: 0;*/
        display: grid;
        grid-template-columns: 125px 1fr;
        grid-template-rows: subgrid;

        @media (min-width: 768px) {
            grid-template-columns: 150px 1fr;
        }

        gap: 0 5px;

        dt {
            text-align: left;
            display: flex;
            align-items: center;

            align-self: start;
            padding-top: 5px;
        }

        dd {
            display: flex;
            align-items: center;
            margin-inline-start: 0;
            grid-column: 2;

            input[type="text"],
            input[type="password"],
            input[type="email"],
            input[type="number"],
            input[type="date"],
            input[type="time"],
            select,
            textarea {
                width: 100%;
            }

            input[type="checkbox"],
            input[type="radio"] {
                margin-top: 8px;
            }

            input,
            select,
            textarea {
                margin-bottom: 0;
            }


            /* for the autocomplete */

            fieldset[role= 'group'] {
                margin-bottom: 0;
                a {
                    padding-top: 3px;
                    padding-right: 5px;
                    padding-left: 5px;
                    border-top: 1px solid var(--input-border);
                    border-right: 1px solid var(--input-border);
                    border-bottom: 1px solid var(--input-border);
                    background-color: var(--input-bg);
                    display: inline-block;
                }
            }
        }
    }
}


nav details.dropdown.bstr-more {
    height: 35px;

    summary {
        background-color: var(--button-bar-bg);
        padding: 4px 8px;
        border-radius: 50px;
        border: none;
        font-size: 18px;
        /*margin: -8px -5px;*/
        outline: 1px solid var(--button-bar-border);
        background-image: none;
        height: 35px;
        color: var(--accent);
        transition: none;
    }

    summary:focus {
        outline: none;
    }

    summary::after {
        display: none;
    }

    ul {
        width: 200px;
        /*top: 40px;*/

        li {
            text-align: left;
            color: var(--accent);
            background-color: var(--button-bar-bg);
            outline: 1px solid var(--button-bar-border);

            a {
                color: var(--accent);
                padding: 0;
                margin: 0;
                border: 0;
                outline: 0;
            }

            input {
                /*width: 60px;*/
            }

            /* Custom-action selects are dir="ltr" inside this dir="rtl" menu;
               keep their chevron caret on the right to match LTR padding. */
            select:not([multiple], [size]) {
                background-position: center right 0.75rem;
            }
        }
    }

}


/* ====================================
   Tags Input Styling
   ==================================== */

.tags-input-container {
    position: relative;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Tags list */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Individual tag */
.tag {
    display: inline-flex;
    align-items: center;
    background: var(--clr-grey-50);
    border: 2px solid var(--clr-grey-100);
    opacity: 85%;
    color: var(--clr-grey-800);
    padding: 4px 8px 4px 12px;
    border-radius: 16px;
    font-size: 0.875rem;
    font-weight: 500;
    gap: 6px;
    cursor: default;
    animation: tagAppear 0.2s ease;
}

@keyframes tagAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.tag-remove {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--clr-grey-800);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    transition: background 0.2s ease;
}

.tag-remove:hover {
    background: rgba(255, 255, 255, 0.4);
}

.tag-remove:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Input field */
input.tags-input {
    flex: 1;
    min-width: 120px;
    border: none;
    border-bottom: 1px solid #ddd;
    outline: none;
    box-shadow: none;
    padding: 4px 8px;
    font-size: 0.9rem;
    margin-top: 6px;
    display: inline-block;
}

.tags-input::placeholder {
    color: #999;
}

input.tags-input:focus-visible {
    outline: none;
    box-shadow: none;
}

/* Clickable Choices */
.tags-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    width: 100%;

    button {
        margin-bottom: 4px;
    }
}

.choice-item:hover {
    background: #e8e8e8;
    border-color: #bbb;
    transform: translateY(-1px);
    color: var(--accent);
}

.choice-item:active {
    transform: translateY(0);
}

.choice-item.selected {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border-color: var(--accent);
    color: white;
}

.choice-item.selected:hover {
    background: var(--clr-grey-800);
    border-color: var(--accent);
    color: white;
}

.choice-item:disabled {
    background: #f0f0f0;
    border-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    transform: none;
}


/* Empty state */
.tags-input-container.empty .tags-input {
    width: 100%;
}

/* Disabled state */
.tags-input-container.disabled {
    background: #f5f5f5;
    border-color: #e0e0e0;
    cursor: not-allowed;
}

.tags-input-container.disabled .tag {
    background: #999;
}

.tags-input-container.disabled .tag-remove {
    display: none;
}

.tags-input-container.disabled .tags-input {
    cursor: not-allowed;
    background: transparent;
}

/* Small tags variant */
.tags-input-container.small .tag {
    font-size: 0.75rem;
    padding: 2px 6px 2px 8px;
}

.tags-input-container.small .tag-remove {
    width: 14px;
    height: 14px;
    font-size: 12px;
}

.tags-input-container.small .tags-input {
    font-size: 0.85rem;
}

/* Large tags variant */
.tags-input-container.large .tag {
    font-size: 1rem;
    padding: 6px 10px 6px 14px;
}

.tags-input-container.large .tag-remove {
    width: 22px;
    height: 22px;
    font-size: 18px;
}

.tags-input-container.large .tags-input {
    font-size: 1rem;
}


/* ====================================
   Logs Styling
   ==================================== */

pre.bstr-log {
    white-space: pre;
    /* Prevents text from wrapping to the next line */
    overflow-x: auto;
    /* Adds a horizontal scrollbar only when necessary */
    display: block;
    /* Ensures the element behaves as a block-level container */
    max-width: 100%;
    /* Keeps the element from pushing past its parent's width */
}

.debug-background {
    background-color: #ffdddd;
}
