/*
 * Widget-ul fix de feedback.
 *
 * Stă jos-dreapta pe desktop şi devine o bară îngustă pe mobil, ca să nu acopere
 * conţinutul. Pe paginile de anunţ există deja o bară fixă jos pe mobil
 * („Contactează"), aşa că acolo widget-ul urcă deasupra ei — vezi regula cu
 * `body:has(.mobile-reserve-bar)`.
 */

.fb-widget {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 9998;          /* sub toast-uri (9999), peste restul */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    font-size: 14px;
}

/* ─── Butonul ─────────────────────────────────────────────────────── */
.fb-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border: 1px solid var(--border, #ddd);
    border-radius: 999px;
    background: var(--white, #fff);
    color: var(--text-primary, #222);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .14);
    transition: transform .18s ease, box-shadow .18s ease;
}
.fb-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}
.fb-widget.is-open .fb-toggle { transform: none; }

.fb-badge {
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--brand, #FF385C);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
}

/* ─── Panoul ──────────────────────────────────────────────────────── */
.fb-panel {
    width: 340px;
    max-width: calc(100vw - 36px);
    padding: 18px;
    border-radius: 16px;
    background: var(--white, #fff);
    border: 1px solid var(--border-light, #ebebeb);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
    animation: fbIn .18s ease;
}
@keyframes fbIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.fb-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
}
.fb-panel-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 800;
}
.fb-panel-sub {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--gray, #717171);
}
.fb-close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--gray-bg, #f7f7f7);
    color: var(--gray, #717171);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.fb-close:hover { background: var(--gray-lightest, #ebebeb); color: var(--text-primary, #222); }

/* ─── Tipul mesajului ─────────────────────────────────────────────── */
.fb-types {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
}
.fb-type { flex: 1 1 0; cursor: pointer; }
.fb-type input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.fb-type span {
    display: block;
    padding: 8px 4px;
    border: 1.5px solid var(--border-light, #ebebeb);
    border-radius: 10px;
    text-align: center;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--gray, #717171);
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.fb-type input:checked + span {
    border-color: var(--text-primary, #222);
    background: var(--text-primary, #222);
    color: #fff;
}
.fb-type input:focus-visible + span {
    outline: 2px solid var(--focus-ring, #222);
    outline-offset: 2px;
}

/* ─── Câmpuri ─────────────────────────────────────────────────────── */
.fb-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: 700;
}
.fb-optional { font-weight: 500; color: var(--gray-light, #b0b0b0); }
.fb-textarea,
.fb-input {
    width: 100%;
    margin-bottom: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-dark, #ddd);
    border-radius: 10px;
    font-family: inherit;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--text-primary, #222);
    resize: vertical;
}
.fb-submit { width: 100%; }
.fb-note {
    margin: 10px 0 0;
    font-size: 11px;
    line-height: 1.45;
    color: var(--gray-light, #b0b0b0);
}

/* ─── Rezultatul trimiterii ───────────────────────────────────────── */
.fb-result { text-align: center; padding: 8px 0; }
.fb-result.error { color: var(--error, #C13515); font-size: 13px; line-height: 1.5; }
.fb-result-emoji { font-size: 30px; margin-bottom: 6px; }
.fb-result-title { margin: 0 0 4px; font-size: 15px; font-weight: 800; }
.fb-result p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--gray, #717171); }

/* ─── Mobil ───────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .fb-widget {
        right: 12px;
        bottom: 12px;
    }
    /* Textul lung nu încape; rămâne pictograma plus „Beta". */
    .fb-toggle-text { display: none; }
    .fb-toggle { padding: 11px 13px; }
    .fb-panel { width: calc(100vw - 24px); }
}

/* Pe paginile cu bară fixă jos (butonul de contact de pe anunţ) şi pe cele cu
   navigaţie mobilă, widget-ul urcă deasupra lor ca să nu se suprapună. */
@media (max-width: 900px) {
    body:has(.mobile-reserve-bar) .fb-widget { bottom: 88px; }
}

/* Barele de acţiuni lipite jos ar sta exact sub bulina de feedback — care e
   fixată în colţ şi acoperea butonul principal („Publică anunțul"). O ridicăm
   cât timp există o astfel de bară în pagină. */
body:has(.preview-actions) .fb-widget,
body:has(.wizard-bar) .fb-widget { bottom: 86px; }

/* Pe pagina de mesaje, bulina stătea exact peste butonul de trimitere: caseta
   de scris e lipită de marginea de jos, iar widgetul e fixat în acelaşi colţ.
   Butonul era complet acoperit — nu „ascuns" din CSS, ci pur şi simplu sub el. */
body:has(.messages-input-wrapper) .fb-widget { bottom: 92px; }

/* ─── X-ul de ascundere ───────────────────────────────────────────────
   Stă în afara butonului principal, ca să nu trebuiască să deschizi panoul doar
   ca să scapi de bulină. Apare la hover pe desktop; pe touch, unde hover-ul nu
   există, e mereu vizibil. */
.fb-widget { position: fixed; }
.fb-dismiss {
    position: absolute;
    top: -7px;
    right: -7px;
    z-index: 2;
    width: 22px;
    height: 22px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light, #ebebeb);
    border-radius: 50%;
    background: #fff;
    color: var(--gray, #717171);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
    opacity: 0;
    transition: opacity .15s ease, color .15s ease;
}
.fb-widget:hover .fb-dismiss,
.fb-dismiss:focus-visible { opacity: 1; }
.fb-dismiss:hover { color: var(--text-primary, #222); border-color: var(--border-dark, #ddd); }

/* Fără hover (telefon, tabletă) X-ul trebuie să se vadă din start. */
@media (hover: none) {
    .fb-dismiss { opacity: 1; }
}

/* Panoul deschis are deja X-ul lui, deci pe ăsta îl ascundem ca să nu fie două. */
.fb-widget.is-open .fb-dismiss { opacity: 0; pointer-events: none; }

.fb-widget.is-dismissed { opacity: 0; transform: translateY(6px); transition: opacity .18s ease, transform .18s ease; }
