:root {
    --editor-font-size: 12px;
}

body {
    display: flex;
    flex-direction: column;
}

#not-authorized-notif {
    position: absolute;
    display: flex;
    align-self: center;
    align-items: center;
    width: 40rem;
    height: fit-content;
    background-color: peachpuff;
    margin-top: 7.5rem;
    border-radius: 2rem;
    gap: 1.5rem;
    border: .35rem solid rgba(237, 172, 116, 0.743);
    padding: 0.75rem 2.5rem 0.75rem .75rem;
    visibility: hidden;
    z-index: 1;
}

#not-authorized-notif-exclamation {
    width: 6rem;
    height: 6rem;
    /* border: .5rem solid red; */
    border-radius: 50%;
    flex-shrink: 0;
    line-height: 6rem;
    text-align: center;
    font-size: 5.5rem;
    font-weight: 900;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    background-color: rgb(237, 173, 116);
    color: rgb(108, 52, 23);
}

#not-authorized-notif-text p {
    width: fit-content;
    height: fit-content;
    flex: 1;
    text-wrap: wrap;
    font-family: Arial, Helvetica, sans-serif;
}

#not-authorized-notif-text-main {
    color: rgb(108, 52, 23);
    margin: 1.5rem 0 0 0;
    font-size: 1.5rem;
    font-weight: bold;
}

#not-authorized-notif-text-secondary {
    color: rgb(151, 72, 32);
    margin: 0 0 0 0;
}

#not-authorized-notif-x {
    position: relative;
    width: 2rem;
    height: 2rem;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}

#not-authorized-notif-x::before, #not-authorized-notif-x::after {
    content: "";
    position: absolute;
    height: 8px;
    width: 2rem;
    top: 50%;
    left: 0;
    margin-top: -4px;
    background: rgb(151, 72, 32);
    border-radius: 5px;
}

#not-authorized-notif-x::before {
    transform: rotate(45deg);
}

#not-authorized-notif-x::after {
    transform: rotate(-45deg);
}

#not-authorized-notif-x:hover::before, #not-authorized-notif-x:hover::after {
    background: rgb(108, 52, 23);
    transition: 1s;
}

.response-container {
    display: none;
    position: relative;
    /* display: flex; */
    align-self: center;
    align-items: center;
    margin-bottom: 1rem;
    width: 20rem;
    background-color: rgb(216, 29, 48);
    padding: 1rem;
    gap: .75rem;
    /* margin-top: 20rem; */
    box-sizing: border-box;
}

.response-container .error {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 1.4rem;
    height: 1.4rem;
    border: .15rem solid white;
    color: white;
    font-weight: 600;
    font-family: Arial;
    font-size: x-large;
    border-radius: 50%;
    flex-shrink: 0;
}

.response {
    color: white;
    font-size: large;
    margin: 0;
}

.modal {
    position: relative;
    border: rgb(108, 52, 23) solid 3px;
    background-color: rgb(255, 220, 187);
    color: rgb(151, 72, 32);
    font-weight: bold;
    font-size: 1.5rem;
    padding: 12px 24px;
    scrollbar-color: rgba(151, 72, 32, 0.54) rgb(255, 220, 187);
}

.modal-form {
    display: flex;
    flex-direction: column;
}

.modal fieldset {
    border: rgba(151, 72, 32, .5) solid 2px;
    margin: 0;
    display: grid;
    grid-template-columns: 1.5rem auto;
    gap: .5rem;
    padding-block-start: 5px;
    padding-block-end: 8px;
}

.modal input[type="radio"] {
    accent-color: rgb(108, 52, 23);
    background-color: rgba(151, 72, 32, .5);
    margin: 0 3px 0 5px;
}

.modal input[type="radio"]:focus-visible {
    outline-color: rgb(108, 52, 23);
}

.modal label {
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
    margin: .2rem 0;
}

.modal .text-input-container {
    display: grid;
    gap: .25rem;
    grid-template-columns: max-content minmax(0, 1fr);
    margin: .25rem 0;
}

.modal input[type="text"] {
    box-sizing: border-box;
    border: none;
    outline: rgba(151, 72, 32, .5) solid 1.5px;;
    padding-left: 2px;
    accent-color: rgb(108, 52, 23);
}

.modal input[type="text"]:hover {
    outline: rgba(151, 72, 32, .75) solid 2px;
}
.modal input[type="text"]:focus-visible {
    outline: rgba(151, 72, 32, 1) solid 2px;
}

.modal input[type="checkbox"] {
    margin: auto 0;
    accent-color: rgb(108, 52, 23);
}

.modal input[type="checkbox"]:focus-visible {
    outline-color: rgb(108, 52, 23);
}

.modal-form button {
    box-sizing: border-box;
    width: 100%;
    align-self: center;
    margin-top: .5rem;
    height: 2rem;
    border-radius: calc(2rem / 2);
    text-align: center;
    font-size: 1.5rem;
    color: rgb(151, 72, 32);
    background-color: peachpuff;
    border: rgba(151, 72, 32, .5) solid 2px;
    padding: 0 .5rem;
    cursor: pointer;
}

.modal-form button:hover, .modal-form button:focus-visible {
    background-color: rgb(242, 205, 174);
    border: rgba(151, 72, 32, .75) solid 2px;
}

.modal-close-button {
    position: absolute;
    box-sizing: border-box;
    width: 20px;
    height: 20px;
    top: 2px;
    right: 2px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: .15rem .25rem .25rem .25rem;
    color: rgba(151, 72, 32, .75);
    font-weight: bold;
    font-size: 1rem;
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
}

.modal-close-button:hover {
    color: rgba(151, 72, 32, 1);
}

.modal .horizontal-divider {
    width: auto;
    height: 0;
    border: 2px solid rgb(108, 52, 23);
    border-radius: 2px;
    margin: .25rem 0;

}

#diff-modal-error-message {
    display: none;
    margin: 0 0 .5rem 0;
    justify-self: center;
    color: white;
    background-color: red;
    width: max-content;
    font-size: 1.5rem;
    height: 2rem;
    border-radius: 1rem;
    padding: 0 1rem;
    text-wrap: wrap;
}

#diff-container {
    margin-bottom: .25rem;
}


#edit-type-form {
    width: 20rem;
}

#edit-modal-problem-section, #edit-modal-solution-section {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
#edit-modal-problem-id-container, #edit-modal-solution-id-container {
    display: grid;
    gap: .25rem;
    grid-template-columns: max-content minmax(0, 1fr);
}

#edit-modal-continue-container {
    display: none;
}

#edit-modal-or-container {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
}

.edit-modal-or-horizontal-divider {
    width: 10px;
    height: 2px;
    background-color: rgb(108, 52, 23);
    /* flex-grow: auto; */
    flex-grow: 1;
}

#edit-modal-or-text {
    padding: 0 .2rem 0 .15rem;
}

#edit-modal-continue-fieldset {
    display: flex;
}

#edit-modal-continue-button {
    margin-top: .15rem;
}

#save-modal {
    width: 20rem;
}

#save-modal-problem-id-container, #save-modal-solution-id-container {
    box-sizing: border-box;
    display: grid;
    gap: .25rem;
    grid-template-columns: max-content minmax(0, 1fr);
}

#diff-form-title {
    align-self: center;
    margin: 0;
    border-bottom: rgba(151, 72, 32, .5) solid 2px;
    margin-bottom: .5rem;
}



#editor-container {
    margin: 2.5rem 2.5rem 0 2.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* position: relative; */
    box-sizing: border-box;
}

#header {
    box-sizing: border-box;
    width: 100%;
    height: 2rem;
    height: fit-content;
    background-color: peachpuff;
    border: .1rem solid rgba(151, 72, 32, 0.5);
    border-bottom-color: rgba(151, 72, 32, 0.65);
    display: flex;
    box-shadow: 0px 2px 1px 0px rgba(0, 0, 0, 0.1);
    position: relative;
    align-items: center;


}

.edit-option-button {
    background-color: inherit;
    border: none;
    cursor: pointer;
    padding: 0.25rem .5rem 0.25rem .5rem;
    color: rgb(151, 72, 32);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.edit-option-button:hover {
    color: rgb(108, 52, 23);
    background-color: rgba(0, 0, 0, 0.085);
}

.edit-option-text {
    margin: 0;
    font-weight: bolder;
    font-size: 1.5rem;
    font-family: Arial, Helvetica, sans-serif;
    filter: none;
}

#font-size-button {
    display: inline;
    padding-left: calc(.25rem - .1rem);
    anchor-name: --font-size-button;
}
#font-size-container {
    position-anchor: --font-size-button;
    inset: unset;
    top: anchor(bottom);
    left: anchor(center);
    translate: -50%;
    width: calc(anchor-size(width) * 3);
    border: none;
    padding: 0;
    box-sizing: border-box;
    background-color: transparent;
}
#font-size-container:popover-open {
    display: flex;
    align-items: center;
}

#font-size-small {
    font-size: .75rem;
    letter-spacing: -.25rem;
}
#font-size-medium {
    font-size: 1.10rem;
    letter-spacing: -.25rem;
}
#font-size-large {
    font-size: 1.5rem;
    letter-spacing: -.25rem;
}



#font-size, #decrease-font-button, #increase-font-button {
    aspect-ratio: 1.2;
    box-sizing: border-box;
    width: calc(100% / 3);
    field-sizing: content;
    margin: 0;
    text-align: center;
    font-weight: bold;
    background-color: rgb(255, 209, 168);
    border: 1px solid rgba(151, 72, 32, 0.65);
    color: rgba(151, 72, 32);
}

#font-size {
    font-size: 1.6rem;
    cursor: not-allowed;
}

#decrease-font-button, #increase-font-button {
    font-size: 1.5rem;
    cursor: pointer;
}

#save-button {
    margin-left: auto;
    border-left: .1rem solid rgba(151, 72, 32, 0.5);
    padding-top: .1rem;
    padding-bottom: .1rem;
    height: auto;
    align-self: stretch;
}
#save-button:hover #save-icon{
    fill: rgb(108, 52, 23);
}

#save-icon {
    height: 1.8rem;
    width: 1.8rem;
    aspect-ratio: 1 / 1;
}



#preview-button {
    border-left: .1rem solid rgba(151, 72, 32, 0.5);
}


#editor {
    display: flex;
    height: 35rem;
    min-height: 0;
    flex-grow: 0;
}

#text-editor {
    min-width: 20%;
    resize: none;
    width: 100%;
    padding: 0;
    background-color: rgb(255, 220, 187);
    border: .1rem solid rgba(151, 72, 32, 0.54);
    border-top: none;
    box-sizing: border-box;
    padding: 4px 2px 4px 2px;
    font-size: var(--editor-font-size);
    field-sizing: content;
    flex-shrink: 0;
    flex-grow: 0;
    scrollbar-color: rgba(151, 72, 32, 0.54) rgb(255, 220, 187);
}

#text-editor:focus {
    outline: none;
}

#drag-bar {
    display: none;
    justify-content: center;
    align-items: center;
    user-select: none;
    width: 10px;
    height: 100%;
    padding: 0;
    background-color: peachpuff;
    flex-shrink: 0;
    cursor: ew-resize;
    box-sizing: border-box;
    border-bottom: .1rem solid rgba(151, 72, 32, 0.54);
}

#drag-bar-icon {
    width: 60%;
    height: 5rem;
    background-color: rgba(151, 72, 32, .35);
    border-radius: 5px;

}

#drag-bar:hover #drag-bar-icon {
    width: 60%;
    height: 5rem;
    background-color: rgba(151, 72, 32);
    border-radius: 5px;
    pointer-events: none;

}

#preview-container {
    display: none;
    height: auto;
    min-height: 0;
    min-width: min-content;
    background-color: rgb(255, 220, 187);
    border: .1rem solid rgba(151, 72, 32, 0.54);
    box-sizing: border-box;
    border-top: none;
    padding: calc(4px + .75rem) calc(2px + .75rem) calc(4px + .5rem) calc(2px + .75rem);
    overflow-y: auto;
    overflow-x: clip;
    font-size: var(--editor-font-size);
    flex: 1 1 auto;
    scrollbar-color: rgba(151, 72, 32, 0.54) rgb(255, 220, 187);
}

#preview {
    width: auto;
    min-height: 100%;
    background-color: rgb(255, 197, 146);
    box-sizing: border-box;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: .75rem;
    padding-bottom: .5rem;
}

#preview p {
    margin: 0;
}

.popup-text {
    position: relative;
    cursor: pointer;
    display: inline-block;
    align-self: flex-start;
    font-size: var(--editor-font-size);
    text-decoration-line: underline;
    text-decoration-style: dotted;
    text-decoration-color: black;
    text-underline-offset: .3rem;
}

.popup-text .katex {
    border-bottom: .18rem dashed currentColor; /* yes, .18rem; any objects will be thoughtfully ignored */
}

/* removing the dashed underline for popuptext katex */
.popup-text .popup-definition .katex {
    border-bottom: none;
}


/* contains popup arrows and text */
.popup-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    visibility: hidden;
    position: absolute;
    z-index: 1;
    top: auto;
    bottom: 100%;
    left: 50%;
    /* transform: translateX(-50%); */
    transform: translateX(-50%) translateX(var(--shift-x, 0px));
}

/* above arrow if the popup text is below, by default not displayed because popup text is above rather than below typically */
.popup-arrow-above {
    display: none;
    width: 0;
    height: 0;
    border-left: min(1.4rem, 1.6vh) solid transparent;
    border-right: min(1.4rem, 1.6vh) solid transparent;
    border-bottom: min(1rem, 1.2vh) solid #555;
    transform: translate(calc(var(--shift-x) * -1), 0px);
}

/* the actual definition text */
.popup-definition {
    display: inline-block;
    cursor: auto;
    white-space: normal;
    width: max-content;
    min-width: min-content;
    max-width: calc(var(--editor-font-size) * 5 / 3 * 16);
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: .5rem .5rem;
}

/* the arrow that points to the text, is hidden if definition is below the text */
.popup-arrow-below {
    width: 0;
    height: 0;
    border-left: min(1.4rem, 2vh) solid transparent;
    border-right: min(1.4rem, 2vh) solid transparent;
    border-top: min(1rem, 1.4vh) solid #555;
    transform: translate(calc(var(--shift-x) * -1), 0px);
}

/* if upside down, make definition below text, show above arrow, and hide below arrow */
.popup-container.upside-down {
    top: 100%;
    bottom: auto;
}
.popup-container.upside-down .popup-arrow-above {
    display: block;
}
.popup-container.upside-down .popup-arrow-below {
    display: none;
}

/* when popup is hovered over and when popup-container is part of "show" class, show the popup-container (w/ animation) */
.popup-text:hover .popup-container, .popup-text .popup-container.show{
    visibility: visible;
    -webkit-animation: fadeIn 1s;
    animation: fadeIn 1s;
}


@-webkit-keyframes fadeIn {
    from {opacity: 0;}
    to {opactiy: 1;}
}

@keyframes fadeIn {
    from {opacity: 0;}
    to {opactiy: 1;}
}

#diff-modal {
    max-width: min(70rem, 80%);
}

#diff-modal span {
    white-space: pre-wrap;
}