*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
    /* main colors */
    --fg: black;
    --bg: white;

    /* general design elements */
    --body-font: sans-serif;
    --border-style: 1px solid var(--fg);

    /* film status colors */
    --expired: red;
    --unknown: darkgray;

    --loaded: gold;
    --shot: darkorange;
    --developed: lawngreen;
}

/* Page Structure */

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--body-font);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

nav {
    border-bottom: var(--border-style);
}
nav ul {
    list-style: none;
    display: flex;
    flex-direction: row;
    padding: 0;
}
nav ul li {
    padding: 0.25rem;
}

main {
    flex: 1;
    padding: 0 1rem;
}

footer {
    font-size: 80%;
    padding: 1rem;
}

/* ul {
    padding-left: 0;
    list-style: none;
}
ul ul {
    list-style: none;
} */

a.link-button {
    border: var(--border-style);
    padding: 0.5rem 0.75rem;
    width: fit-content;
    cursor: pointer;
}
a.link-button.centered {
    margin: 1rem auto;
    display: block;
}

div.centered {
    width: fit-content;
    margin: 1rem auto;
}

.loaded {
    color: var(--loaded);
}
.shot {
    color: var(--shot);
}
.loaded {
    color: var(--loaded);
}
/* View Film Page */

#edit-film-form-box {
    display: none;
    background: var(--bg);
    border: var(--border-style);
    padding: 1rem;
    margin-top: 1rem;
}
#edit-film-form-box h2 {
    display: flex;
    justify-content: space-between;
    margin-top: 0;
}
button#close {
    background: none;
    border: none;
    cursor: pointer;
}

#film-info button {
    width: 100%;
}

/* Typography */

h1 + p.subheading {
    margin-top: -1.5rem;
}
h2 + p.subheading {
    margin-top: -1.2rem;
}
p.tips {
    font-size: 90%;
}

/* Forms */

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

fieldset h2 {
    font-size: 1.25rem;
    padding-left: 1rem;
}
fieldset h3 {
    font-size: 1.2rem;
    padding-left: 1rem;
}

div.form-field {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}
div.form-field label {
    padding-right: 0.5rem;
    min-width: fit-content;
}
div.form-field input, div.form-field select {
    width: 100%;
}
div.form-field #camera_type_input, div.form-field #film_format_input {
    margin-left: 0.5rem;
}
div.form-field + p.small, div.form-field + p.tips {
    margin-top: -0.5rem;
}

.reveal-if-active {
    display: none;
}
input[type="radio"]:checked ~ .reveal-if-active {
    display: block;
}
input[type="checkbox"]:checked ~ .reveal-if-active {
    display: inline;
}
.hide-if-active {
    display: block;
}
.hide-if-active:has(+ input[type="checkbox"]:checked) {
    display: none;
}

div.message {
    border: var(--border-style);
    padding: 0.5rem;
    margin-top: 1rem;
}

fieldset {
    margin: 0 0 1rem;
    border: var(--border-style);
}

button[type="submit"] {
    margin-top: 1rem;
}

/* Tables */

table {
    margin: auto;
    border-collapse: separate;
    border-spacing: 0;
}
td, th {
    border: var(--border-style);
    border-style: none solid solid none;
}
tr:first-child th { border-top-style: solid; }
table:not(#films) tr th:first-child, table:not(#films) tr td:first-child { border-left-style: solid; }
table#films tr th:nth-child(2), table#films tr td:nth-child(2) { border-left-style: solid; }

td, th {
    padding: 0.25rem 0.5rem;
}
table#films th:first-of-type, table#films td:first-of-type {
    border: none;
}

/* tweaking table column widths */
table td[stock] {
    min-width: 10rem;
}

td.expired {
    background: var(--expired);
}
td.unknown {
    background: var(--unknown);
}

td.not-applicable {
    background: 
        linear-gradient(to top left, transparent calc(50% - 1px), var(--fg), transparent calc(50% + 1px) ),
        linear-gradient(to top right, transparent calc(50% - 1px), var(--fg) , transparent calc(50% + 1px) )
}

div.status-indicator {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
}

td.status.loaded > div.status-indicator {
    background: var(--loaded);
}
td.status.shot > div.status-indicator {
    background: var(--shot);
}
td.status.developed > div.status-indicator {
    background: var(--developed);
}

.test {
    outline: 2px solid red;
}
.small {
    font-size: 80%;
}

/* Camera Page */
img.camera-icon {
    width: 6rem;
}

/* DESKTOP STYLES */
@media (min-width: 768px) {
    body {
        width: 60%;
        margin: auto;
    }

    div#film-info {
        display: flex;
        justify-content: space-between;
    }
    div#film-info > div {
        text-align: right;
    }

    /* Desktop - Edit Film Page */

    #film-info button {
        width: 20rem;
    }

}