html, body {
    margin-top: 10px;
    margin-bottom: 10px;
}

body {
    background-color: rgb(251, 241, 240);
    /* height: calc(100vh - 20px); */
    min-height: calc(100vh - 20px);
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 0 10% 0 10%;
    /* grid-row-gap: 5px; */
}

/* Using h3 as the "big text" element */
h3 {
    /* Seems to have a big margin by default, so just remove it */
    margin: 0;

    /* To make the text centered, vertically */
    display: flex;
    flex-direction: column;
    justify-content: center;

    /* And some okay-looking font.. */
    font-family: Palatino;
    font-size: 26px;
    letter-spacing: 2px;
    word-spacing: 1.7px;
    font-weight: normal;
}


nav {
    grid-row: 1 / 2;
    display: flex;
    flex-direction: column;
}
nav > div:last-child {
    flex: 1;
    display: block;
}
nav > div { 
    flex: 3;
    display: flex;
}

nav > div > h1 {
    flex: 1;
    color: rgb(174, 26, 26);
}

nav > div > #tools {
    display: flex;
    flex: 1;
    /* chrome requires "flex-end" instead of just "end".. */
    justify-content: flex-end;

    /* just using the unicode symbol, for now. not even sure I need a "menu" */
    font-size: 52px;
    font-weight: normal;
}


main {
    display: flex;
    flex-direction: column;
    grid-row: 2 / 3;
    /* background-color: rgb(230, 230, 230); */
}

main > div {
    flex: 1;
}

footer {
    grid-row: 3 / 4;
}

#selectors-container {
    display: flex;
    flex-direction: column;
}
#selectors-container.hidden {
    display: none;
}
#selectors-container > * {
    flex: 1;
    margin-top: 20px;
}

#selectors-container > div:last-child {
    margin-top: 14px;
    display: flex;
    justify-content: space-around;
}

#prices, #stamps {
    display: grid;
    grid-gap: 5px;
    grid-template-columns: repeat(11, 1fr);
    /* grid-template-rows: repeat(9, 1fr); */
    /* grid-auto-columns: 20px; */
    /* grid-auto-flow: column; */
}







/* COMMON ELEMENTS */
/* spinner from w3schools */
div.spinner {
    display: inline-block;
    border: 6px solid rgb(85, 85, 85);
    border-top: 6px solid rgb(67, 147, 179);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1.5s linear infinite;
}
/* FUN! :D
div.spinner:before {
    content: '\1F604';
}*/
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
span.spinner.hidden {
    display: none;
}


span.button {
    /* Centers the text on the box in the center, horizontally */
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;

    /* Some font styling */
    color: black;
    font-family: Palatino;
    font-size: 22px;
    letter-spacing: 2px;
    font-weight: normal;
    font-variant: small-caps;

    width: 250px;
    padding: 14px 28px;
    background-color: rgb(227, 76, 76);
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}
span.button:hover {
    background-color: rgb(234, 30, 30);
    border: 1px solid rgb(130, 130, 130);
}

/* buttons should be sort of "grayed-out" when not active */
span.button.deactivated {
    cursor: default;
    background-color: rgb(227, 174, 174);
    color: rgb(75, 75, 75);
}
span.button.deactivated:hover {
    background-color: rgb(227, 174, 174);
    border: none;
}

span.number-box {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6em;
    color: rgb(35, 35, 35);
    height: 75px;
    width: 75px;
    background-color: rgb(129, 170, 174);
    border-radius: 5px;
    cursor: pointer;
    transition: 0.2s;
}

/* the first number box is special: it's the one where we can add more */
span.number-box:first-child {
    background-color: rgb(79, 147, 181);
}

span.number-box-small {
    padding: 0px 5px;
    background-color: rgb(150, 150, 50);
    font-size: 1.7em;
    color: red;
}

span.number-box:hover {
    background-color: red;
}

/* .user-added must come before .selected in the source,
 * because number-boxes can have both, and in that case the
 * .selected should take priority. Encode that priority by having
 * the rule for .selected written after the rule for .user-added,
 * so the property will be "overwritten" */
span.number-box.user-added {
    background-color: rgb(172, 151, 123);
}

span.number-box.selected {
    color: rgb(15, 15, 15);
    background-color: rgb(240, 75, 75);
}

span.number-box > input[type=tel] {
    padding: 6px;
    background-color: rgb(192, 211, 255);
    border: 1px solid rgba(255, 0, 0, 0.45);
    border-radius: 3px;
    width: 2em;
    height: 2em;
    font-size: 0.8em;
}

hr.onepx {
    border: 0;
    height: 1px;
}
hr.red-right-gradient {
    background-image:
      linear-gradient(to right,
        rgba(0,0,0,0),
        rgba(174,26,26,1));
}
hr.blue-left-gradient {
    background-image:
      linear-gradient(to left,
        rgba(0,0,0,0),
        rgba(26,26,174,1));
}

/* a small message that pops up for a short duration */
#toast {
    visibility: hidden;
    min-width: 360px;
    background-color: rgb(70, 76, 164);
    transform: translateX(-50%);
    color: rgb(240, 233, 233);
    font-size: 1.5em;
    text-align: center;
    border-radius: 8px;
    padding: 22px;
    position: fixed;
    left: 50%;
    bottom: 50%;
}
#toast.show {
    visibility: visible;
    animation: fadein 0.75s, fadeout 0.75s 4s;
}
@keyframes fadein {
    from { bottom: 0; opacity: 0; }
    to { bottom: 50%; opacity: 1; }
}
@keyframes fadeout {
    from { opacity: 1; }
    to { opacity: 0; }
}




/* special case colors for the reset buttons, just to vary it up a bit */
#clear, #newsearchbutton {
    background-color: rgb(65, 138, 230);
}
#clear.deactivated, #newsearchbutton.deactivated {
    background-color: rgb(176, 187, 230);
}


/* RESULT AREA */
#result-container.hidden {
    visibility: hidden;
}
/*#result-area.hidden {
    display: none;
}*/

div#result-area {
    display: flex;
    flex-direction: column;

    /* XXX adding fade-up and fade-down effects when I go for search */
    transition: max-height 0.4s ease;
}

div#result-area > section {
    flex: 1;
}


#result-area > section > p {
    margin-top: 4px;
    margin-left: 3em;
    font-size: 1.4em;
    font-family: sans-serif;
    letter-spacing: 3px;
    word-spacing: 4px;
}
#result-area > section > p.loading {
    display: inline-block;
}
#result-area > section > p:first-child {
    margin-left: 0;
}

#pdfdownload-area {
    display: flex;
    justify-content: space-around;
}
#pdfdownload-area.hidden {
    display: none;
}

/* custom style when the startpdf button is clicked, to indicate that
 * work is in progress */
#startpdfbutton.clicked {
    display: inline-block;
    filter: grayscale(35%);
}
/* and the accompanying loader icon, courtesy codepen.io/rramphal/pen/gpjXNy */
span.dot-loader {
    display: inline-block;
    height: 10px;
    width: 45px;
}
span.dot-loader > span {
    display: inline-block;
    height: 10px; width: 10px;
    border-radius: 50%;
    margin 0px 2px;
    background-color: rgba(9, 24, 232, 0.9);
    animation: fadeOutIn 500ms infinite alternate;
    /*
    animation-name: fadeOutIn;
    animation-duration: 500ms;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    */
}
span.dot-loader > span:nth-child(1) { animation-delay: 250ms; }
span.dot-loader > span:nth-child(2) { animation-delay: 500ms; }
span.dot-loader > span:nth-child(3) { animation-delay: 750ms; }
@keyframes fadeOutIn {
    0% { background-color: rgba(9, 24, 232, 0.9); }
    100% { background-color: rgba(9, 24, 232, 0.1); }
}

/* styling for checkboxes a mix of http://css-tricks.com/the-checkbox-hack/
 * and w3 schools custom checkbox */
input[type="checkbox"]:not(:checked),
input[type="checkbox"]:checked {
    position: absolute;
    left: -9999px;
}
input[type="checkbox"]:not(:checked) + label,
input[type="checkbox"]:checked + label {
    position: relative;
    padding-left: 2em;
    cursor: pointer;
}
input[type="checkbox"]:not(:checked) + label:before,
input[type="checkbox"]:checked + label:before {
    border: 2px solid rgb(67, 147, 179);
    border-radius: 2px;
    content: '';
    position: absolute; left: 0; top: 0; width: 1.5em; height: 1.35em;
    background-color: rgb(67, 147, 179);
}
input[type="checkbox"]:not(:checked) + label:after,
input[type="checkbox"]:checked + label:after {
    content: '\2713\0020';
    position: absolute; top: .15em; left: .22em;
    font-size: 1.5em;
    line-height: 0.8;
    color: rgb(128, 20, 20);
    transition: all .2s;
}
input[type="checkbox"]:not(:checked) + label:after {
    opacity: 0;
    transform: scale(0);
}
input[type="checkbox"]:checked + label:after {
    opacity: 1;
    transform: scale(1);
}

/* disabled checkbox styles */
input[type="checkbox"]:disabled + label:before {
    background-color: rgb(185, 190, 196);
    border-color: rgb(185, 190, 196);
}
