@import url("../vendor/quill/dist/quill.core-SSF3s4H.css");
@import url("../vendor/quill/dist/quill.bubble-h1FAqUP.css");
@import url("../vendor/quill/dist/quill.snow-TaLFpfp.css");
@import url("variables-wZgRsqe.css");
@import url("utils-LKtcGT4.css");

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    list-style-type: none;
    color: var(--secondary-color-dark);
    text-decoration: none;
}

nav {
    ul ul {
        margin-left: 1em;
    }
}

tr {
    &:hover {
        background-color: var(--grey);
    }
}

a {
    display: inline;
    color: var(--secondary-color-dark);
    position: relative;
    z-index: 1;
    text-decoration: underline;
}

button, input[type="submit"] {
    padding: 4px;
    display: block;
    background-color: var(--main-color-light);
    border: none;
    cursor: pointer;
    width: 100%;
    color: var(--secondary-color-dark);
    &:hover {
        background-color: var(--secondary-color-light);
        color: var(--main-color-dark);
    }
}

label {
    display: block;
}

svg {
    fill: var(--main-color-light);
    vertical-align: middle;
}

body {
    min-height: 100vh;
    display: flex;
    flex-flow: column nowrap;
    background-color: var(--main-color-light);
    position: relative;
    padding: 0 15px 0 15px; /* Can't be pixel-perfect due to browser rendering, so -1 px */
    font-family: serif;
    overflow-x: hidden;
}

body.menu-open {
    overflow: hidden;
}

[hidden="hidden"] {
    display: none;
}


body>header, body>main, body>footer {
    width: 100%;
    max-width: 1030px;
    margin: 0 auto;
}

header {
    position: relative;
    height: 96px;
    & .center {
        top: 0;
        left: 0;
        height: var(--header-height);
        width: 100%;
        background-color: var(--main-color);
    }
    & .right {
        top: 0;
        right: 0;
    }
    & .left {
        top: 0;
        left: 0;
    }
    & .center, & .right, & .left {
        position: absolute;
        z-index: -1;
    }
    #left-header-nav {
        top: 0;
        left: 0;
        height: 0;
        width: 0;
        position: absolute;
        z-index: 0;
        &>* {
            position: absolute;
            z-index: 1;
        }
        & svg {
        }
        & *:nth-child(1) {
            top: 0;
            left: 0;
        }
        & *:nth-child(2) {
            top: calc(var(--button-width) * 2.5 + 4px);
            left: -8px;
        }
    }
    #right-header-nav {
        top: 0;
        right: 0;
        height: 0;
        width: 0;
        position: absolute;
        z-index: 0;
        &.menu-active {
            z-index: 100000;
        }
        &>a {
            position: absolute;
            z-index: 1;
            width: calc(var(--button-width) + 8px);
            font-size: calc((var(--button-width) + 8px) * 0.9);
        }
        &>a:nth-of-type(1) {
            top: 10px;
            right: 24px;
        }
        &>a:nth-of-type(2) {
            top: 10px;
            right: calc(16px - var(--button-width) - 6px);
        }
    }
}

.standalone-button {
    width: var(--button-width);
    font-size: calc(var(--button-width) * 0.9);
    aspect-ratio: 1/1;
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-items: center;
    color: var(--main-color-dark);
    stroke: var(--main-color-dark);
    background-color: var(--highlight-color-1);
    border-radius: var(--br-mid);
    &:nth-child(5n + 1) { background-color: var(--highlight-color-1); }
    &:nth-child(5n + 1).no-bg { background-color: transparent; color: var(--highlight-color-1); stroke: var(--highlight-color-1); }
    &:nth-child(5n + 2) { background-color: var(--highlight-color-2-light); }
    &:nth-child(5n + 2).no-bg { background-color: transparent; color: var(--highlight-color-2-light); stroke: var(--highlight-color-2-light); }
    &:nth-child(5n + 3) { background-color: var(--highlight-color-3); }
    &:nth-child(5n + 3).no-bg { background-color: transparent; color: var(--highlight-color-3); stroke: var(--highlight-color-3); }
    &:nth-child(5n + 4) { background-color: var(--highlight-color-4); }
    &:nth-child(5n + 4).no-bg { background-color: transparent; color: var(--highlight-color-4); stroke: var(--highlight-color-4); }
    &:nth-child(5n + 5) { background-color: var(--highlight-color-5-light); }
    &:nth-child(5n + 5).no-bg { background-color: transparent; color: var(--highlight-color-5-light); stroke: var(--highlight-color-5-light); }
    &.big {
        width: calc(var(--button-width) * 1.8);
        font-size: calc(var(--button-width) * 1.8 * 0.9);
    }
    &.small {
        width: calc(var(--button-width) * 0.8);
        font-size: calc(var(--button-width) * 0.8 * 0.9);
    }
    &.logo-button {
        width: calc(var(--button-width) * 2.5);
        font-size: calc(var(--button-width) * 2.5 * 0.9);
    }
}

aside {
    &#left-frame {
        left: 0;
    }
    &#right-frame {
        right: 0;
    }
    &#left-frame, &#right-frame {
        height: 100%;
        top: 0;
        position: absolute;
        width: 16px;
        z-index: -1;
        background-color: var(--main-color);
    }
}

@media screen and (min-width: 1060px) {
    aside {
        &#left-frame {
            right: calc(50% + 515px);
            left: 0;
            width: auto;
        }
        &#right-frame {
            left: calc(50% + 515px);
            right: 0;
            width: auto;
            transform: scaleX(-1);
        }
        &#left-frame, &#right-frame {
            height: 100%;
            top: 0;
            position: absolute;
            z-index: -1;
            border-right: 12px solid var(--main-color);
            background-color: var(--main-color-light);
            background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="480" height="1000"><rect x="0" y="0" width="12" height="1000" fill="%237d5b38" /><rect x="240" y="0" width="12" height="1000" fill="%237d5b38" /><rect x="252" y="300" width="228" height="12" fill="%237d5b38" /><rect x="252" y="750" width="228" height="12" fill="%237d5b38" /><rect x="12" y="150" width="228" height="12" fill="%237d5b38" /><rect x="12" y="600" width="228" height="12" fill="%237d5b38" /></svg>');
            background-size: 480px 1000px;
            background-position: right top;
            background-repeat: repeat;
        }
    }

    body {
        margin: 0;
        min-height: 100vh;
        background-color: var(--main-color-dark);
    }
}



/*nav {*/
/*    &.inline {*/
/*        display: flex;*/
/*        flex-flow: row nowrap;*/
/*        * {*/
/*            max-width: 64px;*/
/*            user-select: none;*/
/*        }*/
/*    }*/
/*    ul {*/
/*        li {*/
/*            flex-grow: 1;*/
/*            background-color: var(--main-color-light);*/
/*            &:active, &:hover {*/
/*                background-color: var(--secondary-color-light);*/
/*                color: var(--main-color-dark);*/
/*            }*/
/*            &>* {*/
/*                display: block;*/
/*                padding: 8px 0;*/
/*                text-align: center;*/
/*            }*/
/*        }*/
/*    }*/
/*}*/

form.single-line {
    display: flex;
    flex-flow: row nowrap;
}

main {
    flex-grow: 1;
    background-color: var(--secondary-color-light);
    padding: 6px;
    &>section {
        padding: 2px;
        background-color: var(--white);
        box-shadow: 2px 2px 2px var(--main-color);
        border-radius: var(--br-small);
        overflow-x: auto;
        &:not(:last-child) {
            margin-bottom: 6px;
        }
        p:not(table p),h1,h2,h3,h4,h5,h6 {
            margin-top: 0.25em;
            margin-bottom: 0.25em;
        }
        table {
            table-layout: fixed;
            width: 100%;
            td:not(:last-child), th:not(:last-child) {
                border-right: 1px solid var(--main-color);
            }
            tbody>tr:not(:last-child)>td, th {
                border-bottom: 1px solid var(--main-color);
            }
            td, th {
                padding: 4px;
            }
            /* Actions column: fixed width for icon buttons */
            td:last-child, th:last-child {
                width: 100px;
                text-align: center;
            }
            /* Content column: relative positioning, but overflow visible so hover popup isn't clipped */
            td:first-child {
                position: relative;
                overflow: visible;
            }
            /* Wrapper for truncation & hover overlay */
            .table-cell-wrapper {
                position: relative;
                width: 100%;
                display: block;
            }
            /* Static, in-flow text wrapper that truncates with ellipsis */
            .table-cell-static {
                display: block;
                width: 100%;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
            .table-cell-static a {
                display: inline-block;
                max-width: 100%;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                vertical-align: middle;
            }
            /* Absolute hover element: hidden by default, pops out over other cells */
            .table-cell-hover {
                display: none;
            }
            .table-cell-wrapper:hover .table-cell-static {
                visibility: hidden; /* Hide the static text without changing cell layout */
            }
            .table-cell-wrapper:hover .table-cell-hover {
                display: block;
                position: absolute;
                /* Positioned so that the text aligns exactly with the static text,
                   compensating for the border (1px) and padding (6px): 
                   top/left = -(border + padding) = -(1px + 6px) = -7px. */
                top: -7px;
                left: -7px;
                z-index: 100;
                width: calc(100% + 14px); /* Compensate width: 100% + 2*(border + padding) */
                height: auto;
                white-space: normal;
                word-wrap: break-word;
                word-break: break-word;
                overflow: visible;
                background-color: var(--white); /* White background to clearly block out text underneath */
                border: 1px solid var(--main-color);
                border-radius: var(--br-small);
                padding: 6px;
                box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); /* Soft shadow to give depth */
            }
            .table-cell-wrapper:hover .table-cell-hover a {
                display: inline;
                white-space: normal;
                word-wrap: break-word;
            }
        }
    }
}

footer {
    position: relative;
    height: 80px;
    & .center {
        left: 0;
        height: 48px;
        width: 100%;
        background-color: var(--main-color);
    }
    & .right {
        right: 0;
    }
    & .left {
        left: 0;
    }
    & .center, & .right, & .left {
        bottom: 0;
        position: absolute;
        z-index: -1;
    }
    nav {
        position: absolute;
        z-index: 1;
        bottom: 16px;
        left: 0;
        font-size: 0.8em;
        color: var(--main-color-dark);
        ul {
            display: flex;
            flex-flow: row nowrap;
            gap: min(18px, max(6px, 1vw));
            background-color: transparent;

            li:nth-child(3n + 1) {
                a { background-color: var(--highlight-color-1); }
                a::before { background-color: var(--highlight-color-1); }
            }
            li:nth-child(3n + 2) {
                a { background-color: var(--highlight-color-4); }
                a::before { background-color: var(--highlight-color-4); }
            }
            li:nth-child(3n + 3) {
                a { background-color: var(--highlight-color-3); }
                a::before { background-color: var(--highlight-color-3); }
            }
            a {
                position: relative;
                padding: 2px 4px 2px 2px;
                text-decoration: none;
                border-radius: var(--br-mid);
                svg {
                    position: relative;
                    margin-bottom: 2px; /* Set margin to be the same as the padding above */
                    transform: scale(125%);
                    color: var(--main-color-dark);
                }
                &::before {
                    content: '';
                    position: absolute;
                    top: 0;
                    left: 0;
                    height: calc(120% + 2px);
                    aspect-ratio: 1/1;
                    transform: translate(-10%, -10%);
                    border-radius: var(--br-mid);
                    z-index: -1;
                }
            }
        }
    }
}

.flip {
    transform: rotate(180deg) scaleX(-1);
}

.fetch-form {
    display: flex;
    flex-flow: column nowrap;
    width: 100%;
}

.float-right {
    float: right
}

.button {
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    background-color: var(--secondary-color);
    height: 24px;
    width: 24px;
    padding: 2px;
    border-radius: var(--br-small);
}

.button.active {
    background-color: var(--secondary-color-light);
}

.button svg, .button svg * {
    fill: var(--black);
}

.button-block {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 32px;
    width: unset;
    padding: 4px;
}

.button * {
    height: 100%;
}

.collapsible {
    margin: 6px;
    display: flex;
    align-items: flex-end;
    flex-flow: column nowrap;
}

.collapsible>section {
    margin-top: 6px;
    display: none;
}
.collapsible.active>section {
    display: block;
}

/* Dev-only login bypass */
.dev-login-section {
    border: 2px dashed var(--highlight-color-5);
    background-color: #fff3f3;
}

.dev-login-badge {
    display: inline-block;
    background-color: var(--highlight-color-5);
    color: var(--white);
    font-weight: bold;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: var(--br-small);
    letter-spacing: 0.05em;
}

.dev-login-submit {
    background-color: var(--highlight-color-5) !important;
    color: var(--white) !important;
}
.dev-login-submit:hover {
    background-color: var(--highlight-color-5-light) !important;
}

/* Auth level badges */
.auth-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--br-mid);
    font-size: 0.85em;
    font-weight: bold;
}
.auth-badge svg {
    flex-shrink: 0;
}
.auth-badge time {
    font-variant-numeric: tabular-nums;
}
.auth-badge--full {
    background-color: #e6f4ea;
    color: var(--highlight-color-2);
    border: 1px solid var(--highlight-color-2);
}
.auth-badge--remembered {
    background-color: #fff8e1;
    color: #b8860b;
    border: 1px solid #daa520;
}

/* Menu Overlay Styles */
#right-header-nav .menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    width: 100%;
    height: 100%;
    background-color: var(--main-color);
    border: 2px solid var(--main-color-dark);
    z-index: 10000;
    padding: 8px;
    padding-top: 48px; /* Extra padding at top for close button on mobile */
    flex-flow: column nowrap;
    overflow-y: auto;
}

#right-header-nav .menu-overlay.active {
    display: flex;
}

#right-header-nav .menu-overlay svg {
    display: inline-block;
    width: 1em;
    height: 1em;
}

#right-header-nav .menu-overlay-content {
    display: flex;
    flex-flow: column nowrap;
    gap: 8px;
}

#right-header-nav .menu-overlay-content .menu-section {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 8px;
}

#right-header-nav .menu-overlay-content .menu-section:last-child {
    margin-bottom: 0;
}

#right-header-nav .menu-overlay-content .menu-section h2 {
    display: none;
}

#right-header-nav .menu-overlay-content .menu-section ul {
    display: flex;
    flex-flow: column nowrap;
    gap: 2px;
    padding-left: 0;
}

#right-header-nav .menu-overlay-content .menu-section ul li {
    display: block;
}

#right-header-nav .menu-overlay-content .menu-section ul li a {
    display: block;
    position: relative;
    padding: 2px 4px 2px 2px;
    text-decoration: none;
    border-radius: var(--br-mid);
    color: var(--main-color-dark);
    font-weight: bold;
    font-size: 0.8em;
    transition: filter 250ms ease-in-out;
    margin-left: 6px;
    margin-right: 6px;
    margin-top: 3px;
    margin-bottom: 3px;
}

#right-header-nav .menu-overlay-content .menu-section ul li a svg {
    position: relative;
    margin-bottom: 2px;
    transform: scale(125%);
    color: var(--main-color-dark);
    fill: var(--main-color-dark);
    display: inline-block;
    vertical-align: middle;
}

#right-header-nav .menu-overlay-content .menu-section ul li a::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: calc(120% + 2px);
    aspect-ratio: 1/1;
    transform: translate(-10%, -10%);
    border-radius: var(--br-mid);
    z-index: -1;
}

#right-header-nav .menu-overlay-content .menu-section ul li:nth-child(3n + 1) a,
#right-header-nav .menu-overlay-content .menu-section ul li:nth-child(3n + 1) a::before {
    background-color: var(--highlight-color-1);
}

#right-header-nav .menu-overlay-content .menu-section ul li:nth-child(3n + 2) a,
#right-header-nav .menu-overlay-content .menu-section ul li:nth-child(3n + 2) a::before {
    background-color: var(--highlight-color-4);
}

#right-header-nav .menu-overlay-content .menu-section ul li:nth-child(3n + 3) a,
#right-header-nav .menu-overlay-content .menu-section ul li:nth-child(3n + 3) a::before {
    background-color: var(--highlight-color-3);
}

#right-header-nav .menu-overlay-content .menu-section ul li a:hover {
    filter: hue-rotate(45deg);
    color: var(--main-color-dark);
}

#right-header-nav .menu-overlay .menu-close-btn {
    position: absolute;
    top: 14px;
    right: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: calc(var(--button-width) * 1.3);
    height: calc(var(--button-width) * 1.3);
    aspect-ratio: 1/1;
    border-radius: var(--br-mid);
    background-color: var(--highlight-color-5-light);
    border: none;
    cursor: pointer;
    z-index: 10002;
}

#right-header-nav .menu-overlay .menu-close-btn svg,
#right-header-nav .menu-overlay .menu-close-btn svg * {
    fill: var(--black);
    color: var(--black);
}

#right-header-nav .menu-overlay .menu-close-btn:hover {
    background-color: var(--highlight-color-5);
}

/* Desktop styles */
@media screen and (min-width: 768px) {
    #right-header-nav .menu-overlay {
        display: none;
        position: absolute;
        top: 50px;
        right: 16px;
        left: auto;
        width: 250px;
        height: auto;
        max-height: 80vh;
        border: 2px solid var(--main-color-dark);
        border-radius: var(--br-small);
        box-shadow: 3px 3px 0 var(--main-color-dark);
        padding: 10px;
        background: var(--main-color);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        z-index: 1000;
    }

    #right-header-nav .menu-overlay.hover-active {
        display: flex;
    }

    #right-header-nav .menu-overlay .menu-close-btn {
        display: none;
    }
}

