:root {
  /* Default (Fallback) Theme */
  --neutral: #FAF3E0;
  --background: #FAF3E0;
  --text: #333333;
  --accent: #F3C13A;
  --primary: #2F5225;
  --input-border: lightgray; /*#f3c23a7c*/
  --row-highlight: color-mix(in srgb, var(--accent), white);
  --border-highlight: color-mix(in srgb, var(--primary), white);
}

/* 🌱 Spring */
.season-spring {
  --background: #D2F4DC;
  --text: #254117;
  --accent: #D8C8E6;
  --primary: #6B8E23;
}

/* 🌞 Summer */
.season-summer {
  --background: #FFF9E3;
  --text: #1F4D1A;
  --accent: #FF6F61;
  --primary: #2F5225;
}

/* 🍂 Fall */
.season-fall {
  --background: #E1C699;
  --text: #5D3954;
  --accent: #C75B12;
  --highlight: #e6c615;
  --primary: #8B2500;
}

/* ❄️ Winter */
.season-winter {
  --background: #F8F8F8;
  --text: #254117;
  --accent: #D0EFFF;
  --primary: #3181af;
  /*TODO: add snow falling animation*/
}

body {
    font-family: Arial, Helvetica, sans-serif;
    color: #333;
    font-size: .9em;
    min-height: 100vh;
    /* min-width: 100vw; */
    display: grid;
    grid-template-columns: 1fr 10fr;
    margin: 0;
    padding: 0;
    border: none;
    color: var(--text);
    background-color: var(--background);
    /* nav {
        background-color: var(--primary); 
        ul {
            list-style-type: none;
            li {
                width: 100%;
                margin: 1rem;
                background-color: var(--light-primary);
            }
            li:hover {
                cursor: pointer;
            }
        }

    } */
    * {
        max-width: 100vw;
        box-sizing: border-box;
    }
    ul {
        list-style: none;
    }


    nav {
        
        --nav-bg : var(--primary);
        &.page-nav {
            --nav-bg: white;
            menu {
                display: inline-flex;
            }
        }
        background-color: var(--nav-bg);
        color: white;
        padding: 1rem;
        width: 220px;
        border-right: 1px solid var(--nav-border);
        font-family: system-ui, sans-serif;
        &.site-nav {
            
            menu {
                /* display: flex;
                flex-direction: column; */
                gap: 0.5rem;
                margin: 0;
                padding: 0;
                /* font-size: xxx-large; */
                list-style: none;
                li {
                    /* &:child {
                        font-weight: bold;
                    } */
                    &:hover {
                        background-color: white;
                        color: var(--primary);
                        
                    }
                    a {
                        display: block;
                        padding: 0.75rem 1rem;
                        text-decoration: none;
                        color: var(--nav-text);
                        border-radius: 6px;
                        font-weight: 500;
                        transition: background-color 0.2s ease, color 0.2s ease;
                        font-weight: bold;
                        text-wrap-mode: nowrap;
                        &:hover {
                        background-color: var(--nav-hover-bg);
                        color: var(--nav-hover-text);
                        }
                    }

                    &:last-child {
                        a {
                            background-color: var(--nav-accent-bg);
                            color: var(--nav-accent-text);

                            &:hover {
                                background-color: darken(var(--nav-accent-bg), 10%);
                                /* color: #fff; */
                            }
                        }
                    }
                }
            }
        }
    }
    
    h1, h2, button {
        color: var(--primary);
    }

    button {      
        background-color: var(--primary);
        color: white;
        border-radius: 6px;
        padding: 0.5em 1em;
        border: none;
        font-weight: 500;
    }

    button:hover {
        cursor: pointer;
    }

    .button-accent {
        background-color: var(--accent);
        color: var(--text);
        border-radius: 8px;
        padding: 0.75em 1.25em;
        font-weight: 600;
        border: none;
        cursor: pointer;
        transition: background-color 0.3s ease;
    }

    input,
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    input[type="file"],
    textarea {
        background-color: var(--input-bg);
        /* border: 2px solid color-mix(in srg, var(--accent), transparent 90%); */
        border-radius: var(--input-radius);
        padding: 0.75em 1em;
        font-size: 1rem;
        color: var(--input-text);
        width: 100%;
        box-sizing: border-box;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
        &::placeholder {
            color: gray;
        }
    }

    input[type="file"]::file-selector-button {
        background-color: var(--primary);
        color: white;
        border: none;
        border-radius: 6px;
        padding: 0.5em 1em;
        margin-right: 0.75em;
        font-weight: 500;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }

    input[type="file"]::file-selector-button:hover {
        background-color: var(--accent);
        color: var(--text);
    }

    input::placeholder,
    textarea::placeholder {
     color: var(--input-placeholder);
    }

    input:focus,
    textarea:focus {
        border-color: var(--input-focus);
        outline: none;
        box-shadow: 0 0 0 3px rgba(47, 82, 37, 0.2); /* uses forest green */
    }
    input,
    textarea,
    select {
        border: 2px solid var(--input-border); /* ↑ bump up contrast */
    }

    form {
        background-color: #fff; /* or var(--input-bg) */
        border: 1px solid var(--input-border);
        border-radius: 12px;
        padding: 2rem;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    }

    select {
        appearance: none; /* Hide native arrow */
        -webkit-appearance: none;
        -moz-appearance: none;

        background-color: var(--input-bg);
        border: 2px solid var(--input-border);
        border-radius: var(--input-radius);
        padding: 0.75em 2.5em 0.75em 1em;
        font-size: 1rem;
        color: var(--input-text);
        width: 100%;
        box-sizing: border-box;
        background-image: url('data:image/svg+xml;utf8,<svg fill="%236B8E23" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
        background-repeat: no-repeat;
        background-position: right 0.75em center;
        background-size: 1rem;
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    select:focus {
        border-color: var(--input-focus);
        outline: none;
        box-shadow: 0 0 0 3px rgba(47, 82, 37, 0.2);
    }

    .tcf {
        display: grid;
        grid-template-columns: 2fr 4fr 6fr;
    }

    main {
        width: 100%;
        height: 100%;
        display: grid;
        grid-template-columns: 2fr 10fr 2fr;
        article#page-content {
            display: grid;
            margin-top: 2rem;
            /* grid-column: 2/span 2; */
            grid-template-columns: subgrid;
            grid-template-rows: 4rem 10fr;
            .aux-left {
                grid-column: 1 / 2;
            }
            .aux-right {
                grid-column: 3/-1;
            }
            >* {
                grid-column: 2/3;
                grid-row: 2/-1;
                box-sizing: border-box;
            }
            * {
                box-sizing: border-box;
            }
            nav {
                width: 100%;
                grid-row: 1/2;
                border: .1rem solid gray;
                border-radius: .5rem;
                /* box-shadow: 0 .5rem 1rem black; */

            }

            #page-container {
                /* margin: auto; */
                width: 100%;
                margin: 0 auto;
            }
        }

        h1 {
            font-size: 1.5em;
        }
        
        label {
            font-size: 1.25rem;
            align-self: center;
        }

        
        section {
            
            &:has(>table, >form>table) {
                margin: 0 auto 0 auto;
                padding: 1rem;
                background: white;
                height: fit-content;
                border: .1rem solid gray;
                border-radius: .5rem;
                /* box-shadow: 0 .5rem 1rem black; */
            }
            >table {
                padding: 1rem;
                thead {
                    th {
                        padding: .2rem;
                        text-align: center;
                    }
                }
                tbody {
                    td {
                        padding: .2rem;
                    }
                    
                }
                
            }   
        }
        table {
            height: fit-content;
            border-collapse: collapse;
            thead {
                th {
                    text-align: justify;
                }
            }
            tbody {
                tr {
                    height: fit-content;
                    td {
                        height: fit-content;
                    }
                }
                tr:nth-child(even) {
                    background-color: lightgray;
                }
            }
        }
    }

    #spinner {
        /* High contrast styling against seasonal themes */
        background: rgba(0, 0, 0, 0.9);
        color: white;
        border: 3px solid var(--accent);
        border-radius: 8px;
        font-weight: bold;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        display: block;
        width: 25%;
        margin: 0 auto;
        text-align: center;

        /* Animated spinner */
        &::before {
            content: '';
            display: inline-block;
            border: 4px solid rgba(255, 255, 255, 0.3);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            vertical-align: middle;
        }
        
        /* Loading text */
        &::after {
            content: 'Processing...';
            vertical-align: middle;
        }
    }

    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
}


div.htmx-indicator {
    z-index: -1;
    display: flex;
    position: absolute;
    height: 100%;
    width: 100%;
    filter: drop-shadow(2px 4px 6px white);
    background: color-mix(in srgb, var(--primary), transparent 66%);
    img {
        width: 4rem;
        margin: auto;
        max-width: 50%;
    }
}


output.data-manager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: .5rem;
    table {
        width: 100%;
        border: 1px solid black;
        border-collapse: collapse;
        thead {
            th {
                text-align: justify;
                border: 1px solid black;
            }
        }
        tbody {
            tr {
                height: fit-content;
                td {
                    border: 1px solid grey;
                    height: fit-content;
                }
                &:hover {
                    background: color-mix(in srgb, var(--primary), transparent 66%);
                }
            }
        }
    }
    section {
        width: 100%;
    }

    .data-browser-footer {
        display: grid;
        grid-template-columns: 2fr 8fr 2fr;
        height: fit-content;
        padding: .5rem;

        border-radius: 0 0 6px 6px;
        section {
            display: grid;
        }
        select {
            color: black;
            min-height: 2rem;
            padding: .1rem .5rem;
        }
        .pagination-select {
            width: fit-content;
            margin: auto;
            /* width: 100%;
            grid-template-columns: repeat(9, 1fr); */
        }
        span {
            height: fit-content;
            margin: auto 0 auto 0;
        }
    }
}

.paginator {
    table {
        display:table;
        anchor-name: --pagingTable;
        tr {
            max-width:fit-content;
            min-height: 1rem;
            th {
                min-width: fit-content;
                text-wrap-mode: nowrap;
            }
            td {
                text-wrap-mode: nowrap;
                min-height: 1rem;
            }
        }
        tbody {
            cursor:cell;
        }
        td:has(input:not([hidden])) {
            /* width:2rem; */
            padding:0;
            input {
                field-sizing:content;
                display: table-cell;
                padding: .2rem;
                width:100%;
                max-width: 100%;
                /* max-height: 100%; */
                min-height: 100%;
                /* max-height:fit-content; */
                margin: 0;
                border: none;
            }
        }
    }
    form {
        padding: 0;
        margin: 0;
        border-radius: 0 0 2px 2px;
        menu.paging-list {
            margin: 0;
            position: relative;
            width: fit-content;
            position-anchor: --pagingTable;
            right: anchor(end, -70%);
            padding: 0;
            display: inline-flex;
            gap: .3rem;
            list-style: none;
            
            button {
                background: none;
                color: var(--text);
                text-decoration: underline;
                cursor: pointer;
                
                padding: 0;
                margin: 0;
            }
        }
    }
}

/* ATTRIBUTE COLLECTION */
.attribute-collection {
    /* max-width: 20rem; */
    form {
        border: none;
        grid-template-columns: 10fr 1fr;

        padding: 0;
        margin: 0;
        fieldset {
            border: none;
            
            padding: 0;
            margin: 0;

            input {
                border-radius: 6px 0 0 6px;
            }
        }
        button {
            border-radius: 0 6px 6px 0;
        }
    }
    >ul {
        display: inline-flex;
        width: 100%;
        gap: .5rem;
        overflow-x: auto;
        
        
        padding-left: 0;
        li {
            text-wrap-mode: nowrap;
            background: var(--highlight);
            width: fit-content;
            padding: 2px .2rem 2px .2rem;
            border-radius: 6px;
        }
    }
}

/*DETAIL SET*/

.detail-set {
    max-width: 85vw;

    .detail {
        border: 2px solid gray;
        border-radius: 5px;
        padding: .5rem;
        margin-bottom: .5rem;
    }
}

.data-browser {
    margin: auto;
    background-color: white;
}

@import url('https://fonts.googleapis.com/css2?family=Arbutus&family=Gravitas+One&display=swap');
.stock {
    height: fit-content;
    
    font-family: "Gravitas One", serif;
    font-weight: 600;
    font-style: normal;
    width: 85%;
    padding: 0 0 2rem 0 !important;
    background-color: var(--accent) !important;
    font-size: xx-large;
    margin: auto;
    ul {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        color: color-mix(in srgb, var(--text), black 10%);
        width: fit-content;
        padding: 0;
        margin: auto;
        li {
            width: fit-content;
        }
    }
    
    h2 {
        color: white;
        background: var(--primary);
        width: 100%;
        height: 30%;
        padding: 2rem;
        margin: 0 0 2rem 0;
        
        border-radius: 1.5rem 1.5rem 0 0;
    }
}

.card-list {
    display: grid;
    grid-template-columns: repeat(4, 3fr); 
    grid-auto-columns: 3fr;
    row-gap: 1rem;
    column-gap: 1rem;
}

.card {
    background-color: color-mix(in srgb, var(--primary), white 5%);
    border-radius: 1.5rem;
    padding: .5rem;
    box-shadow: grey 0 .5rem 1rem;
    color: white;

    h2 {
        color: white;
    }
}


@media screen and (width > 1024px) {
    body {
        >nav.site-nav {
            height: 100%;
            position: fixed;
            menu {
                &:last-child {
                    bottom: 0;
                    position: absolute;
                }
            }
        }
        main {
            
            grid-column: 2/-1;

        }
    }
}


@media screen and (width <= 1024px) {
    
    body {
        input, button, select, label {
            font-size: 1.9rem !important;
            background-position: right 0em center;
            background-size: 3rem;
        }
        grid-template-columns: 1fr;
        grid-template-rows: 10rem auto;
        width: 100%;
        /* overflow:hidden; */
        /* max-width: 100%; */
        font-size: 3em;
        >nav {
            display:flex;
            #spinner {
                display: none;
            }
            width: 100%;
            max-width: 100vw;
            >menu {
                display: inline-flex;
                flex-wrap: nowrap;
                flex-direction: row;
                flex-basis: 1rem;
                gap: 2rem;
                height: 100%;
                /* width: 100%; */
                max-width: 100vw;
                /* width: 100%; */
                font-size: 2rem;
                list-style: none;
                li {
                    
                    display: flex;
                    flex-shrink: 3;
                    font-size:large;
                    a {
                        margin: auto;
                    }
                }
            }
        }
        >main {
            grid-template-columns: 1fr;
            grid-template-rows: 4rem 10fr 1fr;
            width: 100%;
        }
    }
    #page-content {
        padding: 2rem;
        .module-nav {
            font-size: x-large;
        }
    }
    .card-list {
        grid-template-columns: 1fr;
        .card {
            margin: auto;
            width: 85%;
        }
    }
    output.data-manager {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        column-gap: 0;
        .pagination-select {
            height: 100%;
            button {
                height: 100%;
                aspect-ratio: 1;
            }
        }
    }
    [hx-ext='fw-tabulation'] {
        .tabbed-nav {
            font-size:xx-large;
            min-height: 4rem;
            li {min-width: 4rem;}
            button {
                min-width: 4rem;
            }
        }
    }
}