@font-face {
    font-family: "fixedsys";
    src: url("fonts/fixedsys.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
}

/* Apply to everything */
* {
    box-sizing: border-box;
    font-family: "fixedsys", sans-serif;

    /* outline: 1px solid pink; */
}

html, body {
    height: 100%;
    margin: 0;
    background-image: url("../images/space_background3.png");
    /* background-image: url("../images/todo/matrix_tile.gif"); */
    /* background-image: url("../images/space_background2.png"); */
    /* background-image: url("../images/space_background.png"); */
    /* background-image: url("../images/star_background.gif"); */
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100dvh
}

#excel-window {
    height: 95%;
    width: 70%;
    display: grid;
    border: 1px solid #c0c0c0;
}
#excel-window > * {
  min-width: 0;
}

.hidden {
    display: none !important;
}

.horizontal-group {
    display: flex;
    gap: 1px;
    min-width: 0;
}

.faint-text {
    color: #606060;
}

.outset98,
.square-button,
.scroll-thumb {
    border-top: 2px solid #ffffff;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
}

.inset98,
#formula-input,
.dropdown-display,
.square-button:active,
.square-button:disabled {
    border-top: 2px solid #404040;
    border-left: 2px solid #404040;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    
    width: 16px;
    height: 16px;
    border: inset;

    display: grid;
    place-content: center;
}
input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;

    /* background-color: red; */
    transform: scale(0);
    transform-origin: bottom left;
    box-shadow: inset 1em 1em black;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
input[type="checkbox"]:checked::before {
    transform: scale(1);
}
input:focus{
    outline: none;
}

:root {
    /* TODO: */
    --zindex-sheet-corner-header: 4;
    --zindex-sheet-headers: 3;
    --zindex-sheet-embeds: 2;
    --zindex-sheet-cells: 1;

    --zindex-dropdown: 10;

    --cell-height: 20px;
    --cell-header-width: 32px;
    --cell-width: 64px;

    --title-font-color: #f8f8f8;
    --title-blue: #080065;
    /* --title-blue: #1D6F42; */
    /* --title-blue: #600000; */
    /* --title-blue: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); */
    --background-gray: #B9B6BB;
    --background-gray-bright2: #c7c4c8;
    --background-gray-bright3: #cecbcf;
    --background-gray-bright4: #d4d3d6;
    --background-gray-dark1: #a09ea2;
    --background-gray-dark2: #89868a;

    --background-beige: #ece9d8;
}

/*-- ================================================ --->
<---                  GENERIC BUTTONS                 --->
<--- ================================================ --*/
/*#region BUTTONS*/
.square-button {
    width: 18px;
    height: 18px;
    padding: 0;

    min-width: 18px;

    background-color: #c0c0c0;

    cursor: pointer;
    position: relative;
}
.square-button:disabled {
    cursor: auto;
}

.left-button::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;

    width: 0;
    height: 0;

    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 8px solid black;
}
.right-button::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 4px;

    width: 0;
    height: 0;

    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid black;
}
.up-button::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 2px;

    width: 0;
    height: 0;

    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 8px solid black;
}
.down-button::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 2px;

    width: 0;
    height: 0;

    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid black;
}
/*#endregion BUTTONS*/


/*-- ================================================ --->
<---                    TITLE BAR                     --->
<--- ================================================ --*/
/*#region TITLEBAR*/
.title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;

    height: fit-content;
    padding: 0 10px;

    border-style: outset; 
    background: var(--title-blue);
    color: var(--title-font-color);
    font-size: 18pt;
}

#main-title-left {
    height: 100%;
    height: 36px;
    cursor: pointer;
}

#main-title {
    height: 36px;
    line-height: 36px;
    box-sizing: border-box;
}
#title-img {
    height: 30px;
    width: auto;
    object-position: 1px;
    display: inline-block;
    vertical-align: middle;
    margin-top: -2px;
}
#main-title-text {
    min-height: 36px;
    line-height: 36px;
}


/* Window controls */
.window-controls {
    display: flex;
    gap: 0.5rem;

    transition: filter 0.2s ease;
}

/* Draw minimize button */
.minimize::after {
    content: "";

    display: block;
    width: 70%;
    height: 15%;
    background-color: black;

    margin: 50% auto 0;
}

/* Draw maximize button */
.maximize::after {
    content: "";

    width: 45%;
    height: 45%;

    border: 2px solid black;
    
    position: absolute;

    background-color: var(--background-gray);
    top: 15%;
    left: 15%;
}

/* Draw close button */
.close::before,
.close::after {
    content: "";

    width: 70%;
    height: 15%;
    background-color: black;
    
    position: absolute;
    top: 45%;
    left: 15%;
}
.close::before {
    rotate: 45deg;
}
.close::after {
    rotate: -45deg;
}
/*#endregion TITLEBAR*/


/*-- ================================================ --->
<---                   MENU OPTIONS                   --->
<--- ================================================ --*/
/*#region MENU_OPTIONS*/
#menu-bar {
    background-color: var(--background-gray);
    min-height: 20px;
    padding-left: 0rem;

    display: flex;

    align-items: center;
    user-select: none;
}

.menu-button {
    border: none;
    background-color: transparent;
    font-size: 1rem;
}
.menu-button:hover {
    background-color: var(--background-gray-bright3);
}
.menu-button:active {
    background-color: var(--background-gray-dark1);
}
/*#endregion MENU_OPTIONS*/


/*-- ================================================ --->
<---                   MENU BUTTONS                   --->
<--- ================================================ --*/
/*#region MENU_BUTTONS*/
#menu-bar .horizontal-group {
    margin-left: 8px;
}
#menu-bar .dropdown {
    margin-left: 4px;
}
#menu-bar .square-button:not(.dropdown-display button) {
    margin-top: 2px;
}

#save-button::before {
    content: "";

    position: absolute;
    top: 5%;
    left: 9%;

    width: 70%;
    height: 72%;

    background-color: #808080; /* main box*/

    border: 1px solid black;
}
#save-button::after {
    content: "";

    position: absolute;
    top: 5%;
    left: 25%;

    width: 40%;
    height: 32%;

    background-color: #e0e0e0; /* upper box*/

    border: 1px solid black;

    box-shadow: 0px 3px 0px 0 #303030; /* lower box*/
}

#undo-button::before {
    content: "";

    position: absolute;
    top: 25%;
    left: 30%;

    width: 40%;
    height: 40%;

    border-top: 2px solid black;
    border-left: 2px solid black;

    rotate: 45deg;
}
#undo-button::after {
    content: "";

    position: absolute;
    top: 30%;
    left: 5%;

    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 6px solid black;

    rotate: -45deg;
}

#redo-button::before {
    content: "";

    position: absolute;
    top: 25%;
    left: 17%;

    width: 40%;
    height: 40%;

    border-top: 2px solid black;
    border-left: 2px solid black;

    rotate: 45deg;
}
#redo-button::after {
    content: "";

    position: absolute;
    top: 30%;
    left: 55%;

    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 6px solid black;

    rotate: 45deg;
}

#cut-button::before {
    content: "o";
    color: transparent;

    position: absolute;
    top: -10%;
    left: 0%;

    height: 80%;
    
    border-right: 2px solid black;
    text-shadow: 2px 1px 0 black;
    border-top: 2px solid transparent;

    rotate: 20deg;
}
#cut-button::after {
    content: "o";
    color: transparent;

    position: absolute;
    top: -10%;
    left: 40%;

    height: 80%;
    
    border-left: 2px solid black;
    text-shadow: -2px 1px 0 black;
    border-top: 2px solid transparent;

    rotate: -20deg;
}

#copy-button::before {
    content: "";
    
    position: absolute;
    top: 17%;
    left: 10%;

    width: 35%;
    height: 50%;
    
    border: 2px solid black;
}
#copy-button::after {
    content: "";
    
    position: absolute;
    top: 0%;
    left: 30%;

    width: 35%;
    height: 50%;
    
    border: 2px solid black;
    /* background-color: #c0c0c0; */
    background:
        linear-gradient(
            to bottom,
            #000 1px,
            #c0c0c0 1px
        ) 1px 1px/ 3px 2px repeat-y,
        #c0c0c0;
}

#paste-button-2 {
    position: absolute;
    top: 10%;
    left: 10%;

    width: 60%;
    height: 80%;
    border: 2px solid black;
}
#paste-button::before {
    content: "";
    
    position: absolute;
    top: 2%;
    left: 25%;

    width: 11%;
    height: 15%;
    border: 1px solid black;
    background-color: black;
}
#paste-button::after {
    content: "";
    
    position: absolute;
    top: 35%;
    left: 40%;

    width: 25%;
    height: 35%;
    
    border: 2px solid black;
    /* background-color: #c0c0c0; */
    background:
        linear-gradient(
            to bottom,
            #000 1px,
            #c0c0c0 1px
        ) 1px 1px/ 2px 2px repeat-y,
        #c0c0c0;
}
/*#endregion MENU_BUTTONS*/


/*-- ================================================ --->
<---                  MENU SELECTORS                  --->
<--- ================================================ --*/
/*#region MENU_SELECTORS*/
/* Theme selector */
#theme-input-dropdown {
    width: max-content;
}
#theme-input {
    width: 12rem;
}
#theme-selector {
    width: calc(82px + 22px);
}

/* Background selector */
#background-input-dropdown {
    width: max-content;
}
#background-input {
    width: 12rem;
}
#background-selector {
    width: calc(145px + 22px);
}


/*  Cursor selector */
#font-size-input {
    width: 3rem;
    field-sizing: content;
}


.align-button::before {
    content: "";

    position: absolute;
    top: 12.5%;
    left: 12.5%;

    width: 75%;
    height: 2px;

    background-color: black;

    box-shadow: 0 8px black;
}
#left-align-button::after {
    content: "";

    position: absolute;
    top: 12.5%;
    left: 12.5%;

    width: 50%;
    height: 2px;

    background-color: black;

    box-shadow: 0 4px black;
}
#center-align-button::after {
    content: "";

    position: absolute;
    top: 12.5%;
    left: 12.5%;

    width: 75%;
    height: 2px;

    background-color: black;

    box-shadow: 0 4px black;
}
#right-align-button::after {
    content: "";

    position: absolute;
    top: 12.5%;
    left: 27.5%;

    width: 50%;
    height: 2px;

    background-color: black;

    box-shadow: 0 4px black;
}
/*#endregion MENU_SELECTORS*/


/*-- ================================================ --->
<---                  MARQUEE BAR                     --->
<--- ================================================ --*/
/*#region MARQUEEBAR*/
#marquee-bar {
    background-color: var(--background-gray);
    min-height: 20px;

    display: flex;
    padding: 0 2px;
    gap: 4px;
}

#formula-input {
    width: 15%;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #404040;
}
/*#endregion MARQUEEBAR*/


/*-- ================================================ --->
<---                     MARQUEE                      --->
<--- ================================================ --*/
/*#region MARQUEE*/
.marquee-container {
    flex: 1 1 auto;
    background-color: #ffffff;

    border-bottom: 2px solid #808080;
    border-left: 2px solid #ffffff;
    border-right: 2px solid #404040;
    border-top: 2px solid black;

    display: flex;

    overflow: hidden;
    position: relative;
}
.marquee-track {
    display: flex;
    width: max-content;

    position: absolute;
    overflow: hidden;
    margin-top: -1px;

    animation: marquee calc(8s * var(--item-count) * 2) linear infinite;
}
.marquee-item {
    white-space: pre;
    float: left;
    width: max-content;
    padding-left: 100px;
    user-select: none;
}
/* .marquee-container:hover div {
    -webkit-animation-play-state: paused;
    animation-play-state: paused;
} */
@keyframes marquee {
    from { transform: translateX(0) }
    to { transform: translateX(-50%) }
}
/*#endregion MARQUEE*/


/*-- ================================================ --->
<---                      SHEET                       --->
<--- ================================================ --*/
/*#region SHEET*/
#sheet-scroll-container {
    background-color: #f8f8f8;
    width: 100%;
}

#sheet-canvas {
    position: relative;
    /* width: calc(32px + 64px*26); */
    height: calc(20px + 20px*39);
    width: 100%;
}

/* Mock grid headers & cells */
#mock-grid {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;

    background-image:
        linear-gradient(#d4d4d4 1px, transparent 1px),
        linear-gradient(90deg, #d4d4d4 1px, transparent 1px);
    background-size: 64px 20px;
    background-position: 31px 19px;
}

#corner-header {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 4;

    background-color: var(--background-gray);
    border: 1px solid #2C2C2C;

    height: 20px;
    width: 32px;
}

#mock-hheader {
    display: flex;
    text-align: center;
    height: 100%;
    
    width: 100%; /* Remove for horizontal scroll */
    overflow: clip; /* Remove for horizontal scroll */

    position: absolute;
    top: 0;
    left: 0;
}
.horizontal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    
    background-color: var(--background-gray);
    border-top: 1px solid #2C2C2C;
    border-bottom: 1px solid #2C2C2C;
    border-right: 1px solid #2C2C2C;

    width: 64px;
    min-width: 64px; /* Remove for horizontal scroll */
    height: 20px;
}
#A0 {
    margin-left: 32px;
}

#mock-vheader {
    display: flex;
    flex-direction: column;
    text-align: center;
    width: 100%;

    height: 100%;
    overflow: clip;

    position: absolute;
    top: 0;
    left: 0;
}
.vertical-header {
    position: sticky;
    left: 0;
    z-index: 3;

    background-color: var(--background-gray);
    border-left: 1px solid #2C2C2C;
    border-right: 1px solid #2C2C2C;
    border-bottom: 1px solid #2C2C2C;
    
    width: 32px;
    height: 20px;
    min-height: 20px;
}

#sheet-overlay {
    position: absolute;
    inset: 0;
    margin-left: 32px;
    margin-top: 20px;
    z-index: 2;
}
/*#endregion SHEET*/


/*-- ================================================ --->
<---                     FOOTER                       --->
<--- ================================================ --*/
/*#region FOOTER*/
footer {
    background: var(--title-blue);
}

#first-sheet-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;

    inset: 2px;
    border-left: 2px solid black;
}
#last-sheet-button::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;

    inset: 2px;
    border-right: 2px solid black;
}

#sheets-and-scrollbar {
    display: flex;
    overflow: hidden;
    scrollbar-width: none;
    
    /* border-top: 2px solid #808080; */
}
#sheets-and-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Sheet tabs */
nav#sheet-tabs {
    display: flex;
    flex: 0 0 auto;

    margin-right: 6px;
    white-space: nowrap;

    position: relative;
}

.sheet-tab {
    width: 80px;
    padding-bottom: 3px;
    
    display: flex;
    text-align: center;
    align-items: center;
    justify-content: center;
    font-size: 12pt;
    cursor: pointer;

    background-color: black; /* Border for the tabs! */

    position: relative;
    margin-right: -6px;

    clip-path: polygon(0% 0%, 100% 0%, 92.5% 100%, 7.5% 100%);
}
.sheet-tab::after {
    content: "";
    position: absolute;
    inset: 1px;
    z-index: -2;

    background-color: var(--background-gray); /* Tab background color! */

    clip-path: polygon(0% 0%, 100% 0%, 92.5% 100%, 7.5% 100%);


    pointer-events: none;
}
.sheet-tab:hover::after {
    background-color: var(--background-gray-bright4);
}

.active-tab.sheet-tab::after {
    background-color: #f8f8f8; /* Tab background color! */
    margin-top: -1px;
}

.sheet-link {
    text-decoration: none;
}
/*#endregion FOOTER*/


/*-- ================================================ --->
<---                CUSTOM SCROLLBARS                 --->
<--- ================================================ --*/
/*#region SCROLLBARS*/
.scroll-and-content {
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    position: relative;
    /* must also define a fixed height in the specific element's CSS */
}

.scroll-container {
    overflow-x: scroll;
    overflow-y: scroll;
}
.scroll-container::-webkit-scrollbar {
    display: none;
}

.horizontal-scrollbar {
    display: flex;
    flex: 1;
}
.vertical-scrollbar {
    display: flex;
    flex-direction: column;
}

.scroll-track {
    flex: 1;
    position: relative;
    background-color: #e0e0e0;

    border-top: 2px solid #808080;
    border-left: 2px solid #808080;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
}
.horizontal-scrollbar .scroll-track {
    height: 18px;
}
.vertical-scrollbar .scroll-track {
    width: 18px;
}

.scroll-thumb {
    position: absolute;
    top: 0;
    left: 0;

    height: 100%;
    width: 60px;

    background-color: var(--background-gray);

    cursor: pointer;
}
.horizontal-scrollbar .scroll-thumb {
    height: 100%;
    width: 60px;
}
.vertical-scrollbar .scroll-thumb {
    height: 160px;
    width: 100%;
}
/*#endregion SCROLLBARS*/


/*-- ================================================ --->
<---                 CUSTOM DROPDOWN                  --->
<--- ================================================ --*/
/*#region DROPDOWN*/
.dropdown {
    position: relative;
    width: 12rem;
    font-size: 11pt;
}
.dropdown-display {
    /* border-top: 2px solid #404040;
    border-left: 2px solid #404040;
    border-right: 2px solid #404040; */
    user-select: none;
    background-color: #ffffff;
    padding-left: 0.5rem;
}
.dropdown button {
    float: right;
}

.dropdown-options {
    position: absolute; /* makes them not flex the menu bar */

    padding-left: 3px;

    z-index: 20;
    width: calc(100% - 18px);

    background-color: #ffffff;
    border-left: 2px solid #9e9e9e;
    border-right: 2px solid #404040;
    border-bottom: 2px solid #404040;
}
.dropdown-item {
    padding-left: 0.75rem;
    color: black;
    border-top: 1px solid #f0f0f0;
}
.dropdown-item:hover {
    background-color: #f0f0f0;
}
.dropdown-selected, .dropdown-selected:hover {
    background-color: #e0e0e0;
}
/*#endregion DROPDOWN*/


/*-- ================================================ --->
<---                 EMBEDDED WINDOWS                 --->
<--- ================================================ --*/
/*#region EMBEDWINDOWS*/
.embedded-window {
    background: var(--background-beige);
    border-top: 2px solid #e8f0ff;
    border-left: 2px solid #e8f0ff;
    border-right: 2px solid #2f4f6f;
    border-bottom: 2px solid #2f4f6f;
    box-shadow: inset 1px 1px 0 #dfdfdf;
}
.embedded-title {
    display: flex;
    align-items: center;
    user-select: none;
    gap: 1%;

    height: fit-content;
    padding: 0 10px;

    border-style: outset; 
    background: var(--title-blue);
    color: var(--title-font-color);
    font-size: 18pt;
}
.window-container {
    margin: 15px;
}
/*#endregion EMBEDWINDOWS*/


/*-- ================================================ --->
<---           MEDIA QUERIES / RESPONSIVENES          --->
<--- ================================================ --*/
/*#region MEDIA */
@media (max-width: 1600px) {
    #excel-window {
        width: 90vw;
        height: 97vh;
        border: none;
    }
    #header {
        flex-wrap: wrap;
    }
    #footer {
        overflow-x: auto;
    }
}
@media (max-width: 1250px) {
    #readonly-mode {
        display: none;
    }
}
@media only screen and (max-width: 1100px) {
    #insert-menu {
        display: none;
    }
    #formula-input {
        display: none;
    }
}
@media only screen and (max-width: 1025px) {
    #view-menu {
        display: none;
    }
}
@media only screen and (max-width: 975px) {
    #theme-selector,
    #cursor-selector {
        width: 6rem;
    }
    #background-selector {
        width: 6.5rem;
    }
}
@media (max-width: 900px) {
    #excel-window {
        width: 95vw;
        height: 97vh;
        border: none;
    }
}
@media (max-width: 745px) {
    .font-button,
    .align-button {
        display: none;
    }
}
@media (max-width: 600px) {
    #cursor-selector {
        display: none;
    }
    #theme-input {
        width: 6rem;
    }
}
@media only screen and (max-width: 545px) {
    .horizontal-header {
        line-height: 12px;
        height: 14px;
    }
    .vertical-header{
        width: 18px;
    }
    #A0 {
        margin-left: 18px;
    }
    #corner-header {
        height: 14px;
        width: 18px;
    }
    #mock-grid {
        top: -6px;
        left: -14px;
    }
    #mock-hheader {
        left: 14px;
    }
    #mock-grid {
        width: calc(100% + 10px);
    }
}
@media (max-width: 530px) {
    #theme-selector {
        display: none;
    }
}
@media (max-width: 430px) {
    #help-menu {
        display: none;
    }
}
@media only screen and (max-width: 400px) {
    #menu-bar {
        padding-left: 0;
    }
    #theme-input {
        width: 4rem;
    }
}
@media (max-width: 375px) {
    #edit-menu {
        display: none;
    }
}
/*#endregion MEDIA */