/* Kunsthalle Merklisten – frontend styles */
:root {
    --kkbm__color__heart: #e2001a;
}

@keyframes kkbm-heartbeat {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.2);
    }

    45% {
        transform: scale(1.4);
    }
}

.kkbm-heart {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    line-height: 0;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
    transition: all 0.15s ease;
}

.kkbm-heart:hover {
    background: transparent;
    overflow: visible;
}

.kkbm-heart:hover svg path {
    stroke: black;
}

.kkbm-heart svg {
    width: 28px;
    height: 28px;
    display: block;
    transition:
        transform 0.15s ease,
        fill 0.15s ease;
}

.kkbm-heart svg path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.kkbm-heart:hover svg {
    animation: kkbm-heartbeat 1s infinite;
}

.kkbm-heart.is-active svg path {
    fill: var(--kkbm__color__heart);
    stroke: var(--kkbm__color__heart);
}

.kkbm-heart--hidden {
    display: none !important;
}

/* the mount point written by the theme / shortcode */
.kkbm-heart-mount {
    display: inline-block;
    vertical-align: middle;
    line-height: 0;
}

.kkbm-heart-wrap {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.5em;
}

/*
 * Optional: put this class on a tile container to get the overlay heart in its
 * top right corner (the mount point itself stays where the theme placed it).
 */
.kkbm-has-heart {
    position: relative;
}

.kkbm-has-heart .kkbm-heart-mount {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.15s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
    color: #fff;
}

.kkbm-has-heart:hover .kkbm-heart-mount,
.kkbm-has-heart .kkbm-heart-mount:focus-within,
.kkbm-has-heart .kkbm-heart-mount--active {
    opacity: 1;
}

/* ---------------------------------------------------------- busy spinner */

/*
 * Any element carrying .is-busy (set by busy() in kk-bookmarks.js while a
 * request runs) dims and shows a spinner. Buttons keep their label so the
 * layout does not jump.
 */
@keyframes kkbm-spin {
    to {
        transform: rotate(360deg);
    }
}

.kkbm-heart.is-busy svg,
.is-busy > *:not(.kkbm-spinner) {
    opacity: 0.45;
}

.is-busy {
    position: relative;
    pointer-events: none;
}

.is-busy::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    opacity: 0.85;
    animation: kkbm-spin 0.7s linear infinite;
}

/* inline spinner for the initial list load */
.kkbm-loading::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 0.5em;
    vertical-align: -2px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: kkbm-spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .is-busy::after,
    .kkbm-loading::before {
        animation-duration: 2s;
    }
}

/* ------------------------------------------------------------------ modal */

body.kkbm-modal-open {
    overflow: hidden;
}

.kkbm-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kkbm-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.kkbm-modal__dialog {
    position: relative;
    background: #fff;
    color: #000;
    width: min(600px, calc(100vw - 2rem));
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.kkbm-modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: none;
    border: 0;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.kkbm-modal__title {
    margin: 0 0 2rem;
    font-size: 1.25rem;
}

.kkbm-modal__intro {
    margin: 0 0 1rem;
}

.kkbm-modal__footer {
    margin: 1rem 0 0;
}

.kkbm-modal .kkbm-toggle-visibility {
    width: 100%;
    margin: 0;
}

.kkbm-modal .kkbm-newlist {
    margin-top: 2rem;
}

/* ------------------------------------------------------------ list picker */

.kkbm-listpicker {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    max-height: 40vh;
    overflow-y: auto;
}

.kkbm-listpicker__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid #eee;
}

.kkbm-listpicker__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1 1 auto;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.kkbm-count {
    color: #767676;
    font-style: normal;
}

/*
 * Visibility state. Rendered by visibilityBadge() in JS and by
 * KKBM_Frontend::visibility_badge() in PHP – both emit these classes, so this
 * block styles every instance (list picker, list header, share dialog, list
 * page). Button and span variants look identical.
 */
.kkbm-visibility {
    --visibility-color: #c6c6c6;
    display: inline-block;
    margin: 0;
    border: 1px solid;
    border-radius: 500px;
    padding: 2px 10px 5px 10px;
    letter-spacing: normal;
    font-weight: normal !important;
    font-size: 16px;
    line-height: normal;
    line-height: 1;
    color: color-mix(in srgb, var(--visibility-color) 40%, black);
    border-color: color-mix(in srgb, var(--visibility-color) 70%, black);
    background: var(--visibility-color);
}

button.small.kkbm-visibility {
    padding: 2px 10px 5px 10px;
    margin: 0;
}

.kkbm-visibility--public {
    --visibility-color: #a3c8b1;
}

.kkbm-newlist {
    margin-bottom: 2.5rem;
}

.kkbm-newlist__row {
    display: flex;
    gap: 1rem;
}

.kkbm-newlist label {
    margin: 0;
    padding: 0;
    font-size: 1em;
}

.kkbm-newlist button {
    margin: 0;
    flex-shrink: 0;
}

.kkbm-button {
}

.kkbm-button[disabled] {
    opacity: 0.5;
    cursor: default;
}

.kkbm-link--danger {
    color: #b3000f;
}

/* ------------------------------------------------------------------ forms */

.kkbm-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
}

.kkbm-tab {
    flex: 1 1 0;
}

.kkbm-tab:first-child {
    border-top-right-radius: 0px;
    border-bottom-right-radius: 0px;
}

.kkbm-tab:last-child {
    border-top-left-radius: 0px;
    border-bottom-left-radius: 0px;
}

.kkbm-tab.is-active {
    background: #000;
    color: #fff;
    border-color: #000;
}

.kkbm-form label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.9em;
    padding: 0;
}

.kkbm-form input[type="text"],
.kkbm-form input[type="email"],
.kkbm-form input[type="password"] {
    display: block;
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    margin-top: 0.25rem;
}

.kkbm-form__check {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
}

/* consent sits above the submit button, text may wrap to several lines */
.kkbm-form__privacy {
    align-items: flex-start;
    gap: 0.6rem;
    margin: 1rem 0;
    font-size: 0.85em;
}

.kkbm-form__privacy input {
    flex: 0 0 auto;
    margin: 0.2rem 0 0;
}

.kkbm-form__privacy label {
    margin: 0;
    font-size: 1em;
    cursor: pointer;
}

.kkbm-form__privacy a {
    text-decoration: underline;
}

.kkbm-form__hint {
    font-size: 0.8em;
    color: #767676;
    margin: 0.5rem 0 0;
}

.kkbm-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.kkbm-error {
    background: #fde8ea;
    border-left: 3px solid #b3000f;
    padding: 0.5rem 0.75rem;
    margin: 0 0 1rem;
    font-size: 0.9em;
}

/* ---------------------------------------------------------- share dialog */

.kkbm-back {
    margin-bottom: 2rem;
}

.kkbm-share__head {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 1rem;
}

.kkbm-share__title {
    margin: 0;
    font-size: 1.6em;
    line-height: 1.1;
}

.kkbm-share__count {
    margin: 0.35rem 0 1.5rem;
    color: #767676;
    font-size: 0.9em;
}

.kkbm-share__status {
    margin: 0 0 1.5rem;
    font-size: 0.95em;
}

/* section labels above the link row and the share grid */
.kkbm-share__label {
    margin: 0 0 0.5rem;
    font-size: 0.75em;
}

.kkbm-share__linkrow {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.kkbm-share__linkrow input {
    flex: 1 1 auto;
    min-width: 0;
    font: inherit;
    font-size: 0.6em;
    text-overflow: ellipsis;
}

.kkbm-share__linkrow .kkbm-copy {
    flex-shrink: 0;
    margin: 0;
}

.kkbm-share__targets {
    list-style: none;
    margin: 0 0 1.5rem;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.kkbm-share__targets button {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 0;
}

.kkbm-share__icon {
    font-size: 1.4em;
    line-height: 1;
}

.kkbm-share__copied {
    font-size: 0.85em;
    margin: -1rem 0 1.5rem;
}

/* label wraps the checkbox, so the whole card is clickable */
.kkbm-share__anon {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border: 1px solid #ddd;
    padding: 1rem;
    margin: 0 0 1rem;
    cursor: pointer;
}

.kkbm-share__anon input {
    flex: 0 0 auto;
    margin: 0.2rem 0 0;
    cursor: pointer;
}

.kkbm-share__anon-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    line-height: 1.25;
}

.kkbm-share__anon-text span {
    font-size: 0.85em;
    color: #767676;
}

/* buttons inside the dialog */

.kkbm-button--block {
    display: block;
    width: 100%;
    text-align: center;
}
/* ----------------------------------------------------------------- lists */

.kkbm-list__description,
.kkbm-single__description {
    margin: 1rem 0 0 0;
    font-size: 17px;
}

.kkbm-descform {
    margin-block: 1rem;
}

/* editing the description replaces the stored text and the other actions */
.kkbm-list--editing .kkbm-list__description,
.kkbm-list--editing .kkbm-list__actions {
    display: none;
}

.kkbm-descform__count {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.kkbm-descform__count--low {
    color: #b3000f;
}

.kkbm-descform textarea {
    display: block; /* no inline baseline gap below the field */
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    font: inherit;
    font-size: 17px;
}

.kkbm-descform .kkbm-form__hint {
    margin: 0 0 1rem 0;
}

.kkbm-list {
    margin-bottom: 2.5rem;
    padding: 2.5rem;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.kkbm-list__head {
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.75rem;
    border-bottom: 1px solid #ddd;
    margin-bottom: 2.5rem;
}

.kkbm-list__head__title-row {
    display: flex;
    align-items: end;
    gap: 1rem;
}

.kkbm-list__actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.kkbm-list__actions button.kkbm-link--danger {
    margin-left: auto;
}

.kkbm-list__title {
    margin: 0;
    max-width: 70%;
    line-height: 1;
}

.kkbm-list .kkbm-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.kkbm-grid .kkbm-grid__item {
    list-style: none;
    margin: 0;
}

.kkbm-grid .kkbm-grid__item p {
    margin: 0;
}

.kkbm-grid__item figure {
    position: relative;
    margin: 0;
}

.kkbm-grid__item img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
}

.kkbm-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border: 0;
    width: 2.5rem;
    height: 2.5rem;
    line-height: 2.5rem;
    cursor: pointer;
    margin: 0;
    padding: 0;
}

.kkbm-empty,
.kkbm-loading {
    color: #767676;
    margin: 0;
}
