/* ==========================================================================
   Sezione commenti lato cliente (galleria) — rifacimento grafico.
   Scoped sotto .uyw-comments per non toccare il resto della pagina.
   ========================================================================== */

.uyw-comments {
    --uyw-accent: var(--main-color, #5e9a8e);
    --uyw-border: #e7e7e7;
    --uyw-muted: #9aa0a6;
    --uyw-bubble: #f4f6f7;
    --uyw-bubble-own: #e8f4f1;
    color: #35404a;
}

.uyw-comments .uyw-title {
    text-transform: lowercase;
    font-weight: 700;
    letter-spacing: .01em;
    margin-bottom: 1.5rem;
}

/* --- banner conferma commenti -------------------------------------------- */

.uyw-confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1.1rem;
    margin-bottom: 2rem;
    background-color: #fbfcfc;
    border: 1px solid var(--uyw-border);
    border-radius: .75rem;
}

.uyw-confirm__msg {
    flex: 1 1 240px;
    margin: 0;
    font-size: .9rem;
    color: #55606a;
}

.uyw-confirm__done {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    color: var(--uyw-muted);
}

/* --- singolo post -------------------------------------------------------- */

.uyw-post {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--uyw-border);
}

.uyw-post:last-child {
    border-bottom: 0;
}

.uyw-post__media {
    flex: 1 1 340px;
    min-width: 0;
}

.uyw-post__media img {
    width: 100%;
    height: auto;
    border-radius: .75rem;
    display: block;
}

.uyw-post__panel {
    flex: 1 1 300px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--uyw-border);
    border-radius: .75rem;
    background-color: #fff;
    overflow: hidden;
}

/* --- lista commenti (thread) --------------------------------------------- */

.uyw-thread {
    flex: 1 1 auto;
    max-height: 320px;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.uyw-empty {
    margin: auto;
    padding: 2rem 1rem;
    text-align: center;
    font-style: italic;
    color: var(--uyw-muted);
}

.uyw-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    align-self: flex-start;
}

.uyw-msg--own {
    align-self: flex-end;
    align-items: flex-end;
}

.uyw-msg__bubble {
    position: relative;
    padding: .6rem .8rem;
    border-radius: 1rem;
    background-color: var(--uyw-bubble);
    border-top-left-radius: .35rem;
    font-size: .9rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
}

.uyw-msg--own .uyw-msg__bubble {
    background-color: var(--uyw-bubble-own);
    border-top-left-radius: 1rem;
    border-top-right-radius: .35rem;
}

.uyw-msg--unread .uyw-msg__bubble {
    box-shadow: 0 0 0 2px rgba(94, 154, 142, .35);
}

.uyw-msg__meta {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin: .25rem .3rem 0;
    font-size: .72rem;
    color: var(--uyw-muted);
}

.uyw-msg__author {
    font-weight: 600;
    color: #55606a;
}

.uyw-msg__del,
.uyw-msg__edit {
    border: 0;
    background: none;
    padding: 0;
    color: var(--uyw-muted);
    cursor: pointer;
    line-height: 1;
}

.uyw-msg__del:hover {
    color: #d22e42;
}

.uyw-msg__edit:hover {
    color: var(--uyw-accent);
}

.uyw-msg__edited {
    font-style: italic;
    opacity: .8;
}

/* conferma eliminazione inline */
.uyw-msg__confirm {
    display: none;
    align-items: center;
    gap: .6rem;
    margin-top: .3rem;
    padding: .35rem .6rem;
    font-size: .8rem;
    border-radius: .6rem;
    background-color: #fff5f5;
    border: 1px solid #f3d3d3;
    color: #b3384a;
}

.uyw-msg__confirm.is-open {
    display: inline-flex;
}

.uyw-msg__confirm button {
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.uyw-msg__confirm .is-yes { color: #169c44; }
.uyw-msg__confirm .is-no  { color: #d22e42; }

/* --- form di risposta ---------------------------------------------------- */

.uyw-reply {
    border-top: 1px solid var(--uyw-border);
    padding: .75rem;
    background-color: #fbfcfc;
}

.uyw-reply__editing {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .5rem;
    padding: .4rem .6rem;
    font-size: .8rem;
    border-radius: .6rem;
    background-color: #eef6f4;
    border: 1px solid #d5e8e3;
    color: #3d6f65;
}

.uyw-reply__editing.is-open {
    display: flex;
}

.uyw-reply__cancel {
    border: 0;
    background: none;
    padding: 0;
    color: #d22e42;
    font-size: .8rem;
    cursor: pointer;
    white-space: nowrap;
}

.uyw-reply__label {
    display: block;
    margin-bottom: .35rem;
    font-size: .8rem;
    font-weight: 600;
    color: #55606a;
}

.uyw-reply textarea {
    width: 100%;
    min-height: 64px;
    max-height: 160px;
    resize: vertical;
    border: 1px solid var(--uyw-border);
    border-radius: .6rem;
    padding: .55rem .7rem;
    font-size: .9rem;
    line-height: 1.5;
    outline: 0;
    transition: border-color .15s ease-in-out;
}

.uyw-reply textarea:focus {
    border-color: var(--uyw-accent);
}

.uyw-reply textarea:disabled {
    background-color: #f1f2f3;
    cursor: not-allowed;
}

.uyw-reply__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .5rem;
}

.uyw-reply__count {
    font-size: .72rem;
    color: var(--uyw-muted);
}

.uyw-reply__count.is-over {
    color: #d22e42;
    font-weight: 600;
}

.uyw-reply__send {
    border: 0;
    border-radius: .6rem;
    padding: .45rem 1.2rem;
    background-color: var(--uyw-accent);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s ease-in-out;
}

.uyw-reply__send:hover {
    opacity: .9;
}

.uyw-reply__send:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.uyw-reply__error {
    display: none;
    margin-top: .4rem;
    font-size: .78rem;
    color: #d22e42;
}

.uyw-reply__error.is-visible {
    display: block;
}

/* --- variante dentro la modal (#modalComments) --------------------------- */

.uyw-comments .modal-body .uyw-thread {
    min-height: 120px;
    margin-bottom: 1rem;
    border: 1px solid var(--uyw-border);
    border-radius: .75rem;
    background-color: #fff;
}

.uyw-comments .modal-body .uyw-reply {
    border: 1px solid var(--uyw-border);
    border-radius: .75rem;
}

.uyw-comments .modal-title.uyw-title {
    text-transform: lowercase;
    margin-bottom: 0;
}

/* --- responsive ---------------------------------------------------------- */

@media (max-width: 767.98px) {
    .uyw-post {
        flex-direction: column;
    }

    .uyw-thread {
        max-height: 280px;
    }

    .uyw-msg {
        max-width: 100%;
    }
}
