/**
 * Bates integration for Gwolle Guestbook.
 */

.tb-entry-content .gwolle-gb,
.gwolle-gb {
    --tb-gwolle-black: #000000;
    --tb-gwolle-text: var(--tb-color-text, #222222);
    --tb-gwolle-headline: var(--tb-font-headline, "ThemeWebfontHeadline", sans-serif);
    --tb-gwolle-content: var(--tb-font-content, "ThemeWebfontContent", sans-serif);
    width: 100%;
    max-width: 100%;
    color: var(--tb-gwolle-text);
    font-family: var(--tb-gwolle-content);
}

/* "Neuen Eintrag schreiben" + Submit + Preview: normal Bates button. */
.gwolle-gb .tb-gwolle-button,
.gwolle-gb input.tb-gwolle-button[type="button"],
.gwolle-gb input.tb-gwolle-button[type="submit"] {
    float: none !important;
    width: auto !important;
    min-width: 0;
    min-height: 44px;
    box-sizing: border-box;
    margin: 0;
    padding: 0.65rem 1.15rem;
    color: #ffffff !important;
    background: var(--tb-color-link, #000000);
    border: 2px solid var(--tb-color-link, #000000);
    border-radius: 20px;
    box-shadow: none;
    font-family: var(--tb-gwolle-headline) !important;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    appearance: none;
}

.gwolle-gb .tb-gwolle-button:hover,
.gwolle-gb .tb-gwolle-button:focus,
.gwolle-gb .tb-gwolle-button:focus-visible,
.gwolle-gb input.tb-gwolle-button[type="button"]:hover,
.gwolle-gb input.tb-gwolle-button[type="button"]:focus,
.gwolle-gb input.tb-gwolle-button[type="submit"]:hover,
.gwolle-gb input.tb-gwolle-button[type="submit"]:focus {
    color: var(--tb-color-link, #000000) !important;
    background: #ffffff;
    border-color: var(--tb-color-link, #000000);
    box-shadow: none;
    outline: none;
}

.gwolle-gb .gwolle-gb-write-button {
    margin: 1rem 0 1.25rem;
    overflow: visible;
    text-align: center;
}

/* The total number of entries is also removed by PHP. Keep this as a fallback. */
.gwolle-gb #gwolle-gb-total,
.gwolle-gb .gwolle-gb-total {
    display: none !important;
}

/* Entry layout. */
body .gwolle-gb .gb-entry {
    padding: 0 0 1.4rem;
    margin: 0 0 1.4rem;
    border: 0 !important;
}

body .gwolle-gb .gb-entry .gb-author-info {
    position: relative;
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 0.8rem;
    padding: 0.58rem 3rem 0.58rem 0.8rem;
    color: #ffffff;
    background: var(--tb-gwolle-black);
    font-family: var(--tb-gwolle-headline);
    font-size: 0 !important; /* hide Gwolle's original "from"/date text nodes */
    line-height: 1.3;
}

body .gwolle-gb .gb-entry .gb-author-info .tb-gwolle-entry-heading {
    display: block;
    color: #ffffff;
    font-family: var(--tb-gwolle-headline) !important;
    font-size: 1.32rem !important;
    font-weight: 400;
    line-height: 1.3;
}

/* Original author/date elements stay in the DOM for plugin compatibility. */
body .gwolle-gb .gb-entry .gb-author-info > .gb-author-avatar,
body .gwolle-gb .gb-entry .gb-author-info > .gb-author-name,
body .gwolle-gb .gb-entry .gb-author-info > .gb-author-origin,
body .gwolle-gb .gb-entry .gb-author-info > .gb-datetime,
body .gwolle-gb .gb-entry .gb-author-info > br {
    display: none !important;
}

body .gwolle-gb .gb-entry .gb-entry-content {
    padding: 0;
    color: var(--tb-gwolle-text);
    font-family: var(--tb-gwolle-content);
}

/* Gwolle adds separators to the first/last/AJAX entries as well. The black
 * entry heading already provides the visual separation, so suppress all of
 * those plugin borders consistently. */
body .gwolle-gb .gb-entry,
body .gwolle-gb .gb-entry.gwolle-gb-first,
body .gwolle-gb .gb-entry.gb-entry-count_0 {
    border: 0 !important;
}

body .gwolle-gb .gb-entry .gb-entry-content {
    line-height: 1.5;
}

/* Keep paragraph breaks visible, but more compact than Gwolle's default
 * double line break. PHP inserts this marker only for 2+ entered line breaks. */
body .gwolle-gb .gb-entry .gb-entry-content .tb-gwolle-paragraph-gap {
    display: block;
    height: 0.55em;
    margin: 0;
    padding: 0;
}

/* Keep the three-dot entry controls visible on the black heading. */
body .gwolle-gb .gb-entry button.gb-metabox-handle {
    top: 0.12rem;
    right: 0.12rem;
    z-index: 3;
    color: #ffffff;
    background: transparent;
}

/* Form: match the existing Bates/CF7 field language. */
.gwolle-gb form.gwolle-gb-write {
    width: 100%;
    max-width: 100%;
    margin-top: 1.25rem;
    overflow: visible;
    color: var(--tb-gwolle-text);
    font-family: var(--tb-gwolle-content);
    text-align: left;
}

.gwolle-gb form.gwolle-gb-write > h3 {
    margin: 0 0 1.35rem;
    padding-right: 2.5rem;
    color: var(--tb-color-headline, #111111);
    font-family: var(--tb-gwolle-headline) !important;
    font-weight: 400;
}

.gwolle-gb form.gwolle-gb-write .label,
.gwolle-gb form.gwolle-gb-write .input,
.gwolle-gb form.gwolle-gb-write.gwolle-gb-float .label,
.gwolle-gb form.gwolle-gb-write.gwolle-gb-float .input {
    float: none !important;
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
}

.gwolle-gb form.gwolle-gb-write .label {
    margin: 0 0 0.28rem;
}

.gwolle-gb form.gwolle-gb-write .label label {
    display: block;
    margin: 0;
    color: #000000;
    font-family: var(--tb-gwolle-content) !important;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

.gwolle-gb form.gwolle-gb-write > div:not(.gwolle-gb-messages-bottom-container):not(.gwolle_gb_notice):not(.gwolle-gb-notice) {
    margin-bottom: 1.15rem;
}

.gwolle-gb form.gwolle-gb-write .clearBoth {
    clear: both;
    height: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    line-height: 0;
}

.gwolle-gb form.gwolle-gb-write div.input input[type="text"],
.gwolle-gb form.gwolle-gb-write div.input input[type="email"],
.gwolle-gb form.gwolle-gb-write div.input input[type="url"],
.gwolle-gb form.gwolle-gb-write div.input input[type="tel"],
.gwolle-gb form.gwolle-gb-write div.input input[type="number"],
.gwolle-gb form.gwolle-gb-write div.input select {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.12rem 0 0.22rem;
    color: var(--tb-gwolle-text);
    background: #ffffff;
    border: 0;
    border-bottom: 1px solid var(--tb-gwolle-text);
    border-radius: 0;
    box-shadow: none;
    font-family: var(--tb-gwolle-content);
    font-size: 1.06rem;
    line-height: 1.35;
    outline: none;
}

.gwolle-gb form.gwolle-gb-write div.input textarea {
    width: 100% !important;
    max-width: 100%;
    min-height: 170px;
    height: auto;
    box-sizing: border-box;
    margin: 0;
    padding: 0.55rem 0.65rem;
    color: var(--tb-gwolle-text);
    background: #ffffff;
    border: 1px solid var(--tb-gwolle-text);
    border-radius: 0;
    box-shadow: none;
    font-family: var(--tb-gwolle-content);
    font-size: 1.06rem;
    line-height: 1.4;
    outline: none;
    resize: vertical;
}

.gwolle-gb form.gwolle-gb-write div.input input:focus,
.gwolle-gb form.gwolle-gb-write div.input select:focus {
    border-bottom-color: var(--tb-gwolle-black);
    box-shadow: none;
    outline: none;
}

.gwolle-gb form.gwolle-gb-write div.input textarea:focus {
    border-color: var(--tb-gwolle-black);
    box-shadow: none;
    outline: none;
}

/* MarkItUp: only Bold, Italic and Emoji are offered. */
.gwolle-gb form.gwolle-gb-write .markItUpHeader .markItUpButton3,
.gwolle-gb form.gwolle-gb-write .markItUpHeader .markItUpButton4,
.gwolle-gb form.gwolle-gb-write .markItUpHeader .markItUpButton5,
.gwolle-gb form.gwolle-gb-write .markItUpHeader .markItUpButton6,
.gwolle-gb form.gwolle-gb-write .markItUpHeader .markItUpButton7,
.gwolle-gb form.gwolle-gb-write .markItUpHeader .markItUpButton8 {
    display: none !important;
}

.gwolle-gb form.gwolle-gb-write .markItUp,
.gwolle-gb form.gwolle-gb-write .markItUpContainer,
.gwolle-gb form.gwolle-gb-write .markItUpEditor {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.gwolle-gb form.gwolle-gb-write .markItUpHeader {
    box-sizing: border-box;
    min-height: 34px;
    padding: 4px 5px;
    background: #f2f2f2;
    border: 1px solid var(--tb-gwolle-text);
    border-bottom: 0;
}

.gwolle-gb form.gwolle-gb-write .markItUpEditor {
    border: 1px solid var(--tb-gwolle-text) !important;
    border-radius: 0 !important;
}

.gwolle-gb form.gwolle-gb-write .gwolle-gb-submit .input,
.gwolle-gb form.gwolle-gb-write .gwolle_gb_submit .input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.gwolle-gb form.gwolle-gb-write .gwolle_gb_notice,
.gwolle-gb form.gwolle-gb-write .gwolle-gb-notice {
    box-sizing: border-box;
    margin-top: 0.9rem;
    padding: 10px;
    color: #b70000;
    border: 1px solid #b70000;
    font-size: 0.88em;
    line-height: 1.45;
}

/* Close form button. Gwolle ships the same high-specificity selector, so
 * use !important here to guarantee the Bates version wins regardless of CSS
 * enqueue order. */
html body div.gwolle-gb form.gwolle-gb-write button.gb-notice-dismiss {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #ffffff !important;
    background: #b70000 !important;
    border: 2px solid #b70000 !important;
    border-radius: 50% !important;
    box-shadow: none !important;
    font-family: Arial, sans-serif !important;
    font-size: 26px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    text-align: center !important;
    cursor: pointer !important;
}

html body div.gwolle-gb form.gwolle-gb-write button.gb-notice-dismiss:hover,
html body div.gwolle-gb form.gwolle-gb-write button.gb-notice-dismiss:focus,
html body div.gwolle-gb form.gwolle-gb-write button.gb-notice-dismiss:focus-visible {
    color: #ffffff !important;
    background: #8f0000 !important;
    border-color: #8f0000 !important;
    box-shadow: none !important;
    outline: none !important;
}


/* Team reply: neutral, flat background without Gwolle's admin gradient. */
body .gwolle-gb .gb-entry .gb-entry-admin_reply,
body .gwolle-gb .gb-entry .gb-entry-admin-reply,
body .gwolle-gb .gb-entry .gb-entry-admin_reply.admin-entry,
body .gwolle-gb .gb-entry .gb-entry-admin-reply.admin-entry {
    box-sizing: border-box;
    margin: 1rem 0 0;
    padding: 0.75rem 0.9rem;
    color: var(--tb-gwolle-text) !important;
    background-color: #e1e1e1 !important;
    background-image: none !important;
    border: 0 !important;
}

body .gwolle-gb .gb-entry .gb-entry-admin_reply a,
body .gwolle-gb .gb-entry .gb-entry-admin-reply a {
    color: inherit;
}

body .gwolle-gb .gb-entry .gb-entry-admin_reply .gb-admin-reply-uid,
body .gwolle-gb .gb-entry .gb-entry-admin-reply .gb-admin-reply-uid {
    margin-bottom: 0.35rem;
    font-weight: 700;
}

/* Team reply refinement: headline uses the Bates heading font, while the
 * reply itself stays in the normal content font and is set in italics. */
body .gwolle-gb .gb-entry .gb-entry-admin_reply,
body .gwolle-gb .gb-entry .gb-entry-admin-reply,
body .gwolle-gb .gb-entry .gb-entry-admin_reply.admin-entry,
body .gwolle-gb .gb-entry .gb-entry-admin-reply.admin-entry {
    margin: 1rem 0 0 2rem !important;
    font-family: var(--tb-gwolle-content) !important;
    font-style: italic;
}

body .gwolle-gb .gb-entry .gb-entry-admin_reply .gb-admin-reply-uid,
body .gwolle-gb .gb-entry .gb-entry-admin-reply .gb-admin-reply-uid,
body .gwolle-gb .gb-entry .gb-entry-admin_reply .gb-admin-reply-uid em,
body .gwolle-gb .gb-entry .gb-entry-admin-reply .gb-admin-reply-uid em {
    font-family: var(--tb-gwolle-headline) !important;
    font-size: 1.32rem;
    font-style: normal !important;
    font-weight: 400;
    line-height: 1.25;
}
