/* ── wprbn Survey – Frontend Styles ──────────────────────────────── */

.wprbn-survey {
    max-width: 640px;
    margin-block: clamp(2rem, 5vw, 4rem);
}

.wprbn-survey__title {
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.wprbn-survey__description {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ── Fragen ─────────────────────────────────────────────────────── */

.wprbn-survey__question {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 0.5px solid var(--border);
}

.wprbn-survey__question:last-of-type {
    border-bottom: none;
}

.wprbn-survey__label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.wprbn-survey__required {
    color: var(--color-accent, #e63946);
    margin-left: 0.25rem;
}

/* ── Optionen (Radio + Checkbox) ─────────────────────────────────── */

.wprbn-survey__options {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.wprbn-survey__option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.625rem 0.875rem;
    border: 0.5px solid var(--border);
    border-radius: 2px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.wprbn-survey__option:hover {
    border-color: var(--border-strong);
    background: var(--bg-secondary);
}

.wprbn-survey__option input[type="radio"],
.wprbn-survey__option input[type="checkbox"] {
    display: none;
}

/* Custom dot (radio) */
.wprbn-survey__option-dot {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: 50%;
    background: var(--bg-primary);
    position: relative;
    transition: border-color 0.15s;
}

.wprbn-survey__option-dot::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--text-primary);
    opacity: 0;
    transition: opacity 0.15s;
}

.wprbn-survey__option input[type="radio"]:checked ~ .wprbn-survey__option-dot {
    border-color: var(--text-primary);
}

.wprbn-survey__option input[type="radio"]:checked ~ .wprbn-survey__option-dot::after {
    opacity: 1;
}

.wprbn-survey__option input[type="radio"]:checked ~ * {
    font-weight: 500;
}

/* Custom box (checkbox) */
.wprbn-survey__option-box {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: 2px;
    background: var(--bg-primary);
    position: relative;
    transition: border-color 0.15s, background 0.15s;
}

.wprbn-survey__option-box::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 5px;
    height: 9px;
    border: 1.5px solid var(--bg-primary);
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.15s;
}

.wprbn-survey__option input[type="checkbox"]:checked ~ .wprbn-survey__option-box {
    background: var(--text-primary);
    border-color: var(--text-primary);
}

.wprbn-survey__option input[type="checkbox"]:checked ~ .wprbn-survey__option-box::after {
    opacity: 1;
}

.wprbn-survey__option input[type="checkbox"]:checked ~ * {
    font-weight: 500;
}

/* Selected option highlight */
.wprbn-survey__option:has(input:checked) {
    border-color: var(--border-strong);
    background: var(--bg-secondary);
}

/* ── Freitext ────────────────────────────────────────────────────── */

.wprbn-survey__textarea {
    width: 100%;
    padding: 0.75rem;
    border: 0.5px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.wprbn-survey__textarea:focus {
    outline: none;
    border-color: var(--border-strong);
}

/* ── Bewertung ───────────────────────────────────────────────────── */

.wprbn-survey__rating {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.wprbn-survey__rating-item {
    cursor: pointer;
    user-select: none;
}

.wprbn-survey__rating-item input[type="radio"] {
    display: none;
}

.wprbn-survey__rating-value {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0.5px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
}

.wprbn-survey__rating-item:hover .wprbn-survey__rating-value,
.wprbn-survey__rating-item.is-hover .wprbn-survey__rating-value {
    border-color: var(--border-strong);
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.wprbn-survey__rating-item.is-selected .wprbn-survey__rating-value {
    background: var(--text-primary);
    border-color: var(--text-primary);
    color: var(--bg-primary);
}

/* ── Footer + Submit ─────────────────────────────────────────────── */

.wprbn-survey__footer {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.wprbn-survey__error {
    display: none;
    padding: 0.75rem 1rem;
    background: color-mix(in srgb, #e63946 10%, transparent);
    border-left: 3px solid #e63946;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.wprbn-survey__error.is-visible {
    display: block;
}

.wprbn-survey__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2.5rem;
    background: var(--cta-bg);
    color: var(--cta-text);
    border: none;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s;
    align-self: flex-start;
}

.wprbn-survey__submit:hover {
    opacity: 0.85;
}

.wprbn-survey__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Erfolgs-Meldung ─────────────────────────────────────────────── */

.wprbn-survey__voted,
.wprbn-survey__success {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: clamp(2rem, 5vw, 3.5rem);
    background: var(--bg-secondary);
    border: 0.5px solid var(--border);
    text-align: center;
    color: var(--text-primary);
}

.wprbn-survey__voted[hidden],
.wprbn-survey__success[hidden] {
    display: none;
}

.wprbn-survey__voted-icon,
.wprbn-survey__success-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--text-primary);
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.wprbn-survey__voted p,
.wprbn-survey__success-msg {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0;
}

/* ── Shortcode / Seiten-Hinweis ──────────────────────────────────── */

.wprbn-survey-notice {
    color: var(--text-muted);
    font-style: italic;
}

/* ── Admin Dashboard – Survey-Tab Styles ─────────────────────────── */

.wprbn-survey-toolbar {
    margin-bottom: 1.5rem;
}

.wprbn-survey-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--wprbn-surface, #2a2a3e);
    color: var(--wprbn-text, #c8c8d8);
    border: 1px solid rgba(255 255 255 / 0.1);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.wprbn-survey-btn:hover {
    background: rgba(255 255 255 / 0.08);
    color: #fff;
}

.wprbn-survey-btn--primary {
    background: var(--wprbn-accent, #f5a623);
    color: #1e1e2e;
    border-color: transparent;
    font-weight: 600;
}

.wprbn-survey-btn--primary:hover {
    background: #f5b840;
    color: #1e1e2e;
}

.wprbn-survey-btn--secondary {
    background: rgba(255 255 255 / 0.06);
    border-style: dashed;
}

.wprbn-survey-btn--danger {
    color: #ff6b6b;
}

.wprbn-survey-btn--danger:hover {
    background: rgba(255 107 107 / 0.15);
    color: #ff6b6b;
}

.wprbn-survey-btn--sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
}

/* List */
.wprbn-survey-empty {
    padding: 2rem;
    text-align: center;
    color: rgba(255 255 255 / 0.35);
    border: 1px dashed rgba(255 255 255 / 0.1);
}

.wprbn-survey-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wprbn-survey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(255 255 255 / 0.04);
    border: 1px solid rgba(255 255 255 / 0.08);
    flex-wrap: wrap;
}

.wprbn-survey-item__info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex-wrap: wrap;
    min-width: 0;
}

.wprbn-survey-item__status {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 2px;
    flex-shrink: 0;
}

.wprbn-survey-item__status.is-active {
    background: rgba(80 200 120 / 0.15);
    color: #50c878;
}

.wprbn-survey-item__status.is-inactive {
    background: rgba(255 255 255 / 0.06);
    color: rgba(255 255 255 / 0.35);
}

.wprbn-survey-item__title {
    color: #e8e8e8;
    font-size: 0.9rem;
}

.wprbn-survey-item__meta {
    font-size: 0.75rem;
    color: rgba(255 255 255 / 0.3);
}

.wprbn-survey-item__actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Form */
.wprbn-survey-back {
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.wprbn-survey-back a {
    color: rgba(255 255 255 / 0.5);
    text-decoration: none;
}

.wprbn-survey-back a:hover {
    color: #fff;
}

/* Question cards */
.wprbn-survey-question {
    background: rgba(255 255 255 / 0.03);
    border: 1px solid rgba(255 255 255 / 0.08);
    margin-bottom: 1rem;
    overflow: hidden;
}

.wprbn-sq__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255 255 255 / 0.04);
    border-bottom: 1px solid rgba(255 255 255 / 0.06);
}

.wprbn-sq__type {
    flex: 1;
    background: rgba(255 255 255 / 0.06);
    border: 1px solid rgba(255 255 255 / 0.1);
    color: #c8c8d8;
    padding: 0.4rem 0.5rem;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
}

.wprbn-sq__delete {
    background: none;
    border: none;
    color: rgba(255 255 255 / 0.3);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.15s;
}

.wprbn-sq__delete:hover {
    color: #ff6b6b;
}

.wprbn-sq__body {
    padding: 1rem;
}

.wprbn-sq__rating-wrap {
    align-items: center;
    gap: 0.75rem;
}

.wprbn-sq__num {
    width: 70px !important;
}

.wprbn-sq__rating-sep {
    font-size: 0.8rem;
    color: rgba(255 255 255 / 0.4);
}

/* Add question */
.wprbn-survey-add-wrap {
    margin-bottom: 2rem;
}

/* Form actions */
.wprbn-survey-form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255 255 255 / 0.06);
}

/* Results */
.wprbn-survey-results-meta {
    font-size: 0.9rem;
    color: rgba(255 255 255 / 0.5);
    margin-bottom: 1.5rem;
}

.wprbn-survey-results-meta strong {
    color: #fff;
    font-size: 1.5rem;
}

.wprbn-survey-result-block {
    margin-bottom: 1.5rem;
}

.wprbn-survey-avg {
    font-size: 2rem;
    font-weight: 300;
    color: #fff;
    margin-bottom: 1rem;
}

.wprbn-survey-bar {
    display: grid;
    grid-template-columns: 100px 1fr 80px;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.wprbn-survey-bar__label {
    color: rgba(255 255 255 / 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wprbn-survey-bar__track {
    height: 8px;
    background: rgba(255 255 255 / 0.08);
    border-radius: 1px;
    overflow: hidden;
}

.wprbn-survey-bar__fill {
    height: 100%;
    background: var(--wprbn-accent, #f5a623);
    border-radius: 1px;
    transition: width 0.4s ease;
}

.wprbn-survey-bar__count {
    color: rgba(255 255 255 / 0.4);
    text-align: right;
    white-space: nowrap;
}

.wprbn-survey-text-answers {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wprbn-survey-text-answer {
    padding: 0.75rem 1rem;
    background: rgba(255 255 255 / 0.04);
    border-left: 2px solid rgba(255 255 255 / 0.15);
    font-size: 0.875rem;
    color: rgba(255 255 255 / 0.7);
    line-height: 1.5;
}

.wprbn-survey-empty-note {
    color: rgba(255 255 255 / 0.3);
    font-style: italic;
    font-size: 0.85rem;
}
