/* Variables */
:root {
    --primary-color: #333;
    --secondary-color: #666;
    --background-color: #f5f5f5;
    --link-color: #0066cc;
    --link-hover-color: #004499;
    --font-family: serif;
    --header-font-family: sans-serif;

    --thumbnail-size: 300px;
    --list-thumbnail-size: 200px;
    --list-indent: 1.5rem;
    --shadow-color: rgba(0, 0, 0, 0.1);

}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* General styling */

a {
    color: var(--link-color);
    text-decoration: none;

    &:hover {
        color: var(--link-hover-color);
        text-decoration: underline;
    }
}

a.anchor {
    color: var(--primary-color);

    &:hover {
        text-decoration: none;
        color: var(--primary-color);
    }
}


/* Header */
header {
    background-color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px var(--shadow-color);

    nav {
        max-width: 1200px;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .left {
            display: flex;
            align-items: center;
        }

        .right {
            display: flex;
            align-items: center;
        }

        a {
            margin-left: 0.75rem;
            margin-right: 0.75rem;
            font-weight: 500;
        }
    }
}

/* Main content */
main {
    max-width: 1200px;
    min-width: 100%;
    margin: 2rem auto;
    padding: 0 2rem;
    flex: 1;
}

/* Search */
.search-container {
    margin-bottom: 2rem;
    margin-left: 2rem;

    .number-input,
    .search-input {
        font-size: 1rem;
        border: 2px solid #ddd;
        border-radius: 4px;
        transition: border-color 0.3s;

        &:focus {
            outline: none;
            border-color: var(--link-color);
        }
    }

    .number-input {
        padding: 0.5rem 0.75rem;
    }

    .search-input {
        width: 100%;
        max-width: 500px;
        padding: 0.75rem 1rem;
    }
}

/* Footer */
footer {
    background-color: white;
    padding: 2rem;
    margin-top: 4rem;
    text-align: center;
    box-shadow: 0 -2px 4px var(--shadow-color);

    p {
        color: var(--secondary-color);
        font-size: 0.9rem;
    }
}

ul.box-content {
    list-style: none;
    padding: 0;

    li {
        display: inline-block;
    }

    li:not(:last-child):after {
        content: ", ";
    }
}

p.list {
    padding-left: var(--list-indent);
    text-indent: calc(-1 * var(--list-indent));

    .list-item {
        white-space: nowrap;
    }
}

div.list {
    list-style: none;

    .list-element {
        background-color: white;
        padding: 1.5rem;
        margin-bottom: 1rem;
        border-radius: 10px;
        box-shadow: 3px 3px 5px var(--shadow-color);
        color: var(--primary-color);

        .element-image {
            display: inline-block;
            width: var(--list-thumbnail-size);
            height: var(--list-thumbnail-size);
            margin-right: 1.5rem;
            vertical-align: middle;
            text-align: center;

            img {
                width: 100%;
                height: 100%;
                object-fit: contain;
                border-radius: 10px;
            }
        }

        .element-info {
            display: inline-block;
            vertical-align: middle;
            max-width: calc(100% - var(--list-thumbnail-size) - 2rem);
        }

        h3 {
            margin-bottom: 0.5rem;
            font-size: 1.3rem;
            font-family: var(--font-family);
        }

        p {
            margin: 0.25rem 0;
            /* font-size: 0.9rem; */
        }
    }
}

div.detail,
div.notes {
    background-color: white;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-radius: 7px;
    box-shadow: 2px 2px 3px var(--shadow-color);
    color: var(--primary-color);
}

div.detail {
    .image {
        display: inline-block;
        width: var(--thumbnail-size);
        height: var(--thumbnail-size);
        margin-right: 1.5rem;
        vertical-align: middle;
        text-align: center;

        img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            border-radius: 7px;
        }
    }

    .info {
        display: inline-block;
        vertical-align: middle;
        width: calc(100% - var(--thumbnail-size) - 2rem);
    }

    .info:first-child {
        width: 100%;
    }


    p {
        margin: 0.25rem 0;
        /* font-size: 0.9rem; */
    }


    .detail-title {
        width: 100%;
        display: flex;
        align-items: center;

        h1 {
            flex: 1;
        }

        .edit-link {
            margin-left: auto;
        }
    }

}

.subtitle {
    color: var(--secondary-color);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--header-font-family);
    font-weight: bold;
}

h1 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

ul {
    margin-left: 1.5rem;

    li {
        margin: 0.5rem 0;
    }
}


.item-pictures {
    display: block;
    gap: 1rem;
    margin-top: 1rem;
    width: 100%;
    overflow-x: scroll;
    white-space: nowrap;

    .item-picture {
        display: inline-block;
        box-shadow: 2px 2px 3px var(--shadow-color);
        border-radius: 7px;
        overflow: hidden;
        text-align: center;
        width: calc(var(--thumbnail-size) + 0.5rem);
        height: calc(var(--thumbnail-size) + 2.5rem);
        background-color: #fafafa;
        margin: 0 0.25rem;
        padding: 0.25rem;

        img {
            width: var(--thumbnail-size);
            height: var(--thumbnail-size);
            object-fit: contain;
            display: block;
        }

        .picture-caption {
            padding: 0.5rem;
            font-size: 0.9rem;
            color: var(--secondary-color);
        }
    }
}

.item-timestamps {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--secondary-color);

    .item-created-at,
    .item-updated-at {
        display: block;
    }
}

/* Fullscreen image viewer */
.fullscreen-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    #fullscreen-image {
        max-width: 90vw;
        max-height: 85vh;
        object-fit: contain;
        border-radius: 0;
    }

    .image-caption {
        color: white;
        padding: 1rem;
        text-align: center;
        max-width: 90vw;
    }

    .close-btn {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: rgba(255, 255, 255, 0.2);
        border: none;
        color: white;
        font-size: 3rem;
        width: 3rem;
        height: 3rem;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        transition: background 0.3s;

        &:hover {
            background: rgba(255, 255, 255, 0.3);
        }
    }

    .nav-btn {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.2);
        border: none;
        color: white;
        font-size: 3rem;
        width: 3rem;
        height: 3rem;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        transition: background 0.3s;

        &:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        &.prev-btn {
            left: 1rem;
        }

        &.next-btn {
            right: 1rem;
        }
    }
}

svg.cupboard {
    rect {
        stroke-width: 1;
        stroke: #888;
    }

    .shelf.door {
        fill: #aaa;
    }

    .door {
        fill: #ccc;
    }

    .shelf.back {
        fill: #bbb;
    }

    .back {
        fill: #ddd;
    }

    .shelf.none {
        fill: #eee;
    }

    .none {
        fill: #f8f8f8;
    }

    .shelf.selected {
        stroke: #873e06;
        fill: #dc650b86;
        stroke-width: 2;
    }
}

ul.game-details {
    list-style: none;
    padding: 0;

    li {
        margin: 0.5rem 0;
    }

    div.key {
        font-weight: bold;
        display: inline-block;
        width: 150px;
    }

    div.key::after {
        content: ":";
        margin-right: 0.5rem;
    }

    div.value {
        display: inline-block;

        ul {
            display: inline-block;
            margin: 0;
            padding: 0;

            li {
                display: inline-block;
            }

            li:not(:last-child):after {
                content: ", ";
            }
        }
    }
}

.detail-title {
    width: 100%;
    display: flex;
    align-items: center;

    h1 {
        flex: 1;
    }

    .edit-link {
        margin-left: auto;
    }
}


.rating {
    color: gray;

    .star.enabled {
        color: gold;
    }

    .veto.enabled {
        color: red;
    }

    .editable {
        cursor: pointer;
    }

    .clear {
        font-size: 0.5rem;
        margin-left: 0.25rem;
    }
}

.game-location {
    svg {
        display: inline-block;
    }

    .location-info {
        display: inline-block;
        vertical-align: top;
        margin-left: 1.5rem;
        margin-top: 1rem;

        span.box-name {
            font-weight: bold;
        }

        .box-image img {
            margin-top: 0.5rem;
            max-width: 400px;
            max-height: 175px;
        }
    }
}

.components {
    .component {
        display: inline-block;
        margin: 0.5rem;
        text-align: center;

        .image {
            height: 160px;
            text-align: center;

            img {
                max-width: 200px;
                height: 100%;
                object-fit: contain;
            }
        }

        .name {
            margin-top: .25rem;
        }
    }
}

div.game-image {
    float: left;
    margin-right: 1.5rem;
    margin-bottom: 1rem;
    width: 400px;

    img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
}

div.section {
    background-color: white;
    margin-left: 1rem;
    margin-right: 1rem;
    margin-bottom: 2rem;
    margin-top: 0;
    border-radius: 7px;
    box-shadow: 2px 2px 3px var(--shadow-color);

    h2 {
        background-color: #eaeff2;
        padding: 1rem;
        margin-bottom: 0;
        border-radius: 7px 7px 0 0;
    }

    ul {
        margin: 0;
    }

    .content {
        padding: 1rem 2rem;
    }

    .game-description {
        overflow: auto;
    }
}

ul.game-list {
    list-style: none;
    padding: 0;
    gap: 1rem;
}