/*
 * Gästebuch – Darstellung im Frontend
 *
 * Schrift und Flächen übernehmen die Farben des Themes; die Akzentfarbe
 * kommt aus --accent (falls das Theme sie setzt).
 */

.gb {
    --gb-line: rgba(128, 128, 128, .28);
    --gb-soft: rgba(128, 128, 128, .08);
    --gb-accent: var(--accent, var(--rs-accent, #2563eb));
    --gb-ok: #16a34a;
    --gb-err: #dc2626;

    color: inherit;
    font-size: 15px;
    line-height: 1.6;
}

.gb * { box-sizing: border-box; }

.gb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin: 0 0 8px;
}

.gb-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.4em;
    color: inherit;
}

.gb-total {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .9em;
    font-weight: 600;
    opacity: .75;
}

.gb-intro { margin: 0 0 16px; opacity: .85; }

.gb-note {
    margin: 0 0 16px;
    padding: 11px 14px;
    border: 1px solid var(--gb-line);
    border-left: 4px solid var(--gb-accent);
    border-radius: 10px;
    background: var(--gb-soft);
}

.gb-note-ok { border-left-color: var(--gb-ok); }
.gb-note-error { border-left-color: var(--gb-err); }

/* ------------------------------------------------------------ Schaltflächen */

.gb .gb-btn,
.gb a.gb-btn,
.gb summary.gb-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    border: 0;
    border-radius: 10px;
    background: var(--gb-accent) !important;
    color: #fff !important;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none !important;
    cursor: pointer;
    list-style: none;
}

.gb .gb-btn:hover { filter: brightness(1.08); }
.gb .gb-btn:focus-visible { outline: 3px solid rgba(128, 128, 128, .5); outline-offset: 2px; }
.gb summary.gb-btn::-webkit-details-marker { display: none; }

/* ------------------------------------------------------------ Formular */

.gb-toggle { margin: 0 0 22px; }
.gb-toggle[open] > summary { margin-bottom: 16px; }

.gb-form {
    margin: 0 0 24px;
    padding: 18px 18px 6px;
    border: 1px solid var(--gb-line);
    border-radius: 14px;
    background: var(--gb-soft);
}

.gb-member { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }

.gb-row { display: flex; flex-wrap: wrap; gap: 0 14px; }
.gb-row:empty { display: none; }
.gb-row > .gb-field { flex: 1 1 220px; min-width: 0; }

.gb-field { margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }

.gb-field > label,
.gb-field legend {
    display: block;
    margin: 0 0 5px;
    padding: 0;
    font-size: .92em;
    font-weight: 600;
}

.gb-req { color: var(--gb-err); }

.gb-field input[type="text"],
.gb-field input[type="email"],
.gb-field input[type="url"],
.gb-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gb-line);
    border-radius: 9px;
    background: rgba(128, 128, 128, .06);
    color: inherit;
    font: inherit;
    font-size: 15px;
}

.gb-field textarea { min-height: 120px; resize: vertical; }

.gb-field input:focus,
.gb-field textarea:focus {
    outline: none;
    border-color: var(--gb-accent);
    box-shadow: 0 0 0 3px rgba(128, 128, 128, .18);
}

.gb-field-captcha input { max-width: 120px; }

.gb-hint,
.gb-counter {
    display: block;
    margin-top: 4px;
    font-size: .82em;
    opacity: .7;
}

.gb-counter { text-align: right; }
.gb-counter.is-near { color: var(--gb-err); opacity: 1; }

/* Sterne-Auswahl: von rechts nach links, damit :hover die Vorgänger füllt */
.gb-rate {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 2px;
}

.gb-rate input { position: absolute; opacity: 0; width: 1px; height: 1px; }

.gb-rate label {
    font-size: 28px;
    line-height: 1;
    color: rgba(128, 128, 128, .45);
    cursor: pointer;
    transition: color .15s, transform .15s;
}

.gb-rate label:hover,
.gb-rate label:hover ~ label,
.gb-rate input:checked ~ label { color: #f5b301; }

.gb-rate input:focus-visible + label { outline: 2px solid var(--gb-accent); border-radius: 4px; }

.gb-turnstile { min-height: 70px; }

.gb-trap {
    position: absolute !important;
    left: -9999px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.gb-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin: 4px 0 14px;
}

.gb-privacy { margin: 0; font-size: .85em; opacity: .7; flex: 1 1 240px; }

/* ------------------------------------------------------------ Editor */

.gb-editor {
    --gbe-line: rgba(128, 128, 128, .32);
    --gbe-accent: var(--gb-accent, var(--accent, var(--nv-accent, #2563eb)));
    border: 1px solid var(--gbe-line);
    border-radius: 10px;
    background: rgba(128, 128, 128, .06);
}

.gb-editor[hidden] { display: none; }

.gb-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    padding: 6px;
    border-bottom: 1px solid var(--gbe-line);
}

.gb-editor .gb-tool {
    display: inline-grid;
    place-items: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.gb-editor .gb-tool:hover { background: rgba(128, 128, 128, .16); }
.gb-editor .gb-tool.is-on { background: var(--gbe-accent); color: #fff; }
.gb-editor .gb-tool:focus-visible { outline: 2px solid var(--gbe-accent); outline-offset: 1px; }
.gb-tool-emoji { font-size: 18px !important; }
.gb-tool-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--gbe-line); }

.gb-tool-color { position: relative; }
.gb-color-a { font-weight: 800; }
.gb-color-bar { position: absolute; left: 8px; right: 8px; bottom: 5px; height: 3px; border-radius: 2px; background: #dc2626; }

.gb-pop-wrap { position: relative; display: inline-block; }

.gb-pop {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    padding: 10px;
    border: 1px solid var(--gbe-line);
    border-radius: 12px;
    background: var(--rs-surface, var(--surface, var(--nv-surface, #fff)));
    color: var(--rs-text, var(--text, var(--nv-text, #111)));
    box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
}

.gb-pop[hidden] { display: none; }

.gb-pop-color { display: grid; grid-template-columns: repeat(6, 28px); gap: 6px; }

.gb-editor .gb-swatch {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, .7);
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .2);
    cursor: pointer;
}

.gb-editor .gb-swatch:hover { transform: scale(1.12); }

.gb-swatch-own {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.gb-swatch-own input { width: 44px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }

.gb-pop-emoji { width: min(330px, calc(100vw - 48px)); padding: 6px; }
.gb-emoji-tabs { display: flex; gap: 2px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--gbe-line); }

.gb-editor .gb-emoji-tabs button {
    flex: 1 1 0;
    height: 32px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    font-size: 17px;
    cursor: pointer;
}

.gb-editor .gb-emoji-tabs button.is-active { background: rgba(128, 128, 128, .2); }
.gb-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; max-height: 210px; overflow-y: auto; }

.gb-editor .gb-emoji {
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
}

.gb-editor .gb-emoji:hover { background: rgba(128, 128, 128, .18); }

.gb-area {
    min-height: 130px;
    max-height: 420px;
    overflow-y: auto;
    padding: 11px 13px;
    outline: none;
    font-size: 15px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    cursor: text;
}

.gb-editor .gb-area,
.gb-editor .gb-area:focus { outline: none !important; border: 0 !important; box-shadow: none; background: transparent; }

.gb-area.is-empty::before { content: attr(data-placeholder); opacity: .5; pointer-events: none; }
.gb-editor .gb-area.is-error { box-shadow: inset 0 0 0 2px #dc2626; border-radius: 0 0 9px 9px; }
.gb-editor:focus-within { border-color: var(--gbe-accent); box-shadow: 0 0 0 3px rgba(128, 128, 128, .18); }

.gb-modhint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0 0 14px !important;
    padding: 10px 13px;
    border-radius: 10px;
    border: 1px dashed var(--gb-line);
    font-size: .9em;
}

.gb-modhint .gb-i { flex: 0 0 auto; margin-top: 3px; color: var(--gb-accent); }

/* ------------------------------------------------------------ Einträge */

.gb-list { display: flex; flex-direction: column; gap: 14px; }

.gb-entry {
    display: flex;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--gb-line);
    border-radius: 14px;
    background: var(--gb-soft);
}

.gb-avatar {
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: hsl(var(--gb-hue, 210), 60%, 46%);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    letter-spacing: .02em;
}

.gb-body { flex: 1 1 auto; min-width: 0; }

.gb-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    margin-bottom: 6px;
}

.gb-name { font-size: 1.05em; }

.gb-city,
.gb-date,
.gb-web {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .85em;
    opacity: .75;
}

.gb-web { margin-top: 8px; color: inherit !important; }
.gb-web:hover { opacity: 1; }

.gb-stars { font-size: 15px; letter-spacing: 1px; }
.gb-stars b { color: #f5b301; font-weight: 400; }
.gb-stars i { color: rgba(128, 128, 128, .4); font-style: normal; }

.gb-text { overflow-wrap: anywhere; }

.gb-reply {
    margin-top: 12px;
    padding: 11px 14px;
    border-left: 3px solid var(--gb-accent);
    border-radius: 0 10px 10px 0;
    background: rgba(128, 128, 128, .10);
}

.gb-reply-head {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 3px;
    color: var(--gb-accent);
}

.gb-reply-text { overflow-wrap: anywhere; }

.gb-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 18px;
    border: 1px dashed var(--gb-line);
    border-radius: 12px;
    opacity: .85;
}

.gb-pages {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
}

.gb-pages > :last-child { justify-self: end; }

.gb-page-btn {
    padding: 8px 14px;
    border: 1px solid var(--gb-line);
    border-radius: 999px;
    color: inherit !important;
    text-decoration: none !important;
    font-weight: 600;
    font-size: .92em;
}

.gb-page-btn:hover { border-color: var(--gb-accent); }
.gb-page-of { font-size: .88em; opacity: .75; }

/* ------------------------------------------------------------ Box */

.gb-box .gb-entry { padding: 12px; gap: 10px; margin-bottom: 10px; }
.gb-box .gb-avatar { width: 34px; height: 34px; font-size: 13px; }
.gb-box .gb-meta { gap: 2px 10px; margin-bottom: 3px; }
.gb-box .gb-text { font-size: .92em; }
.gb-box .gb-more { display: inline-block; margin-top: 2px; font-weight: 700; }

/* Schmale Bildschirme: Farb- und Emojifeld unter der ganzen Leiste */
@media (max-width: 600px) {
    .gb-editor { position: relative; }
    .gb-pop-wrap { position: static; }
    .gb-pop { left: 6px; right: 6px; top: auto; margin-top: 6px; }
    .gb-pop-emoji { width: auto; }
    .gb-pop-color { grid-template-columns: repeat(6, 1fr); justify-items: center; }
    .gb-editor .gb-tool { min-width: 32px; padding: 0 6px; }
    .gb-tool-sep { margin: 0 2px; }
}

@media (max-width: 560px) {
    .gb-entry { padding: 13px; gap: 11px; }
    .gb-avatar { width: 38px; height: 38px; font-size: 14px; }
    .gb-form { padding: 14px 14px 4px; }
    .gb-pages { grid-template-columns: 1fr 1fr; }
    .gb-page-of { grid-column: 1 / -1; grid-row: 2; text-align: center; }
}
