/* =========================================================
   FB POSTS — Consulta y Análisis
   Estilos independientes del módulo
   ========================================================= */

.fb-posts-workspace {
    margin: 24px 0 40px;
}

.fb-posts-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.fb-posts-toolbar h2 {
    margin: 0 0 5px;
}

.fb-posts-toolbar p {
    margin: 0;
    color: #666;
}

.fb-posts-summary {
    padding: 12px 16px;
    margin-bottom: 18px;
    background: #f3f5f7;
    border-radius: 8px;
    color: #444;
    font-size: 0.95rem;
}

.fb-posts-results {
    display: grid;
    gap: 16px;
}

.fb-post-card {
    padding: 18px;
    border: 1px solid #ddd;
    border-radius: 9px;
    background: #fff;
}

.fb-post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.fb-post-card-header h3 {
    margin: 0;
    font-size: 1.05rem;
}

.fb-post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px 16px;
    margin-top: 6px;
    color: #666;
    font-size: 0.85rem;
}

.fb-post-status {
    display: inline-block;
    flex-shrink: 0;
    padding: 4px 9px;
    border-radius: 20px;
    background: #e8eef7;
    color: #294c78;
    font-size: 0.78rem;
}

.fb-post-status.with-text {
    background: #e5f3e9;
    color: #27633b;
}

.fb-post-status.without-text {
    background: #f2eeee;
    color: #705050;
}

.fb-post-text {
    margin: 12px 0;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.fb-post-text-empty {
    color: #777;
    font-style: italic;
}

.fb-post-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    color: #555;
    font-size: 0.88rem;
}

.fb-post-id {
    margin-top: 10px;
    color: #888;
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.fb-posts-empty {
    padding: 30px 18px;
    text-align: center;
    color: #777;
    background: #fafafa;
    border: 1px dashed #ccc;
    border-radius: 8px;
}

.fb-posts-error {
    padding: 13px 16px;
    margin-bottom: 16px;
    border: 1px solid #d9a4a4;
    border-radius: 7px;
    background: #fff1f1;
    color: #8b2525;
}

.fb-posts-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
}

.fb-posts-button {
    padding: 9px 16px;
    border: 1px solid #315b86;
    border-radius: 6px;
    background: #315b86;
    color: #fff;
    cursor: pointer;
    font: inherit;
}

.fb-posts-button:hover:not(:disabled) {
    background: #244669;
}

.fb-posts-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 640px) {
    .fb-posts-toolbar,
    .fb-post-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .fb-posts-pagination {
        align-items: stretch;
    }
}

/* Etapa 3: filtros y detalle */
.fb-posts-filters {
    margin-bottom: 24px;
    padding: 18px;
    border: 1px solid var(--border-color, #d8dce2);
    border-radius: 10px;
}

.fb-posts-filters h2,
.fb-posts-detail h2 {
    margin-top: 0;
}

.fb-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
}

.fb-filter-grid label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

.fb-filter-grid input,
.fb-filter-grid select {
    box-sizing: border-box;
    width: 100%;
    min-height: 38px;
    padding: 7px 9px;
    border: 1px solid var(--border-color, #cbd0d8);
    border-radius: 6px;
    background: var(--input-bg, #fff);
    color: inherit;
    font: inherit;
}

.fb-posts-filter-actions,
.fb-posts-detail-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.fb-posts-detail {
    margin-top: 28px;
    padding: 18px;
    border: 1px solid var(--border-color, #d8dce2);
    border-radius: 10px;
}

.fb-posts-detail-header {
    justify-content: space-between;
    margin-top: 0;
}

.fb-detail-section {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #d8dce2);
}

.fb-detail-field {
    display: grid;
    grid-template-columns: minmax(130px, 190px) minmax(0, 1fr);
    gap: 10px;
    padding: 5px 0;
    overflow-wrap: anywhere;
}

.fb-detail-field strong {
    font-weight: 600;
}

@media (max-width: 600px) {
    .fb-detail-field {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .fb-posts-filters,
    .fb-posts-detail {
        padding: 12px;
    }
}


/* Presentación visual de recursos multimedia FB Posts */
.fb-media-section {
    display: grid;
    gap: 14px;
}

.fb-media-card {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border-color, #d8dce2);
    border-radius: 10px;
    background: var(--card-background, transparent);
}

.fb-media-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.fb-media-heading h4 {
    margin: 0;
}

.fb-media-heading span,
.fb-media-no-preview {
    color: var(--muted-color, #687386);
    font-size: 0.9rem;
}

.fb-media-preview {
    max-width: 560px;
    margin: 8px 0 12px;
}

.fb-media-preview img {
    display: block;
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 8px;
    background: #f1f2f4;
}

.fb-media-ocr {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.fb-media-link {
    display: inline-block;
    margin: 4px 0 12px;
}

.fb-media-technical {
    margin-top: 8px;
}

.fb-media-technical summary {
    cursor: pointer;
    color: var(--muted-color, #687386);
}

.fb-media-json {
    max-width: 100%;
    max-height: 300px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: 0.85rem;
    line-height: 1.55;
    color: #ffffff !important;
    background: #172b45 !important;
    border: 1px solid #405b7c;
    border-radius: 6px;
}


/* FB POSTS — Multimedia local */
.fb-media-preview video {
    display: block;
    width: 100%;
    max-width: 560px;
    max-height: 420px;
    border-radius: 8px;
    background: #111;
}


/* Mayor contraste para los metadatos técnicos */
.fb-media-technical summary {
    display: inline-block;
    padding: 7px 11px;
    border: 1px solid #8995a7;
    border-radius: 6px;
    background: #e8edf5;
    color: #243247;
    font-weight: 600;
    cursor: pointer;
}

.fb-media-technical summary:hover {
    background: #d8e1ee;
    border-color: #52647d;
}

.fb-media-technical summary:focus-visible {
    outline: 3px solid #3569a8;
    outline-offset: 2px;
}
