/*
 * JooDB integration for Minions des Grauens.
 * Selectors cover the default JooDB 4.x/5.x catalogue, article and form views.
 */

.joodb {
    --joodb-border: #ded8cc;
    --joodb-soft: #f1ede5;
    color: var(--mdg-ink, #1d1930);
}

.joodb::after,
.joodb .block::after {
    display: table;
    clear: both;
    content: "";
}

.joodb .introtext {
    margin-bottom: 1.4rem;
    color: var(--mdg-muted, #686273);
    font-size: 1.05rem;
}

#joodbForm fieldset {
    position: relative;
    display: block;
    margin: 1rem 0;
    padding: 1rem;
    overflow: visible;
    background: var(--joodb-soft);
    border: 1px solid var(--joodb-border);
    border-radius: 0.85rem;
}

#joodbForm legend {
    width: auto;
    margin: 0;
    padding: 0.25rem 0.65rem;
    color: #fff;
    background: var(--mdg-purple, #2c2247);
    border-radius: 0.45rem;
    font-weight: 800;
}

#joodbForm label {
    margin: 0.3rem 0;
}

#joodbForm input.required,
#joodbForm textarea.required,
#joodbForm select.required {
    background-color: #fff9d9;
}

#joodbForm label.invalid {
    color: #9e1834;
}

#joodbForm input.invalid,
#joodbForm textarea.invalid,
#joodbForm select.invalid {
    border-color: #bc2646;
    box-shadow: 0 0 0 0.18rem rgba(188, 38, 70, 0.16);
}

#joodbForm textarea {
    box-sizing: border-box;
    width: 100%;
}

#joodbForm .control-group {
    display: block;
    float: none;
    width: 100%;
    margin-bottom: 0.8rem;
}

#joodbForm .input-mini {
    width: 5rem;
}

#joodbForm .input-small {
    width: 7rem;
}

#joodbForm .input-medium {
    width: 10rem;
}

#joodbForm .input-large {
    width: 14rem;
}

#joodbForm .input-xlarge {
    width: 18rem;
}

#joodbForm .input-xxlarge {
    width: 100%;
}

#joodbForm .text-large {
    height: auto;
    font-size: 1.35rem;
    line-height: 1.45;
}

#joodbForm .searchbox,
.joodb .searchbox {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.55rem;
    clear: both;
    margin: 0 0 1.4rem;
    padding: 1rem;
    background: var(--joodb-soft);
    border: 1px solid var(--joodb-border);
    border-radius: 0.85rem;
}

#joodbForm .searchbox input,
#joodbForm .searchbox select,
.joodb .searchbox input,
.joodb .searchbox select {
    flex: 1 1 11rem;
    width: auto;
    min-width: 0;
    margin: 0;
}

#joodbForm .searchbox button,
.joodb .searchbox button {
    flex: 0 0 auto;
    margin: 0;
}

.joodb dl {
    display: grid;
    grid-template-columns: minmax(8rem, 0.34fr) minmax(0, 1fr);
    margin: 0.5rem 0;
    padding: 0;
    line-height: 1.45;
}

.joodb dt,
.joodb dd {
    display: block;
    width: auto;
    min-height: 1.4rem;
    margin: 0;
    padding: 0.5rem;
    border-bottom: 1px solid var(--joodb-border);
}

.joodb dt {
    color: #514a5c;
    font-weight: 800;
}

.joodb .table {
    display: table;
}

.joodb .tr {
    display: table-row;
}

.joodb .td {
    display: table-cell;
    padding: 0.65rem;
    vertical-align: top;
}

.joodb table {
    width: 100%;
    background: #fff;
    border: 1px solid var(--joodb-border);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 0.8rem;
    text-align: left;
}

.joodb table th,
.joodb .header {
    padding: 0.65rem 0.75rem;
    color: #fff;
    background: var(--mdg-purple, #2c2247);
    border-bottom: 1px solid #1a142c;
    font-size: 1rem;
    font-weight: 800;
    text-align: left;
}

.joodb table th:first-child {
    border-top-left-radius: 0.7rem;
}

.joodb table th:last-child {
    border-top-right-radius: 0.7rem;
}

.joodb table th a,
.joodb .header a {
    color: #fff;
    text-decoration: none;
}

.joodb table th a:hover,
.joodb .header a:hover {
    color: var(--mdg-accent, #f5c451);
}

.joodb table td {
    padding: 0.65rem 0.75rem;
    background: #fff;
    border-bottom: 1px solid var(--joodb-border);
}

.joodb table tr:nth-child(even) > td,
.joodb .even {
    background: #f7f4ee;
}

.joodb table tr:last-child td {
    border-bottom: 0;
}

.joodb .alphabox {
    display: block;
    clear: both;
    margin: 1rem 0;
}

.joodb .alphabox ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.joodb .alphabox li {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
}

.joodb .alphabox li a,
.joodb .alphabox li span {
    display: grid;
    min-width: 2.35rem;
    min-height: 2.35rem;
    place-items: center;
    padding: 0.25rem 0.5rem;
    color: var(--mdg-ink, #1d1930);
    background: #fff;
    border: 1px solid var(--joodb-border);
    border-radius: 0.5rem;
    text-decoration: none;
}

.joodb .alphabox li a:hover {
    background: var(--joodb-soft);
}

.joodb .alphabox li.active a,
.joodb .alphabox li.active span,
.joodb .alphabox li.active {
    color: var(--mdg-ink, #1d1930);
    background: var(--mdg-accent, #f5c451);
    border-radius: 0.5rem;
    font-weight: 900;
}

.joodb small,
.joodb .small {
    color: var(--mdg-muted, #686273);
}

.joodb .block {
    display: block;
    clear: both;
    overflow: hidden;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--joodb-border);
    border-radius: 0.85rem;
    box-shadow: 0 0.45rem 1rem rgba(29, 25, 48, 0.06);
}

.joodb .title {
    margin: 0 0 0.4rem;
    padding: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
    line-height: 1.2;
}

.joodb .nodata {
    display: block;
    margin: 1rem 0;
    padding: 1rem;
    color: #84162d;
    background: #fff0f3;
    border: 1px solid #f0bec8;
    border-radius: 0.75rem;
    font-size: 1.05rem;
    font-weight: 800;
}

.joodb .prevbutton,
.joodb .nextbutton,
.joodb .readonbutton,
.joodb .backbutton {
    display: inline-flex;
    margin: 0.5rem 0;
}

.joodb .nextbutton,
.joodb .readonbutton {
    float: right;
}

.joodb .item-separator {
    height: 1px;
    margin: 1.2rem 0;
    background: var(--joodb-border);
    border: 0;
}

.joodb .database-thumb,
.joodb .database-image {
    height: auto;
    padding: 0.25rem;
    background: #fff;
    border: 1px solid var(--joodb-border);
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1.1rem rgba(29, 25, 48, 0.1);
}

/* Optional classes for the supplied board-game catalogue example. */
.joodb .mdg-catalog-tools {
    margin-bottom: 1.2rem;
}

.joodb .mdg-game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: 1rem;
}

.joodb .mdg-game-card {
    position: relative;
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--joodb-border);
    border-radius: 1rem;
    box-shadow: 0 0.65rem 1.5rem rgba(29, 25, 48, 0.08);
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.joodb .mdg-game-card:hover {
    box-shadow: 0 1rem 2rem rgba(29, 25, 48, 0.14);
    transform: translateY(-0.18rem);
}

.joodb .mdg-game-card__image {
    display: grid;
    min-height: 10rem;
    place-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, #e9e1f6, #dcf3ef);
}

.joodb .mdg-game-card__image img {
    width: 100%;
    height: 12rem;
    object-fit: contain;
}

.joodb .mdg-game-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 1rem;
}

.joodb .mdg-game-card__title {
    margin: 0 0 0.55rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.3rem;
    line-height: 1.18;
}

.joodb .mdg-game-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.8rem;
    padding: 0;
    list-style: none;
}

.joodb .mdg-game-card__meta li {
    padding: 0.22rem 0.5rem;
    color: #493c5f;
    background: #eee8f7;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 750;
}

.joodb .mdg-game-card__summary {
    color: var(--mdg-muted, #686273);
}

.joodb .mdg-game-card__action {
    margin-top: auto;
    padding-top: 0.8rem;
}

.joodb .mdg-catalog-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (max-width: 680px) {
    .joodb dl {
        grid-template-columns: 1fr;
    }

    .joodb dt {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .joodb dd {
        padding-top: 0.15rem;
        margin-bottom: 0.45rem;
    }

    .joodb .table,
    .joodb table {
        display: block;
        max-width: 100%;
        overflow-x: auto;
    }

    #joodbForm .searchbox > *,
    .joodb .searchbox > * {
        flex: 1 1 100%;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .joodb .mdg-game-card {
        transition: none;
    }
}
