/* ==========================================
   VARIÁVEIS
   ========================================== */
:root {
    --p3-verde:      #1a4a2e;
    --p3-verde-mid:  #2d6e47;
    --p3-verde-light:#e8f5ee;
    --p3-acc:        #4caf7d;
    --p3-text:       #1a1a1a;
    --p3-muted:      #737373;
    --p3-border:     #efefef;
    --p3-bg:         #fafafa;
    --p3-radius:     12px;
}

/* ==========================================
   CABEÇALHO DO POST
   ========================================== */
.p3-post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.p3-post-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.p3-avatar-img {
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.p3-author-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.p3-author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--p3-text);
    line-height: 1.2;
}
.p3-post-time {
    font-size: 12px;
    color: var(--p3-muted);
    cursor: default;
}

/* ==========================================
   CONTEÚDO DO POST
   ========================================== */
.p3-post-content-wrapper {
    margin-bottom: 12px;
}
.p3-content-clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.55;
    font-size: 14px;
    color: var(--p3-text);
}
.p3-read-more {
    display: inline-block;
    color: var(--p3-muted);
    font-size: 13px;
    margin-top: 3px;
    cursor: pointer;
    text-decoration: none !important;
}
.p3-read-more:hover { color: var(--p3-text); }

/* ==========================================
   BARRA DE INTERAÇÕES
   ========================================== */
.p3-interaction-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 8px 0 6px;
}
.p3-reacoes-grupo {
    display: flex;
    gap: 2px;
    flex: 1;
}
.p3-btn-reacao {
    background: none;
    border: none;
    padding: 6px 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 13px;
    color: var(--p3-muted);
    transition: background .15s, color .15s;
    line-height: 1;
}
.p3-btn-reacao:hover {
    background: var(--p3-verde-light);
    color: var(--p3-verde);
}
.p3-btn-reacao.ativo {
    color: var(--p3-verde);
    font-weight: 600;
}
.p3-btn-reacao.ativo .p3-reacao-emoji {
    filter: saturate(1.5) brightness(1.1);
}
.p3-reacao-emoji {
    font-size: 16px;
    line-height: 1;
    display: inline-block;
    transition: transform .15s;
}
.p3-reacao-num {
    font-size: 12px;
    min-width: 12px;
}

/* Animação bounce ao reagir */
@keyframes p3Bounce {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    70%  { transform: scale(0.9); }
    100% { transform: scale(1); }
}
.p3-bounce .p3-reacao-emoji {
    animation: p3Bounce .35s cubic-bezier(.36,.07,.19,.97);
}

.p3-btn-action {
    background: none;
    border: none;
    padding: 6px 8px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--p3-muted);
    font-size: 13px;
    transition: background .15s, color .15s;
}
.p3-btn-action:hover {
    background: var(--p3-verde-light);
    color: var(--p3-verde);
}
.p3-btn-action svg {
    width: 20px;
    height: 20px;
}
.p3-btn-action .numero {
    font-size: 12px;
}

/* Avatares de quem curtiu */
.p3-curtidas-info {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    min-height: 20px;
}
.p3-curtiu-avatar {
    display: inline-block;
    margin-right: -6px;
    border: 1.5px solid #fff;
    border-radius: 50%;
}
.p3-curtiu-avatar .p3-avatar-img {
    width: 18px;
    height: 18px;
}
.p3-curtidas-texto {
    font-size: 12px;
    color: var(--p3-muted);
    margin-left: 10px;
}
.p3-curtidas-texto strong {
    color: var(--p3-text);
    font-weight: 600;
}

/* ==========================================
   MODAL — OVERLAY
   ========================================== */
body.p3-modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}
.p3-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}

/* ==========================================
   MODAL — CONTAINER (2 COLUNAS NO DESKTOP)
   ========================================== */
.p3-modal-container {
    background: #fff;
    width: 100%;
    max-width: 900px;
    border-radius: var(--p3-radius);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

.p3-modal-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--p3-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.p3-modal-titulo {
    font-size: 15px;
    font-weight: 600;
    color: var(--p3-text);
}
.p3-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--p3-muted);
    line-height: 1;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s;
}
.p3-modal-close:hover {
    background: var(--p3-bg);
    color: var(--p3-text);
}

/* Grid 2 colunas */
.p3-modal-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Coluna esquerda: post */
.p3-modal-col-post {
    border-right: 1px solid var(--p3-border);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Coluna direita: comentários */
.p3-modal-col-comentarios {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}
.p3-lista-comentarios {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Header do post dentro do modal */
.p3-modal-post-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.p3-modal-thumb {
    border-radius: 8px;
    overflow: hidden;
}
.p3-modal-thumb img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}
.p3-modal-content-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--p3-text);
}
.p3-modal-content-text p {
    margin-bottom: 10px;
}

/* ==========================================
   COMENTÁRIOS
   ========================================== */
.p3-comentario-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.p3-comment-avatar { flex-shrink: 0; }
.p3-comment-body {
    background: var(--p3-bg);
    padding: 9px 13px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--p3-text);
    flex: 1;
}
.p3-comment-author {
    font-weight: 600;
    font-size: 13px;
    display: block;
    margin-bottom: 2px;
}
.p3-comment-text {
    display: block;
    margin-bottom: 4px;
}
.p3-comment-time {
    font-size: 11px;
    color: var(--p3-muted);
    display: block;
}

/* Comentário pendente */
.p3-comentario-pendente .p3-comment-body {
    background: #fffbeb;
    border: 1px dashed #f5c842;
}
.p3-pending-badge {
    display: inline-block;
    font-size: 10px;
    background: #fff3cd;
    color: #856404;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 500;
    margin-top: 4px;
}

.p3-sem-comentarios {
    font-size: 13px;
    color: var(--p3-muted);
    text-align: center;
    padding: 24px 0;
}
.p3-erro {
    font-size: 13px;
    color: #dc3545;
    text-align: center;
    padding: 24px 0;
}

/* ==========================================
   FORMULÁRIO DE COMENTÁRIO
   ========================================== */
.p3-modal-form-area {
    border-top: 1px solid var(--p3-border);
    padding: 12px 16px;
    flex-shrink: 0;
}
.p3-form-comentario-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
.p3-current-user-avatar { flex-shrink: 0; }
.p3-input-wrapper { flex: 1; }
.p3-input-comentario {
    width: 100%;
    border: 1px solid var(--p3-border) !important;
    border-radius: 20px !important;
    background: var(--p3-bg) !important;
    font-size: 13px;
    padding: 9px 14px !important;
    box-shadow: none !important;
    resize: none;
    line-height: 1.45;
    overflow: hidden;
    transition: border-color .2s;
    font-family: inherit;
    display: block;
}
.p3-input-comentario:focus {
    outline: none !important;
    border-color: var(--p3-acc) !important;
}
@keyframes p3Shake {
    0%, 100% { transform: translateX(0); }
    20%, 60%  { transform: translateX(-4px); }
    40%, 80%  { transform: translateX(4px); }
}
.p3-input-erro {
    animation: p3Shake .4s ease;
    border-color: #dc3545 !important;
}

.p3-btn-enviar {
    background: var(--p3-acc);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, opacity .2s;
    padding: 0;
}
.p3-btn-enviar svg {
    width: 16px;
    height: 16px;
    stroke: #fff;
}
.p3-btn-enviar:disabled {
    background: #ccc;
    cursor: not-allowed;
}
.p3-btn-enviar:not(:disabled):hover {
    background: var(--p3-verde-mid);
}
.p3-btn-enviar.p3-enviando {
    opacity: .6;
    pointer-events: none;
}

.p3-form-hint {
    font-size: 11px;
    color: var(--p3-muted);
    margin-top: 6px;
    padding-left: 46px;
}

/* ==========================================
   SPINNER / LOADING
   ========================================== */
.p3-modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    flex: 1;
}
@keyframes p3Spin {
    to { transform: rotate(360deg); }
}
.p3-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--p3-border);
    border-top-color: var(--p3-acc);
    border-radius: 50%;
    animation: p3Spin .7s linear infinite;
}

/* ==========================================
   MOBILE: modal em coluna única
   ========================================== */
@media (max-width: 680px) {
    .p3-modal-inner {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .p3-modal-col-post {
        border-right: none;
        border-bottom: 1px solid var(--p3-border);
        max-height: 35vh;
    }
    .p3-modal-container {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
    }
    .p3-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .p3-form-hint { display: none; }
}
